Tax-favored retirement accounts are a great way to save for one's golden years. But when people die before using up all of their IRA money, their heirs could be the ones left to pay off the tax man. How much you pay in income tax when you inherit an IRA generally depends on what type of IRA it is and what your own tax bracket is.

Traditional vs. Roth IRAs
The general rule for retirement accounts is that as long as the money stays within the IRA, no one owes any taxes on it. Once you make withdrawals, though, that's when the IRS can come to collect its fair share -- if it's the right kind of IRA.

Specifically, the same rules governing taxes on IRAs that apply to the original owner also apply to heirs. For a traditional IRA, the heir will have to count withdrawals as taxable income in the year in which the money comes out of the account. For a Roth IRA, on the other hand, withdrawals are tax-free, whether it's the original owner or the heir after the owner's death taking the money out of the account.

When do you have to pay?
For inherited IRAs, the biggest question is how quickly you have to take money out -- and therefore end up potentially paying tax on the withdrawals. The answer depends in part on whether you're the spouse of the deceased person or not.

Spouses have the special right to roll over an inherited IRA into an IRA in their own name. If they do so, then any minimum distribution rules are based on the surviving spouse's age. Alternatively, spouses can choose to follow the rules governing non-spouses if they prefer.

Those who aren't surviving spouses typically have two options. One choice involves withdrawing the entire balance of the inherited IRA within five years of the date of death. The other allows the heir to take minimum withdrawals each year based on their life expectancy as of the date of death. This second method allows heirs to stretch out distributions throughout their own lifetimes, which is why this form of inheritance is sometimes called a stretch IRA.

As you can see, figuring out exactly how much in tax you'll pay on an IRA inheritance is more complicated than simply running numbers through a calculator. Although heirs can choose to withdraw all the inherited IRA money immediately after the death of the person who left the IRA to them, using other strategies for IRA withdrawals can reduce your tax bill and defer your having to pay the IRS for years into the future.

If you have other questions about IRAs, head on over to our IRA Center. Even if you're just getting started, we can help point you in the right direction.

This article is part of The Motley Fool's Knowledge Center, which was created based on the collected wisdom of a fantastic community of investors. We'd love to hear your questions, thoughts, and opinions on the Knowledge Center in general or this page in particular. Your input will help us help the world invest, better! Email us at Thanks -- and Fool on!