A highly volatile stock market is enough to make anyone sick. After experiencing the worst first half for stocks in over 50 years, the market rebounded with its best month since 2020 in July. And although August started off strong, it's retraced below where it started the month.

You might be thinking it's time to get off the roller coaster. After all, the future still seems treacherous. The U.S. just reported its second quarter of GDP contraction, and while earnings have been better than expected for most companies, those expectations were already very low to begin with.

But pulling your money out of stocks in search of safety now may be a big mistake.

A person looks at a laptop while holding their hand to their mouth.

Image source: Getty Images.

Cash isn't necessarily safe

There's a difference between safety and volatility.

An investment vehicle with no volatility isn't necessarily safe. What if the return was negative 2% every year? You'd know with certainty that you'd have 98% of your money left after a year, and 98% of that a year after that. You'd be guaranteed to lose half your capital in about 34 years. Is that a safe investment?

When you pull your money out of the stock market, you'll likely be holding a lot of cash. Cash has diminishing value over time due to inflation. Very rarely will the United States experience deflation, in which the purchasing power of a dollar improves. The last time the economy experienced deflation was the Great Recession, and the Great Depression before that. Unless you think the economy is headed for another one of those events, cash is going to lose value.

Currently, the United States is experiencing very high inflation rates. A dollar today will buy about 91% of what a dollar bought a year ago, based on the consumer price index.

You can offset some of the impact of inflation by putting your money in a money market or savings account. It's unlikely, however, that the interest you'll earn on your deposits will outpace inflation, especially after taxes.

If you think cash is safe because there's no chance it can go down, think again. Cash may outperform stocks or bonds in any given year, but it's almost guaranteed to lose at least a little bit of value every year.

Why the stock market can be safer

Although the stock market produces volatile returns, it has a long history of outpacing inflation in the long run. So, if the money you have invested in the stock market isn't going to be used in the next few years, it's likely safer to keep your money invested than to take it out.

The expected return of stocks has only improved as stock valuations declined amid the market sell-off at the start of the year. One measure of valuation, the CAPE ratio, measures stock prices in relation to average long-term earnings. It now sits more than 20% below where it was last November.

Since all investment decisions should be made with the future in mind, it seems like an opportune time to put your money to work in the stock market. Indeed, the year following a 20% decline in the S&P 500 has historically produced far better-than-average returns.

It's true: The market could continue to decline. There's no telling when the bear market will end, or if the economy is already recovering. But if you take your money out of the stock market now, you'll be guaranteeing a loss of value on your capital due to inflation. Investing in the stock market remains one of the simplest and most effective ways to grow the value of your savings in the long run.