When you're retired, you need all the income you can get. This income may derive from many sources, including retirement investment accounts, pensions, and Social Security. However, there's a good chance you'll lose at least part of your retirement income to the IRS -- and potentially to state taxes as well.

The good news is, not all of your retirement income is necessarily subject to taxation. It's important to understand how tax rules apply to different sources of funds in retirement so you can plan accordingly and be prepared when taxes come due. This guide will help.  

A 1040 form and pen next to a calculator

Image source: Getty Images.

How are retirement benefits taxed?

Federal tax rules for retirement income differ depending on the source of the income, as well as on how much you make. Things get even more complicated when it comes to state taxes, because there are big differences from one state to another. 

Here's what you need to know about how the federal government and the state you live in may tax different benefits. 

Social Security benefits

The federal government taxes Social Security benefits, but only if your income reaches a certain threshold.

Income is calculated in a special way when determining whether your Social Security benefits are taxable. Your income is determined by adding half your Social Security benefits to all your other taxable income from other sources. Some tax-free income, such as municipal bond interest, is also added to determine your total income. 

If your income using this calculation exceeds $25,000 as a single filer or $32,000 when married filing jointly, you could be taxed on up to 50% of your Social Security benefits. If your income exceeds $34,000 as a single filer or $44,000 when filing as married filing jointly, you'll be taxed on up to 85% of benefits. 

As for state taxes, only 13 states tax Social Security benefits: Colorado, Connecticut, Kansas, Minnesota, Missouri, Montana, Nebraska, New Mexico, North Dakota, Rhode Island, Utah, Vermont, and West Virginia. If you live in one of them, you'll also need to learn your state's rules for when and how your benefits will be taxed. 

Pension income

If you're lucky enough to get a pension from your employer, the entire amount you receive is probably taxable income federally. This is the rule if you didn't contribute any of your own money to your employer's pension plan. However, if you contributed to your pension with after-tax funds, you don't have to pay taxes on any part of the pension that's considered to be a return of these contributions you made. The IRS explains how to determine what portion of your pension isn't taxed, but the general rule is that you divide the contributed amount by the number of months the IRS estimates as your remaining life expectancy. 

The IRS treats pension income you're taxed on as ordinary income, so you're taxed on the entire amount at your normal tax rate. Because we have a pay-as-you-go system in the U.S., either taxes will need to be withheld from your pension checks or you'll need to pay estimated taxes to avoid penalties. 

As far as state taxes go, if you live in Alaska, Florida, Illinois, Mississippi, Nevada, New Hampshire, Pennsylvania, South Dakota, Tennessee, Texas, Washington, or Wyoming, your pension income won't be taxed. If you live in any other state, you'll need to find out your local rules. Many other locales also exempt some types of pension income from taxation, including Alabama, Arkansas, Colorado, Delaware, Georgia, Hawaii, Iowa, Kentucky, Louisiana, Maine, Maryland, Michigan, Missouri, Montana, New Jersey, New Mexico, New York, Ohio, Oklahoma, Oregon, South Carolina, Utah, Virginia, and Wisconsin. 

Retirement account distributions

When you make withdrawals from traditional retirement accounts, including IRAs, 403(b)s, 401(k)s, 457s, and thrift savings plans, the federal government will tax you on those distributions as ordinary income. That means you'll pay taxes based on whatever your tax rate is. If you have Roth accounts, on the other hand, you aren't subject to any federal taxes on withdrawals as long as you've complied with requirements related to your age and how long you've had your accounts open. 

State tax rules also differ on how retirement account distributions are taxed. In Alaska, Florida, Nevada, South Dakota, Texas, Washington, and Wyoming, there is no state income tax, so you don't have to worry about being taxed on your account distributions. In other states, including Colorado, Georgia, Kentucky, Illinois, Michigan, Mississippi, Oklahoma, Pennsylvania, South Carolina, Virginia, and West Virginia, at least some retirement account distributions are tax exempt. You can check with the Department of Revenue where you live to find out the specific rules. 

Plan ahead and be prepared for taxes

It's important to be prepared for the reality that taxes will take a bite out of your retirement income. When you're figuring out what your retirement income will be, don't forget to consider the taxes you'll need to pay -- and if you want to limit the amount the government gets, consider investing in Roth accounts so you can make withdrawals tax free.