Nvidia (NVDA -0.42%) and Palantir Technologies (PLTR -0.34%) have been two of the most popular stocks for tech investors to own in recent years. Since 2023, both are up by more than 1,000%, with Palantir's gains of over 2,000% leading the way.

If it had started that period as a smaller company, then perhaps Nvidia's gains would have been superior. But today, it has grown to a market cap of $4.2 trillion, making the chipmaker the most valuable company in the world. Palantir has a market cap of about $360 billion, just a fraction of Nvidia's size.

Both of these stocks still look to be popular among retail investors, but which scenario is more likely to happen next: that Nvidia will hit $5 trillion, or that Palantir will hit $1 trillion?

People discussing a sales report.

Image source: Getty Images.

The case for Nvidia

For Nvidia to hit the $5 trillion milestone, it would need to rise by another 19% from where it is today. That doesn't seem like a big stretch for a tech stock that has already delivered such life-changing returns to investors in recent years. And with the company still dominating the AI chip market and demand for its products remaining high, it's an entirely plausible scenario to envision. The more pertinent question is likely when, rather than if it will happen.

Nvidia's valuation, while high, isn't extreme when you consider its earnings growth. The stock trades at a forward price-to-earnings (P/E) multiple of 38, based on analysts' estimates. But with profit margins in excess of 50% and with a lot more AI-fueled growth on the horizon, it's hard not to like Nvidia's chances of reaching $5 trillion in market cap sooner rather than later.

If the market remains strong and the economy is in good shape, then I don't think it's unreasonable to expect Nvidia to cross the $5 trillion line before the end of next year. If excitement about AI ramps up further, there's a chance that it might even hit that milestone earlier.

The case for Palantir

For Palantir to reach $1 trillion, it would need to nearly triple in value from where it sits today. That's no easy task. But in just the past year alone, the data analytics stock has surged by around 430%.

Palantir has also been playing a key role in the AI sector, as it offers customers platforms that help them analyze large volumes of data and improve their decision-making processes. It often lands new clients via its "boot camps," where it brings potential customers in and demonstrates how its tools can be applied to their real-world problems. That strategy has been paying off with impressive growth. This year, the company expects revenue of around $3.9 billion, which would be an increase of 36% from 2024.

The stock looks incredibly expensive, trading at a forward P/E of 260. But that actually works in Palantir's favor as investors appear to be looking past traditional valuation multiples and simply focusing on the perceived growth opportunities ahead for the business.

As a trusted partner of government agencies around the world, Palantir is positioned to benefit from increases in spending on defense, which President Donald Trump has been pushing for among U.S. allies. If those nations commit to higher defense spending, that could be a positive catalyst for Palantir, and help push its share price higher.

Which stock will hit its next milestone first?

Both of these AI stocks have been phenomenal investments in recent years. But I believe Nvidia will hit $5 trillion before Palantir reaches $1 trillion.

Palantir's lofty valuation is based too heavily on speculation and hype among retail investors. That leaves it much more vulnerable to a significant sell-off, especially if the economy shows signs of slowing down. When enthusiasm is high and speculation is rampant, Palantir's stock performs well, but earlier this year, in April, after Trump first announced his "reciprocal" tariffs against nearly every U.S. trading partner, the stock slumped to less than $80, dropping its market cap back to the neighborhood of $180 billion.

Nvidia makes for the better all-around investment. Its fundamentals are solid, it has a dominant position in the AI chip market, and while its valuation is high, it's still much easier to justify than Palantir's speculative price tag.