This year has been a roller coaster for the stock market, and if you're starting to feel whiplash from all the ups and downs, you're not alone.

The S&P 500 is officially in a bear market after falling more than 20% from its peak in early January. The Nasdaq is also firmly in bear territory, and the Dow Jones Industrial Average has been skirting around it for weeks.

It's normal to feel nervous about the stock market in times like these. However, history tells us one important thing about bear markets: They're not as dangerous as they may seem.

The good news about bear markets

One of the toughest parts of investing during a market downturn is that nobody -- even the experts -- knows how long it will last. That can be unnerving, especially if you have your life savings tied up in the stock market.

The good news, though, is that historically, every single bear market has eventually given way to a bull market.

Since 1928, the S&P 500 has fallen by 20% or more on 21 separate occasions (not including the current downturn). On average, that's a bear market every 4.5 years. Yet, it's not only recovered from every single one of those slumps, but it's gone on to see positive average returns over time.

^SPX Chart

^SPX data by YCharts

In other words, the stock market has seen some pretty serious bear markets and recessions over the years, but that hasn't stopped it from growing. It's extremely likely, then, that it will recover from this downturn, too.

How to make money in the stock market despite volatility

The best way to make money in the stock market is to invest consistently and hold your investments for the long term.

It's intimidating to invest during a bear market, but it can actually be a profitable strategy. When you invest during the market's low points, you're setting yourself up for significant gains when stock prices inevitably recover.

Right now is also a fantastic opportunity to scoop up quality stocks for a fraction of the price. By continuing to invest now, you'll not only reap the rewards when the market recovers, but you can also save a lot of money by investing at a steep discount.

To be clear, nobody knows exactly how long it will take for the market to recover. For that reason, it's best to avoid investing any money you might need in the foreseeable future. But if you can afford to invest right now, it could be a profitable move.

The key to keeping your money safe

One of the most important aspects of investing during a downturn is choosing the right stocks. Even the strongest companies may see their stock prices fall during a market slump, but as long as they have solid underlying business fundamentals, they're more likely to bounce back when the market recovers.

Weaker companies, though, may have a harder time rebounding. By doing your research and only investing in solid long-term stocks, your portfolio will have a much better chance of surviving even the worst downturns.

When in doubt, you may opt to invest in an S&P 500 tracking fund, such as the Vanguard S&P 500 ETF (VOO -0.41%). An S&P 500 ETF includes the same stocks as the index itself, and because the S&P 500 is almost guaranteed to recover from downturns, this type of investment will, too.

Market downturns aren't easy to stomach, and it's normal to feel nervous about investing during periods of volatility.

However, right now can be a fantastic opportunity to generate wealth. By investing in the right places and holding those investments for the long term, you can protect your savings while maximizing your earnings at the same time.