Most investors are familiar with diversification, or spreading your eggs among a variety of stock, bond and cash baskets to reduce risk. But there’s another kind: “tax diversification.”

That refers to keeping assets in a variety of accounts that are treated differently at tax time. It’s especially valuable to retirees, who are more likely to take money out of their accounts than to put it in.

Tax diversification allows you to keep tax bills to a minimum by switching your withdrawals from one account to another as your situation changes from year to year. In years when you are in a high tax bracket, you can withdraw from accounts with the smallest tax consequences, for instance.

There are three basic types of accounts.

Taxable. These are especially useful for investments such as stocks or stock funds that provide most of their returns through capital gains, or profits when a holding is sold for more than was paid. Investments owned for longer than a year are taxed at the long-term capital gains rate no higher than 15%, while those owned for a shorter period are taxed as short-term capital gains rates as high as 35%, the same as income-tax rates.

Tax-deferred. This includes traditional IRAs, 401(k)s and similar plans. No income or capital gains tax is paid until money is withdrawn, even if you sell one holding to buy another. But withdrawals are taxed at rates as high as 35%.

Tax-exempt. There is no tax of any kind on withdrawals from Roth IRAs, or from Section 529 plans used for college savings.

Retirees are often told to tap taxable accounts first, then tax-deferred and finally tax-exempt, allowing holdings with the best tax advantages to grow as long as possible. But the rule is not ironclad.

For one thing, the investor may need to withdraw more than usual in some years — for a new roof, medical expenses, travel, a down payment on a winter home or to help with a grandchild’s college expenses.

A big withdrawal from an IRA or 401(k) could lift you into a higher income-tax bracket, since those withdrawals count as income. So, for that year, it might pay to tap the tax-free Roth. Or you could sell a taxable holding subject to the 15% long-term capital gains rate.

In fact, you could select a taxable holding that had produced little or no profit, so there would be little or no capital gains tax. If you sold an identical holding out of a 401(k), you’d pay income tax on the entire sum.

In other years, you might need to withdraw less than usual. Your expenses might be down, or you might have cash left over from the year before. If this puts you into a lower-than-usual tax bracket, it might be a good year to take money from a 401(k) or traditional IRA. In effect, you could elect to pay tax at the current low level to avoid tax at a higher rate later. You would reserve your low-tax and tax-free withdrawals for years in which there was a danger of being in a higher bracket.

Other issues should be weighed as well. A Roth IRA is kinder to heirs than a 401(k) or traditional IRA, for example, so you might want to leave that account alone if you expect to leave assets behind.

Of course, no one knows what the tax rates on different assets and accounts will be 10, 20 or 30 years from now. But that’s all the more reason to keep your options open by spreading your money among various types of accounts.

—For the best rates on loans, bank accounts and credit cards, enter your ZIP code at