If you invested $1,000 in Amazon in 1997, here's how much you'd have now

How much I saved at Whole Foods with the new Prime discount

E-commerce giant Amazon reached an astounding market cap of $1 trillion Tuesday, becoming the second-ever publicly traded U.S. company to hit this mark, after Apple. Analysts say Amazon's diverse portfolio and continual expansion have helped drive up its valuation. Some even see a path to $2 trillion.

It's been almost a year since Amazon closed its deal to purchase Whole Foods and Amazon's stock has more than doubled over the past year, outperforming other publicly traded grocery chains by a wide margin. Since the Amazon-Whole Food deal closed, the S&P 500 index has been up 18 percent.

From 8/28/2017 to 8/31/2018

As impressive as that is, original investors in Amazon fare even better. If you had invested $1,000 during Amazon's IPO in May 1997, your investment would be worth $1,362,000 as of September 4, according to CNBC calculations.

That's better than the so-called FAANG stocks, plus Ebay – which debuted in that same period. Apple's gain, which was the second highest at a nearly 58,000 percent, is notable, but it also had a 17-year head start and its return is still less than half of Amazon's.

From IPO date to 8/31/2018

Amazon is not only crushing the competition from other grocery stores; it continues to reign supreme in retail as well. Since its IPO in May 1997, Amazon has gained over 134,000 percent, far surpassing other competitors.

It's also worth noting that Amazon began as an online bookstore before it grew and diversified. Barnes & Noble, another book retailer, has seen the value of its stock go down nearly by half.

From 5/15/1997 to 8/31/2018

Despite Amazon's remarkable stock performance, any individual stock can over- or under-perform and past returns do not predict future results.

Want to invest in the next Amazon? Research your options carefully before jumping into the stock market. Experienced investors like Warren Buffett recommend starting out with index funds. These investments hold every stock in an index like the S&P 500, and offer low fees. They also fluctuate with the market, so they offer less risk than picking individual stocks.

Additional reporting by George Manessis and Christoper Hayes.

This is an updated version of a previously published story.

Don't miss: These 24-karat gold Nike LeBron sneakers are worth over $100,000 — take a look

Like this story? Subscribe to CNBC Make It on YouTube!

How this young Indiana couple stole $1.2 million from Amazon