As someone who writes about investing and personal finance, I’m well aware that a stock market crash can be nerve wracking at any time. But I also know that market downturns are nothing to panic about when you’re decades away from retirement.

But what if the market crashes just as you’re about to retire? Talk about bad timing.

A person at a laptop.

Image source: Getty Images.

Unfortunately, it’s a situation you may not be able to avoid. But it’s important to have a plan in case that happens. Here’s mine.

1. I’ll consider delaying retirement

It’s one thing if the stock market tanks a couple of months after you’ve retired. But if the market crashes before I make my retirement official, the first thing I’d likely do is make plans to extend my career a bit.

Now to be fair, my hope is actually to continue working in some capacity in retirement. But when I talk about retirement, I’m including my spouse. His job tends to fall into the “you do it or not” category. I’m not sure how easy it would be for him to do what he does on a part-time basis.

So when I say I’d delay retirement, what I mean is that we’d both likely try to keep working a bit longer than planned. However, there’s no guarantee that we’ll be able to do that, which is why it isn’t our only solution.

2. I’m willing to cut back on spending

My husband and I have a vision for what we want retirement to look like. But we’re also flexible on that vision.

We both recognize that if the stock market takes a dive, we’ll probably need to cut back on spending to some degree to preserve our retirement savings. What might that look like?

A big part of our plans involve RV travel. But we can do that via cheap campgrounds and inexpensive groceries, or we can do that via luxury RV parks and restaurant food along our travels.

We’re not strangers to roughing it. And we’re willing to do that if it means saving thousands of dollars a year at a time when we may want to tap our IRAs and 401(k)s minimally due to market conditions.

3. I’m stockpiling cash to protect my portfolio

One of the most essential components of my backup plan is a cash reserve. A good rule of thumb is to have enough cash in retirement to cover about two to three years of living expenses. This gives you an opportunity to avoid tapping your portfolio during a downturn, thereby locking in losses you might struggle to recover from.

I may err on the side of keeping three to four years’ worth of retirement expenses in cash. It’s a lot, and it will probably mean giving up stronger returns on some of that money. But it might also spell the difference between having to panic or majorly change plans versus ride out a period of market volatility.

A market crash right when you’re on the cusp of retirement could royally mess up your plans. But it doesn’t have to. If you come up with a way to cope with that scenario like I have, you may find that you’re able to forge forward with retirement even if market conditions are far from ideal.