Inflation is often one of investors' greatest frustrations. It's hardly as devastating as a deep bear market, but inflation is always there in the background, year after year, sapping gains and reducing values behind the scenes. Millions of investors try to avoid this erosion of capital by holding bonds, which guarantee a steady stream of income that can offset the declining real value of the bond itself. But for inflation-beating gains, it's hard to beat the stocks of strong companies, which have consistently outperformed fixed-income investments for many decades.

A major source of that outperformance is the dividends most large public companies pay to their shareholders. Over the past century, the aggregate dividend yield of companies in the S&P 500 (^GSPC 0.87%) has very rarely slipped below 2%, and in recent years that yield has actually moved into line with the yields on U.S. Treasuries. In fact, until the 1950s, the S&P composite -- a data set compiled by Nobel Prize-winning Yale economist Robert Shiller that dates back to 1871 -- regularly boasted higher yields than 10-year and longer-term Treasuries, and higher yields than investment-grade corporate bonds as well. The steep decline in the S&P's aggregate yield since the 1980s also coincided with one of the strongest periods of share-price growth in American market history:


Source: Robert Shiller. 

The S&P handily trounced bond returns since the 1980s, even before dividend reinvestment is taken into account, thanks to its huge share-price gains. Bond analyst Thomas Kenny recently found that the Barclays Aggregate Bond Index outperformed the S&P in only 10 out of the 34 full years of trading from 1980 onward, but its average gain of 8.4% produced far lesser gains than the S&P's annual 13.9% growth rate. Over those 34 years, that's the difference between growing a $100 investment to $1,470 and growing $100 to $4,400.

Over the long run, reinvesting the dividends earned from holding a representative slice of the S&P composite has made a huge difference in several ways. The investor who plowed his dividends back into new shares starting in 1913 would have shaved nearly a decade off of the 25-year bear market that followed the peak of 1929:


Source: Robert Shiller. Dividend reinvestment calculations provided by Morgan Housel.

But this doesn't take inflation into account, does it? Yesterday we looked at the damage inflation has wrought on investors, who would have seen their holdings in the Dow Jones Industrial Average (^DJI 0.67%) linger below 1929's high until 1959. The ultimate end of that inflation-adjusted monster bear market finally arrived in 1991, after several efforts to break through to new inflation-adjusted highs ultimately fell short. Few investors who might have bought stocks in 1929 would have even lived to see the day when their shares permanently reached higher real values than they boasted that year.

With dividends, the picture changes significantly. An investor who started young enough -- say, at the age of 18 in 1913 -- might have lived to see his holdings grow far larger than the values reported for the Dow or the S&P by the first decade after World War II. Not only does the nominal S&P composite reach a new high in 1945 when dividends are reinvested, the real S&P does as well, in the same month! Reinvesting dividends from 1913 onward shaves nine years off of the S&P's nominal bear market, but it cuts 14 years off of an inflation-adjusted bear market.


Source: Robert Shiller. Dividend reinvestment calculations provided by Morgan Housel.
Adjusted with the Consumer Price Index, 1983 = 100.

It's not truly realistic to extend the time horizon of dividend reinvestment much further, since most of us aren't the inheritors of a treasure trove of dividend-paying stocks that have been compounding for decade after decade. But if we did, we'd see some truly staggering returns thanks to the magic of compounding. By the time 1913's savvy 18-year-old investor celebrated his 75th birthday in 1970, his simple S&P composite reinvestment strategy would have turned one share into over 18 shares, and his nominal annualized growth rate of 9.5% would have more than doubled the S&P's 4.1% yearly growth rate.

This investor has no need to worry about inflation keeping him from greater gains -- while Shiller's inflation-adjusted S&P doesn't put 1929 behind it for good until 1985, reinvested dividends ensure that 1945 is the last time our investor ever owned a portfolio that was weaker than it was in 1929. By 1985, his (or far more likely, his descendants') initial share would have grown to a hoard of nearly 36 shares, and his total investment would have been over 68 times larger than it was in 1913, even after factoring in the impact of inflation.

Why should that matter to today's investors? Few who read this today are likely to have been serious investors for more than three decades -- millions of baby boomers (the largest and wealthiest investing demographic) began buying stocks in the 1980s, helping fuel the boom that eventually pushed the inflation-adjusted Dow and S&P past 1929 for good. In nominal terms, buy-and-hold types who merely followed the S&P's path since 1982 (when the real growth began) have done quite well. Their investment, dollars to dollars, is worth 1,600% more after roughly 33 years of simply holding on. But with dividends in the picture, those gains jump to over 3,600%. The difference between reinvested dividends and no dividends at all also makes quite a difference in how investors might view the supposed weakness of the post-dot-com period:


Source: Robert Shiller. Dividend reinvestment calculations provided by Morgan Housel.
Adjusted with the Consumer Price Index, 1983 = 100.

This is an impressive boost to long-term gains, but we can't forget inflation in modern times, either. Reinvesting has more than doubled the nominal returns of the buy-and-forget index investor since the end of the dot-com bubble, but what do things look like in real terms?


Source: Robert Shiller. Dividend reinvestment calculations provided by Morgan Housel.
Adjusted with the Consumer Price Index, 1983 = 100.

Before factoring in dividend reinvestments, we find that inflation shaves off a full 1,000% of the 1,600% a buy-and-hold investor in the S&P would have gained in nominal terms from 1982 to the present day. However, when you let reinvestment work its magic, an investor's real returns nearly pull even with (nondividend-adjusted) nominal returns -- from 1982 to 2014, a consistent reinvestment strategy with the S&P 500 has yielded gains of 1,440% after inflation.

Inflation hurts, but dividends are the best medicine long-term investors have to ease the pain.