The dream for many investors is to find companies they can buy and hold for 30 years or longer. The ability to compound gains over time is a powerful concept that can lead to life-changing wealth. The effect is amplified with steady savings paired with long-term investing.

Let's take a look at 15 stocks that are currently in the Dow Jones Industrial Average or were in the Dow for the majority of the last 15 years and look at their gains over time. Through this exercise, you may be surprised to learn which companies have outperformed or underperformed the S&P 500 over the last 30 years.

Two people enjoying hot beverages in mugs at a table outside of a cafe.

Image source: Getty Images.

Why beating the stock market is so challenging

Let's go back in time to April 1992. Walt Disney's (DIS 0.16%) Aladdin would come out later that November, followed by the Lion King and The Jungle Book in 1994, Pocahontas and Toy Story in 1995, 101 Dalmatians in 1996, Hercules in 1997, A Bug's Life and Mulan in 1998, and Tarzan and Toy Story 2 in 1999, and so many more feature films. In many ways, this was the beginning of the true heyday of Disney. It had just opened Hollywood Studios in 1989, would open Animal Kingdom in 1998, it had yet to buy Pixar, and it was still decades away from buying Marvel or Star Wars. And yet, despite all of that growth ahead, Disney stock still underperformed the S&P 500 over the last 30 years.

DIS Total Return Level Chart

DIS Total Return Level data by YCharts

Coca-Cola's (KO 2.14%) global reach substantially grew over the last 30 years as it added more brands and established soda fountains in restaurants and fast-food chains alike. And yet it too underperformed the S&P 500.

ExxonMobil (XOM 1.15%) had yet to experience the shale revolution and the booming oil and gas market of the 2000s and early 2010s. Even factoring in the oil and gas bull market of 2021 and 2022, Exxon is still an underperformer over this 30-year time period, and it's no longer part of the Dow.

We all know the story of General Electric (GE -3.19%) and International Business Machines (IBM 0.06%). But that story is only clear in hindsight, and was not obvious 30 years ago. In the early 90s, these two companies were unrivaled. No one knew how far GE would over-expand, or that IBM would fail to transition to the personal computer market. These failings are a big reason why these companies have underperformed and why GE got booted out of the Dow.

And yet all five companies produced incredible gains over the last 30 years. An investment in GE still produced a nearly seven-fold total return despite all of the turbulence. The other four companies all grew 10-fold or better over the last 30 years. This is all to say that even if an investor doesn't beat the stock market, investing in good companies, even if they have their challenges, can still lead to some impressive wealth over time.

Upside potential

Now let's look at some winners. Here is a chart of 10 Dow stocks that beat the S&P 500 over the last 30 years.

MCD Total Return Level Chart

MCD Total Return Level data by YCharts

Now we all know the meteoric ascent of Microsoft (MSFT -1.27%) and Apple (AAPL -1.22%). But $15,000 invested in Mcdonald's (MCD 0.37%), Nike (NKE -1.26%), or Home Depot (HD 0.74%) 30 years ago would have made you a millionaire today. Even companies as simple and somewhat obvious as Procter & Gamble (PG 0.54%) or Johnson & Johnson (JNJ 1.49%) easily outperformed the S&P 500. The lesson here is that diversification has its advantages, and that there are winners from every sector of the economy -- many of which are hiding in plain sight.

The price of admission

Volatility is simply par for the course when it comes to investing. All long-term winning stocks have gone through painful drawdowns, many by 50% or more multiple times. Bear markets can be stressful and nerve-racking. And when you're in the teeth of one like we are now, it can feel like there is no way out.

During times like this, investors can take solace knowing that the single hardest part of being a long-term investor is enduring bear markets. Nothing else comes close. However, every bear market teaches new lessons and builds endurance. The good news is that it gets easier over time. In many ways, experiencing bear markets can be a good reminder that stocks don't just go up, and the stock market is sensitive to short-term inputs. By sticking with companies with strong fundamentals and good balance sheets, an investor can position themself to survive market crashes and let the long-term growth and progress of the economy work its magic.