Over the past few years, Nvidia (NVDA 2.69%) and Palantir Technologies (PLTR 0.83%) have become some of the most talked-about stocks around. That's because these technology players have been two of the first to benefit from the artificial intelligence (AI) revolution -- Nvidia by selling the world's top AI chips to drive AI development, and Palantir by selling software that's allowing customers to immediately apply AI to their operations.

This has resulted in double-digit revenue growth at these companies in recent times and solid profitability. Investors have piled into the stocks, too, driving enormous returns. So you might be wondering how much you would have gained if you'd gotten into these stocks earlier in the AI boom. Let's find out.

A view of Nvidia's headquarters is shown.

Image source: Nvidia.

Nvidia's AI dominance

Before diving in, though, let's take a quick look at both of these AI winners. As mentioned, Nvidia dominates in the AI chip market. The company designs graphics processing units (GPUs), the chips needed to power the most critical of AI tasks, and customers from start-ups to top tech players have flocked to Nvidia's products. And speaking of products, Nvidia hasn't stopped with chips. It's built out an entire ecosystem of AI tools and services to make itself the one-stop shop for all customers as they travel along the AI road.

As a result, Nvidia's revenue has soared, reaching a record of more than $130 billion last year, and importantly, the company is highly profitable on sales with gross margin generally above 70%. So it's no surprise investors have favored this stock.

The Palantir story is also a bright one. The software company specializes in platforms that help customers aggregate and analyze their data -- so they can use it to optimize their operations. And two years ago, Palantir launched an AI system called Artificial Intelligence Platform (AIP) that brings the power of AI into the process.

Palantir's explosive growth

Palantir's government and commercial customers have jumped to get in on AIP, and revenue for both businesses has been climbing in the double-digits quarter after quarter. What's particularly positive is the commercial growth as this wasn't a huge business for Palantir several years ago -- so, thanks to the focus on AI, Palantir has brought in more and more commercial customers and supercharged its revenue potential.

Now, let's consider your returns if you had invested $10,000 in each of these companies five years ago. Your Nvidia investment, after a 1,200% gain in the stock, would be worth more than $137,000 today, and your Palantir investment, after a 1,700% increase in the shares, would total $183,560 right now. That adds up to about $320,560.

Is it too late to buy Nvidia and Palantir today?

So you clearly would have won big by getting in on these AI players five years ago. Now the question is: Could you still set yourself up for investing success by buying these stocks today, or is it too late?

The price levels and market values of Nvidia and Palantir were much lower five years ago than they are today, making it easier for the stocks to advance in the quadruple digits.

PLTR Chart

PLTR data by YCharts

It would be nearly impossible for Nvidia stock to post such an increase in the coming five years -- a 1,000% stock price increase would bring it to a $50 trillion market value. Such an increase in Palantir would bring it to a $4.5 trillion market cap, which may not happen in such a short time.

But this doesn't mean it's too late to invest in these two AI giants. Even if they aren't likely to replicate their performances of the past five years they still could increase significantly -- we're in the early days of this AI boom, and demand is high for Nvidia's and Palantir's offerings. All of this means that if you buy and hold these top players, you still could score an impressive win over time.