The legendary investor Peter Lynch once famously said: "Everybody in the world is a long-term investor until the market goes down." That's why investors often claim they'll hold a stock forever and pass it down to their grandchildren as it surges to new highs, yet immediately rush for the exits once a slight interest rate hike drives down the market.

Lynch, like many of the world's most successful investors, believes that people need to tune out all the near-term noise to truly build generational wealth. So today I'll highlight three evergreen stocks that deserve to be bought and held forever: Coca-Cola (KO), Amazon (AMZN 3.43%), and Microsoft (MSFT 1.82%).

A smiling person holds a large piggy bank.

Image source: Getty Images.

1. Coca-Cola

Coca-Cola might not seem like a sound long-term investment since soda consumption rates have consistently declined over the past two decades. But Coca-Cola doesn't only sell sugary sodas these days -- it also sells teas, fruit juices, sports drinks, bottled water, coffee, and even alcoholic beverages. As for its flagship sodas, it's been updating those classic brands with sugar-free versions, smaller serving sizes, and new flavors.

That evolution helped Coca-Cola weather multiple recessions in its 103 years as a public company. It's also a Dividend King that has raised its dividend annually for 61 consecutive years. So if you had invested $5,000 in Coca-Cola 50 years ago and reinvested your dividends, your investment would be worth nearly $465,000 today.

Coca-Cola should continue to grow for the foreseeable future, even as the macro headwinds rattle the broader markets since consumers still buy its beverages during economic downturns. It expects its organic sales to rise 8%-9% this year as its adjusted comparable currency EPS rises 9%-11%. Its stock still looks reasonably valued at 20 times forward earnings and pays a forward dividend yield of 3.3%, so it easily tops my shopping list of blue-chip stocks for building generational wealth.

2. Amazon

Amazon is the world's largest e-commerce and cloud infrastructure services company. It's also a major advertising company since it sells integrated ads across its own marketplace, and it offers streaming videos, video games, and other digital perks to its Prime subscribers. It also operates brick-and-mortar grocery and convenience stores through its Whole Foods Market and Amazon Go banners, respectively.

Amazon went public 26 years ago. If you had invested $5,000 in its IPO, your investment would be worth nearly $8.5 million today. Its sales skyrocketed as it expanded its e-commerce marketplace beyond books to disrupt a wide range of traditional brick-and-mortar retailers, and its profits soared as it expanded its higher-margin cloud infrastructure business.

Amazon repeatedly subsidized the loss-leading expansion of its e-commerce business with its higher-margin cloud business. That resilient growth cycle generated plenty of cash, which enabled it to consistently expand its subscription-based Prime ecosystem to lock in more shoppers. It served over 200 million Prime subscribers at the end of 2020.

The recent macro headwinds throttled consumer purchases on its e-commerce marketplace and enterprise spending on its cloud services, but its growth will likely accelerate again once the macro environment improves. Analysts expect its revenue to rise 11% this year as it returns to profitability (upon lapping a big investment-related loss in 2022), and its stock isn't too pricey at 40 times forward earnings. Therefore it's still a great long-term play on the e-commerce and cloud markets. 

3. Microsoft

Microsoft is the world's leading provider of PC-based operating systems and productivity software. It's the second-largest cloud infrastructure services provider after Amazon, its hardware division produces Xbox consoles and Surface devices, and it's the biggest backer of OpenAI, the parent company of ChatGPT. That investment has enabled the tech giant to directly integrate ChatGPT into its Bing search engine and Azure cloud services.

Microsoft was once considered an also-ran of the tech sector, but CEO Satya Nadella -- who took the helm as the tech giant's third CEO in 2014 -- revived its business by becoming a "mobile first, cloud first" company. Under that mantra, Microsoft rolled out new iOS and Android apps instead of stubbornly expanding Windows Phone, aggressively expanded its Azure cloud platform, and transformed many of its desktop-based applications into cloud-based services.

As a result, Microsoft generated a total return of 691% over the past nine years, which would have turned a $5,000 investment into nearly $40,000. The growth of Microsoft's cloud-oriented businesses cooled off over the past year as many of its customers scrutinized their spending, but they should stabilize again once the macro headwinds dissipate.

Looking ahead, Microsoft's investments in OpenAI, the integration of AI into its ecosystem, and the expansion of cloud services could all drive its long-term growth. Analysts expect its revenue and adjusted EPS to grow 11% and 12%, respectively, this year, and it still looks reasonably valued at 29 times forward earnings.