Source: Social Security Administration.

Social Security is vital for millions of retirees. Yet many don't realize that under certain circumstances, you can end up owing income tax on your Social Security benefits. Moreover, a growing number of retirees may have to start paying at least some income tax on what they receive from Social Security, thanks to one particular tax code.

How Social Security benefits get taxed
Many Americans don't realize that Social Security benefits are ever subject to tax. After all, the payroll tax taken out of your paycheck is the source of the money that provides Social Security payments to current recipients. It's natural to assume, therefore, that you won't have to pay again on the back end, because you've essentially paid your taxes up front.

And yet for 30 years, the IRS has collected taxes on some people's Social Security benefits. Specifically, if you 1) have income of more than $25,000 and are single or 2) have income of more than $32,000 and file jointly, then you could have to include some of your benefits in your taxable income. Up to $34,000 for singles and $44,000 for joint filers, the maximum you'll have to include is 50%; above those levels, the maximum goes up to 85%.

To figure out your income for the purpose of calculating your taxes, you add up your regular adjusted gross income and then add in interest from tax-exempt bonds plus half of your Social Security benefits.

Source: Ken Wilcox via Flickr.

It's important to understand that the amount of the tax isn't 50% or 85%. Rather, you include that percentage of your Social Security benefit in your taxable income. Then you apply your normal tax rate to that figure to determine how much in additional tax you'll have to pay.

The purpose for creating this tax was to generate money for the Social Security Trust Fund. When it was first proposed in the early 1980s, the National Commission on Social Security Reform argued that only about 10% of Social Security recipients would get hit by the tax.

The most unfair part of the Social Security tax
The problem with the Social Security tax provisions, however, is that they weren't indexed for inflation. Indeed, that omission was deliberate, and after just 10 years, inflationary pressures had almost doubled the number of Social Security recipients with taxable benefits from 10% to 18%.

If the initial figures had been subject to ordinary inflation indexing, then they would have more than doubled by now. Specifically, based on the recent inflation data compared to 1983, the $25,000 threshold would be close to $60,000, while the $34,000 figure would be more than $81,000.

Be ready to get taxed
The net result of the law's failure to take inflation into account is to raise the number of people subject to the tax. Consider that, for a typical retirement benefit of $1,200 per month, a single person who received as little as $1,500 per month from other sources of taxable income could end up being on the hook for additional income taxes. With costs for retirees having climbed steeply in recent decades, it's hard to categorize those making $1,500 in outside monthly income as rich.

Source: 401(k) 2013.

There are a few things you can do to fight the tax. One thing to remember is that because withdrawals from Roth IRAs aren't taxable, they're not included in income for purposes of taxing Social Security. As a result, drawing money from Roth accounts could be tax-smart from a Social Security standpoint. Conversely, drawing money from traditional retirement accounts does raise your taxable income and can have the unintended consequence of making more of your Social Security taxable.

At some point, of course, there's only so much you can do to juggle your finances to meet your income needs. But being aware of the unfairness of unindexed tax laws will at least give you a chance to think about ways you can reduce or eliminate taxes on your Social Security benefits.