The tech-heavy Nasdaq Composite has seen a nice lift this year, rising about 9% year to date as of this writing. Many growth stocks have risen even more. This is likely a breath of fresh air to many tech investors since the Nasdaq fell a whopping 33% in 2022.

But before investors start rushing to buy tech stocks, it might be wise to take a moment and consider whether or not the valuations of some of these stocks actually make sense. Here are two tech stocks that might be worth avoiding at their current valuations, particularly after their sharp run-up this year. These stocks have both risen about 22% in 2023. But investors should not count on big gains persisting.

1. Atlassian

Collaboration software-as-a-service company Atlassian (TEAM -9.56%) could have some useful tools for businesses to become more productive. Jira, Confluence, and Trello are some of their most important offerings.

Across these products and more, the company had 253,177 customers at the end of its most recent fiscal quarter. Even more, Atlassian is seeing impressive revenue growth considering the uncertain economy. Revenue in its fiscal second quarter rose 27% year over year. 

But the company commands more than a $40 billion market capitalization on Wall Street despite not being profitable yet. Atlassian's net loss for the trailing-12-month period was nearly $400 million. Though this was a notable improvement from a loss of more than $600 million in the prior year.

Even if Atlassian swings to profitability in the coming years, it could take years for earnings to be substantial in relation to the current market capitalization. 

And the stock doesn't look cheap on a price-to-sales (P/S) basis, either. Shares trade at a P/S of 13. This compares to Microsoft's P/S of 9. 

2. Cloudflare

Another tech stock with a difficult-to-justify valuation is Cloudflare (TEAM -9.56%). The company's $18 billion market capitalization at the time of this writing is incredibly high in relation to both its trailing-12-month revenue of $975 million and its net loss for the same period of $193 million.

The edge-computing company is growing fast, with fourth-quarter revenue rising 42% year over year, but analysts don't expect this growth to translate to a net profit anytime soon. Indeed, the current consensus forecast calls for net losses as far out as 2027. 

"But they are free-cash-flow positive"

So how have these companies survived on losses? In part, by diluting shareholders. Many executives and employees are paid heavily in stock-based compensation. This lets unprofitable tech companies like Atlassian and Cloudflare produce free cash flow to pay their bills, but it makes them somewhat dependent on a high stock price.

It also leads to shareholder dilution. If these companies' share prices were cut in half from here, higher levels of shareholder dilution might be required to maintain the same level of compensation for existing employees. This means the stock price itself is arguably a risk to these unprofitable companies.

To Atlassian's credit, its share count has only increased by about 3.6% over the past three years. Of course, that's still meaningful dilution. Cloudflare's share count, however, has grown by more than 8% during this same time.

But even if we were to value these companies based on their free cash flow (FCF), it's still a big reach to arrive at their current market capitalizations. Atlassian and Cloudflare have price-to-FCF ratios of 51 and 483, respectively.

While it's possible that both companies' staggering top-line growth rates persist long enough to give them positive net income, that would just be the first step to living up to their current valuations. They would then need to prove that their business models can generate significant net income -- measured in the billions -- for years to come. This is a tall order.

Remember: Even if you like these companies, it's OK to stay on the sidelines and not invest in their stocks. It would be downright exciting to see innovation pay off as handsomely as the market capitalizations imply. But investors might want to avoid these stocks and look for alternative investments that require less speculation.

In a time when investors can buy U.S. Treasuries with yields above 4%, investing in such speculative stocks might not be wise. The opportunity cost, which is an investment backed by the full faith and credit of the U.S. government, is arguably too attractive.