Many retirees inevitably wind up relying pretty heavily on Social Security. And many are also notably shocked when they find out that Social Security has the potential to be taxable.

For one thing, there are 12 states that tax Social Security to varying degrees. Social Security income can also be taxable at the federal level. And those taxes could put a damper on some of your retirement plans.

The good news, though, is that choosing the right home for your retirement savings might get you out of paying federal taxes on your Social Security benefits. So if you're in the process of building a nest egg, you may want to consider putting your money into a Roth IRA or 401(k).

Two people on a couch looking at a tablet.

Image source: Getty Images.

Keep more of the benefits you've earned

To see if you'll be taxed on Social Security in retirement, you need to calculate or estimate your provisional income, which is basically half of your annual Social Security benefit plus 50% of your adjusted gross income and any tax-free income you earn (such as interest paid by municipal bonds). Once that threshold reaches $25,000 for singles, federal taxes on Social Security can come into play. The same holds true when provisional income reaches $32,000 for married couples filing jointly.

Clearly, these thresholds are pretty low, which means your chances of getting taxed on Social Security in retirement may look pretty high. But one step you can take to avoid those taxes is to keep your retirement savings in a Roth IRA or 401(k).

When you contribute money to a Roth savings account, you don't get an immediate tax break like you would for funding a traditional IRA or 401(k). But instead, you get tax-free withdrawals in retirement. And those withdrawals don't count when calculating provisional income.

So, let's say you're entitled to $2,000 a month from Social Security, or $24,000 a year, and you also earn $2,000 a year in municipal bond interest but have no other income aside from Roth 401(k) or IRA withdrawals. In that case, your provisional income is $14,000, which puts you below the threshold of having your Social Security benefits taxed. This holds true even if you withdraw $40,000 a year from your Roth savings plan.

A strategic move

Saving for retirement in a Roth account won't just potentially get you out of paying taxes on Social Security benefits. It might also make for a less stressful retirement.

Once you leave the workforce and stop collecting a paycheck from a job, you may find that money starts to get tight. But not having to pay taxes on your retirement income could help you stretch it further and make the most of your limited resources.

Furthermore, while we know what tax rates look like at present, we don't know whether Americans' collective tax burden will increase over time or not. By keeping your retirement savings in a Roth IRA or 401(k), you can protect yourself from future tax hikes that have the potential to hurt you financially as a senior.