Living through a stock market crash is one of the most harrowing experiences for an investor. Watching your portfolio drop day after day after day -- after day -- can make even the most committed long-term investors doubt their choices. The market will recover eventually, but you never know how long it will take, or if you have the fortitude to survive unscathed.

Look at the history of market crashes: The Great Depression of 1929 saw markets drop 24.8% in a few days, and on Black Monday in 1987, they tanked 22.6% in one trading session. During the 2008 Great Recession, the Dow Jones Industrial Average lost 50% in a very short time, and just a few months ago, the S&P 500, a gauge for the U.S. stock markets, lost 34% of its value in February and March. When will the next plummet come? And will you be prepared?

Market crashes are inevitable but don't have to be calamitous to your financial health. Here are three ways to protect your portfolio from the next one.

Highway sign that says Economic Uncertainty Ahead being hit by lightning with gray clouds in the background.

Image source: Getty Images.

1. Build up your cash

Cash is an important element of your portfolio, both during market crashes and regular times. Financial advisors recommend that all investors have at least three to six months of liquid cash available to protect from any unforeseen expenses, which could be as simple as a car repair or as complicated as a severe medical crisis.

During a market downturn, cash is wonderful to have because that money won't lose any value as stocks tumble around you. In addition, you won't have to sweat any loss of income or asset value because you'll have cash on hand to cover your needs -- and you won't have to sell any stocks -- while you wait for the markets to recover.

If you're living in an unstable economy, you may want to build up more cash to add possible bargain stocks to your portfolio, so that you can take advantage of a market crash.

Two hands surrounding and holding one hundred dollar bills.

Image source: Getty Images.

2. Make a list of stocks you'd like to buy

If there's a bright side to a market crash, it's that smart investors who have cash on hand can pick up stocks at bargain prices. For instance, if you had purchased Microsoft (NASDAQ:MSFT) at $17 a share during the Great Recession in March 2009, you'd have enjoyed a more than 12-fold increase in the stock price as of this writing, just 11 years later.

When stocks drop, the buffet of possible investment choices may be overwhelming. Therefore, it's best to make a list of stocks that interest you before the market drops, so you'll be ready to pounce when the opportunity arises.

Jar that says dividends and is full of coins.

Image source: Getty Images.

3. Create income with dividend stocks

Stocks that pay dividends are a great choice for your portfolio at any time, because no matter whether prices rise or fall, they're always generating money for you. By devoting part of your portfolio to dividend stocks, you'll have money coming in no matter what's happening to the overall market.

Start by looking at the Dividend Aristocrats, companies that have increased their base dividend every year for at least 25 consecutive years. You'll see great names on that list, including Coca-Cola, Johnson & Johnson, McDonald's, and Target.

And there's an added bonus: As stock prices go down, as they would during a crash, dividend yields (the ratio of a company's annual dividend compared to its stock price) go up. So dividend stocks become even more valuable during a market crash.

A plunging market can be devastating to investors who don't plan ahead. But for those who do and have cash on hand, there are ample opportunities during a market crash to purchase companies at bargain prices. And having that cash available will also guarantee that you won't be struggling to pay your bills.

Taking the above steps will help you ride out any unforeseen market swings with peace of mind while enabling you to purchase a piece of the action.