The stock market loves to surprise people with unexpected ups and downs, and if the market crashes immediately before or during your retirement, it can wreck your carefully laid retirement plans. This is the essence of sequence-of-returns risk: When it comes to declines in your retirement investments, timing really is everything.

Fortunately, there are a number of options for protecting your portfolio from this type of risk; adopting at least one of them will help ensure you won't suffer a catastrophic loss of retirement income.

Why sequence-of-returns risk is such a problem

During retirement, you can expect your investments to have good years and bad years. However, if you get hit with a few bad years in a row during the decade spanning from the five years before you retire to the five years after you retire, your losses will have a particularly powerful effect on your retirement income. This unfortunate reality is what investment experts call "sequence-of-returns risk." The timing with which market crashes occur will have a lot to do with how strongly said market crashes affect your finances.

For example, let's consider what might happen if your retirement savings suffer a 50% loss in value due to a major market crash. If this loss occurs 20 years before your planned retirement date, you'll still have plenty of time for your investments to recover and start growing again -- and because you're not taking money out of your accounts at that point, the investments will have every opportunity to grow. Plus, you can take advantage of the market crash by purchasing stocks at low prices; when the market recovers, those investments will soar in value.

On the other hand, if you experience that same 50% loss during the year after you retire, you no longer have the luxury of using contributions to buy at the bottom of the market. And because you won't be earning wages anymore, you'll be forced to sell investments at a loss in order to generate income. Worse, you'll have to sell far more of them to earn the money you need.

Say your retirement savings investments are valued at $800,000 on the day you retire, and you need $30,000 in annual income (excluding Social Security) to make ends meet. If your savings drop to $400,000, then taking the $30,000 you need will reduce your holdings by 7.5%, not 3.75% as you originally planned. Such a severe reduction in the balance of your portfolio can be difficult, if not impossible, to recover from.

Chart of stock market crash

Image source: Getty Images.

Coping with sequence-of-returns risk

Now that you know why sequence-of-returns risk is so dangerous, it's time to think about how you'll manage it. You can't control whether or not the stock market will rise or fall, but you can control which investments you choose and how much you withdraw.

The first option is to get rid of investments that are vulnerable to sequence-of-returns risk. That would mean completely eliminating stocks from your portfolio and relying entirely on interest from bonds for income -- meaning you have enough bonds that you can live off the interest payments, rather than having to sell bonds to generate additional income. You would indeed have no worries about sequence-of-returns risk, as the market value of your investments would be moot.

However, this is not a viable option for most retirees, because you'd need to invest an enormous amount of capital to generate sufficient income. For example, the best interest rate right now on new 30-year Treasury bonds is around 3%. In order to generate $30,000 of income each year just from interest, you'd need to own $1 million worth of these bonds. That said, if you have a lot of money to invest and zero tolerance for risk, then you can pull it off. Your best approach is to use a bond ladder to maximize your bond income, as it allows you to take advantage of rising interest rates to lock in higher payments.

The second option is to use your retirement savings to buy a fixed annuity and live off that money instead of your investments. A fixed annuity provides a steady, guaranteed source of income no matter what's happening to the market or the economy. However, as with bonds, you'll need to have a very large sum to invest in order to generate significant income from a fixed annuity -- although the rates on annuities do tend to be a bit higher than long-term Treasury bond rates. Another concern is that inflation can make your annuity payments less valuable over time. A couple of decades down the road, you'll be getting the same exact monthly payments, even if the dollar is worth half what it is now. That could leave you with insufficient income later in retirement.

The third option -- and the most realistic one for retirees who aren't millionaires -- is to compromise. You keep a percentage of your portfolio invested in stocks despite the risks, because in a good year they can generate remarkably high returns. The percentage of your portfolio that you should allocate to stocks will depend on your needs and your risk tolerance. If you're uncertain, then there's a formula that can give you a good starting point: Subtract your age from 110, invest that percentage of your capital in stocks, and put the rest in bonds. For example, a 70-year-old would have 40% (110 minus 70) of their portfolio in stocks and 60% in bonds. Each year, you'd shift 1% of your savings from stocks to bonds, gradually reducing your risk of losses.

Your stocks should be chosen with an eye to keeping your risk low. Dividend aristocrats are a good choice for these purposes, as they have long histories of paying growing dividends. They also have solid, well-established businesses; after all, a company can't pay and raise a dividend every year without earning steady profits. If you prefer not to pick out individual stocks, you can buy shares of a high-dividend-yield mutual fund or ETF.

If you choose this approach, you'll need to tailor your retirement savings withdrawals to the performance of your investments. For example, if you retired last year and your portfolio has returned 7% since then, you might take 3.5% to 4% of the entire balance of your portfolio as a distribution. If your investments performed exceptionally well and your portfolio produced a 10% return during the year, then you might take a bit more -- say, 5% to 6% of your total balance. And if your investments performed poorly and only returned 2% or so during the year, you might withdraw very little or nothing at all. That way, your balances will have grown even after your distribution, leaving you in a slightly stronger position for the following year. Of course, going without that income for a year may not be an option for you, which means you should try to cultivate other sources of income.

If you have enough cash to swing the first or second option, and you're not interested in growing your wealth, then go for it -- you'll have no concerns about sequence-of-returns risk. However, if you're short on savings, like most retirees, then the third option is your best bet to protect your portfolio from market crashes.

The Motley Fool has a disclosure policy.