I wanted to know not only for myself, but because I have a daughter just starting in her career. I also have a wife with a 401k and over a decade to retirement. I have a son in college. I handle my retired parents’ money. And I have other family and friends who follow traditional brokerage advice and have 60% of their portfolios in stocks (or more in some cases).

So, if the stock market crashes, how long does history say it’ll take for their stock holdings to return to pre-crash levels… months? Years? Or—gulp—decades?

It’s an important question, because the answer will tell you how to invest depending on your timeframe. And if the answer ends up being “a long time”, well, you might consider sidestepping the stock market altogether if you, too, are nervous about its frothy nature.

At this point the average stock broker will pull out a looong term chart of the S&P and show that over time—despite numerous crashes and corrections and bear markets—the stock market ultimately marches higher. History does show this to be true on a nominal basis, further bolstered by the investor who is dollar cost averaging and reinvesting dividends (though these charts always exclude commissions and fees).

But when I saw one of those charts from my broker many years ago, I did notice one thing: over the past 100 years or so, there were a handful of crashes that not only looked like the Grand Canyon, they took a long time to recover. “What if that happened to my portfolio?” was the question I immediately muttered to myself.

Years later, after recalling my Dad’s grumbling about inflation in the late 1970s, I had a second question: if the Dow did end up taking a protracted time to get back to even, wouldn’t inflation erode my real rate of return? If it took a portfolio-killing ten years, for example, I might have earned back that $20,000 I lost, but now the car I’d planned to buy with that money cost not $20,000 but $30,000. Or $40,000. Show me all the long-term charts you want but I still can’t afford to buy that car.

So here was my inquiry: in the biggest market crashes, how long has it historically taken the S&P to return not to its pre-crash price, but to the inflation-adjusted level? By asking this question, I felt like I’d be better equipped to not just handle a major downturn but decide if I should be in the market at all.

Here’s what I discovered. In the four biggest stock market crashes since 1900, the inflation-adjusted recovery periods were all measured in decades.

Inflation rates obviously varied during each period, but even low inflation adds up over time. So even when the nominal price of the S&P climbed back to the prior peak, it had taken so long that that amount of money would no longer buy as much. Your brokerage statement might show a gain, but in real terms you’d still be underwater. It’s a sobering realization, one that dawns on most people only when they go to actually spend the money.

Here’s the breakdown of each recovery period:

Beginning in 1906, it took the S&P 500 index 20 years to get back to its inflation-adjusted, pre-crash level. No wonder; the total amount of inflation during that time period was 74.0%.

Deflation was the name of the game in 1929, of course, with inflation readings registering as low as -10.3% during the Great Depression. But the S&P had fallen so far that inflation returned before it could recover… inflation totaled 48.7% during the 26-year time span, resulting in the S&P not reaching breakeven until 1955.

From 1973 to 1987, inflation totaled a whopping 104.0%. High inflation rates combined with the depth of the crash made stocks “dead money” during that 14-year span.

And those “low” inflation readings we’ve had since the new millennium? It totaled 35.2% over the first decade and a half, and led to the S&P taking 14.5 years to regain its full purchasing power. This silent erosion kept unsuspecting investors in the red, on a real basis, until 2015.

It’s worth pointing out that the Nasdaq still has not recovered from the bursting of the internet bubble. It lost 78% of its value in the crash, and adjusted for inflation is still down 17.6% (as of 6-30-17) from its March 2000 peak! In other words, almost two decades later, tech stocks are not back to the same level of purchasing power, despite the index being higher on a nominal price.

Clearly, the biggest stock market crashes in history have been big enough that inflation played a key role in their recovery.