If you're about to retire, you may be wondering: How is retirement income taxed? The truth is, the IRS wants a piece of your income in retirement just as it did back when you were working. If you have a pension, 401(k) plan, or traditional IRA, the payments you receive in retirement are subject to federal income tax. Not only that, but in some circumstances, Social Security benefits are taxed as well. Planning for taxes in retirement can help you avoid financial stress down the line, so it's important to know what to expect.

Retired Couple On Beach

IMAGE SOURCE: GETTY IMAGES.

Social Security

Though some people don't have to pay taxes on Social Security, if you have an additional source of income, you could wind up paying taxes on your benefits. To see whether Social Security taxes apply to you, you'll need to calculate your provisional income.

To do so, start by taking your total income not including Social Security and adding any tax-free interest you receive (such as interest from municipal bond investments). Next, add in 50% of your Social Security benefit amount. If your total falls between $25,000 and $34,000 and you're a single filer, you could be taxed on up to 50% of your benefits. The same holds true if you're a joint tax filer and that number falls between $32,000 and $44,000. Furthermore, if your provisional income exceeds $34,000 as a single filer or $44,000 as a joint filer, you could be taxed on up to 85% of your benefits.

Investment gains

Whenever you make money on an investment such as a stock or bond that isn't held in a tax-advantaged account, you're required to pay taxes on your earnings -- even in retirement. However, the amount of tax you'll pay depends on how long you hold the investment in question.

Investments that are held for one year or less and sold at a profit are considered short-term capital gains and are taxed as ordinary income. Long-term gains, which are gains on assets held for more than a year, are taxed more favorably. Most taxpayers are subject to a 15% long-term capital gains rate, and even the wealthiest Americans are currently capped at 20%. If you're planning to sell off assets to generate extra retirement income, it's a good idea to hold them for at least a year and a day to avoid higher short-term capital gains taxes.

Withdrawals from a pension or retirement account

It may seem unfair that your IRA or 401(k) withdrawals are subject to taxes in retirement, but remember that since you never paid taxes on that money in the first place, it kind of makes sense that you'd be taxed down the line. The same rule applies for pension plans -- your withdrawals will be taxable in retirement.

Now, if you have a Roth IRA, there's some good news: Because Roth accounts are funded with after-tax dollars, you won't pay taxes on withdrawals in retirement. As long as your Roth was opened at least five years before you start taking distributions, you won't pay a dime in taxes on those withdrawals.

Finally, if you have an annuity that you funded with after-tax dollars, you might pay taxes on part of your withdrawals in retirement. Annuity tax rules are a bit complicated, but in a nutshell, when you take money out of an annuity, the portion that represents your principal investment is not subject to taxes. You will, however, pay taxes on the portion that's considered investment gains.

When you're living on a fixed income, unexpected taxes can really throw you for a loop. So, as you sit down to create a retirement budget, be sure to take taxes into account. If you go into retirement knowing full well that your income will be taxed, it'll soften the blow and help you avoid unpleasant financial surprises. 

Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.