It's official: The country is in a recession. The coronavirus has wreaked havoc on the U.S. economy, and with the number of COVID-19 cases rising quickly, it seems that this pandemic is far from over.

Nearly half (46%) of Americans believe it will take at least two years for the economy to recover from the pandemic, according to a survey from Country Financial, but nobody knows exactly how long this recession will last. Whether you're nearing retirement or still have several years left in your career, there are a few ways the recession could affect your senior years.

Older man sitting on a couch looking out the window

Image source: Getty Images.

1. Mass layoffs could affect your future Social Security benefits

The Social Security Administration (SSA) relies primarily on payroll taxes to fund benefits. For years, however, the amount coming in from workers' payroll taxes hasn't been enough to fully fund benefits, so the SSA has had to dip into its trust funds to avoid reducing beneficiaries' monthly checks. Those funds will run out of money eventually, though, and the SSA estimates they'll be depleted by 2034. Once the trust funds run dry, the SSA will only be able to pay out approximately 76% of projected benefits.

The mass layoffs triggered by COVID-19, however, could deplete the trust funds even sooner. There are a lot fewer people paying payroll taxes right now, and if businesses have to close once again to mitigate the spread of the virus, more layoffs could be on the way. That means the SSA may need to take more than expected from its trust funds, and Social Security recipients could see benefit cuts sooner than 2034.

President Trump is also proposing payroll tax cuts as part of the next coronavirus stimulus bill, which could exacerbate Social Security's problem. Not only could the trust funds be depleted sooner with less money coming in from payroll taxes, but if payroll taxes are permanently reduced the SSA also won't have as much to pay out in benefits once the trust funds run dry. That means benefits could be reduced sooner than 2034, and the cuts could be deeper than expected.

2. A stock market downturn could affect your retirement investments

The stock market has been booming over the last month, despite the fact that the country is in a recession and the number of COVID-19 infections continues to climb. However, another market downturn could be on the horizon -- especially if more shutdowns come -- and that could affect your retirement savings.

If you're close to retirement age, a market downturn could force you to rethink your plans. You might consider delaying retirement by a few years to save more, but that can be risky if you're concerned about being laid off due to COVID-19. If you do lose your job and your savings take a hit, you might have no choice but to retire earlier than expected and make financial sacrifices.

One thing you can do right now, though, is double-check your asset allocation, or how your investments are divided within your portfolio. The closer you get to retirement age, the more conservative your portfolio should be. In other words, your portfolio should be more heavily weighted toward bonds and other "safer" investments rather than stocks.

It's still a good idea to continue investing some money in stocks even after you retire, because that will help your savings grow faster. But by investing more conservatively overall, your savings won't be decimated by a stock market crash.

3. A recession could affect when you begin claiming Social Security benefits

Deciding when to begin claiming Social Security benefits is a crucial retirement move, because it will affect how much you receive each month in benefits for the rest of your life. But during a recession, you may not have the luxury of choosing when you want to file for benefits.

If you lose your job and are forced into an earlier-than-expected retirement, you may decide to begin claiming benefits as early as possible so you won't need to survive on your savings alone. You'll receive smaller checks by claiming earlier, but if you need the money and don't think you'll be able to find another job anytime soon, Social Security can make it much easier to afford early retirement.

On the other hand, if you are able to continue working, you might opt to delay claiming benefits by a few years. The longer you wait to claim (up to age 70), the more you'll receive each month. Those bigger checks can provide greater financial security in retirement, especially if your savings won't go as far as you need them to.

Because nobody knows how long this recession will last, it can be tough to plan for retirement right now. But by considering the ways the recession could affect your savings and your future Social Security benefits, you can go into retirement as prepared as possible.