This article pertains specifically to investors who have both a tax-advantaged account (IRA/401k) and a taxable investment account. If you don’t have a taxable investing account, don’t make the mistake of thinking we’re suggesting you invest money into a taxable account instead of your tax-advantaged IRA or 401k. Unless you’re close to retirement age and using a strictly buy-and-hold (no turnover) strategy, you’re almost always better off filling your tax-advantaged accounts before using a taxable one.

You’ve saved the maximum allowed in your 401(k). You’ve dutifully contributed to an IRA each year. You’ve even saved extra beyond these plans in a regular taxable brokerage account. Your stock/bond allocation is perfect for your age and risk tolerance. You have faithfully followed SMI’s strategy recommendations as soon as they’re published. You’ve covered all the possible bases, right? Perhaps. But one crucial question remains—are your stocks and bonds held in the right accounts? Make a mistake here and you could pay thousands, even tens of thousands, of dollars more than necessary in income taxes.

Two types of tax: capital gains vs. ordinary income

Under current tax law, when you sell an investment that you’ve owned longer than one year, any gain is taxed at a maximum rate of 20%. When you sell an investment held less than one year, you pay tax at your regular income-tax rate, which can be as high as 39.6%. But retirement accounts such as IRAs or 401(k)s don’t follow these normal “short-term versus long-term” rules. Instead, withdrawals from (non-Roth) retirement accounts are always taxed as ordinary income at your highest regular tax rate, regardless of how long the investments within the accounts have been held.

This creates the following possibility for investors in high-income tax brackets: If you buy Fund A at age 64 in a taxable account and sell it two years later for a $4,000 gain, you’ll pay a capital-gains tax of up to $800 (20%). However, do the same thing in your 401(k) or IRA, and when you take the money out of the account, you could face income taxes of up to $1,584 (39.6%) on the same transaction. That’s a big difference, and a surprise to people who assume saving through their retirement account is always going to reduce their taxes. The key to maximizing your retirement accounts is understanding how any gains in them will be taxed and using them to shelter the right types of investments.

For SMI Just-the-Basics investors

Your investing strategy should largely dictate which assets are held in your taxable vs. retirement accounts. The conventional wisdom says that—insofar as is possible—putting bonds in a retirement account and stocks in your taxable account is the tax-smart thing to do. Since interest income from bonds is going to be taxed at your highest income tax rate regardless of where the bonds are held, there’s no disadvantage to having it converted into ordinary income by your retirement account. By contrast, long-term capital gains from your stock funds would be taxed at only 15-20% in your taxable account, so you want to avoid turning those gains into more heavily taxed ordinary income.

Another overlooked aspect of holding stocks in a taxable account is that stock gains can be largely deferred simply by continuing to hold the investment. As long as you don’t do any trading in the stock portion of your portfolio, you can effectively defer the taxes related to the increase in value of those assets (dividend income will still be taxed).

This conventional wisdom assumes you follow a strategy that normally holds stocks and stock funds for at least one year (to receive the advantageous capital gains tax rates), and ideally much longer (to postpone paying even that). In other words, this approach is tailor-made for buying and holding index funds.

If you follow SMI’s Just-the-Basics strategy, which involves investing your stock money using index funds, it would be preferable for the taxable account to hold stocks rather than bonds. So, you would allocate all of your bonds to your IRA/401k, fill any remaining space in those accounts with stock funds, then hold the rest of your stock holdings in the taxable account. Just-the-Basics holds the same stock funds indefinitely, so you wouldn’t have to sell and generate a taxable gain until retirement. Ideally, any ongoing portfolio rebalancing would occur within the tax-advantaged account, leaving the taxable holdings untouched (and thus, untaxed) until retirement.

For all other SMI strategies

But what if you utilize a strategy that regularly sells funds held less than 12 months? In that case, the conventional wisdom isn’t going to hold true for you. That’s the case for most SMI readers, including those following SMI’s Fund Upgrading, Dynamic Asset Allocation, or Sector Rotation strategies. Unlike Just-the-Basics, these strategies regularly sell stock funds held less than one year, making them tax-inefficient. In a taxable account, each of these taxable gains would be taxed at your ordinary income tax rate at the end of the year. By contrast, in a retirement account, these gains can compound without tax for many years. That’s a tremendous advantage. Granted, it does mean that you will eventually pay tax on all those gains at your regular income rates when you begin pulling money out at retirement. But the same holds true if you followed these strategies within a taxable account (at least on any positions held less than one year). For most SMI readers, then, we believe it’s better to pay tax each year on the relatively small amount of income generated by your bond portfolio (especially given today’s ultra-low interest rates) than the significantly larger gains created by your stock funds.

In a Roth IRA or Roth 401(k), where gains are completely tax-free providing you meet basic criteria, it makes even more sense to shelter your higher-growth stock funds from tax. If you earn returns even close to the stock market’s long-term averages for an extended period of time, having all your stock gains be completely tax-free upon withdrawal will be a huge benefit. (The earlier Just-the-Basics example using index funds is also reversed by Roth tax-treatment: better to put all stock funds, indexed or otherwise, in a Roth account, with bonds bumped to the taxable account.)

Tax law is constantly changing, and today’s low capital-gains tax rates have already proven an attractive target for those inclined to raise taxes on “the rich.” In 2013, the capital-gains tax rate was increased from 15% to 20% for high earners, and an “Obamacare” Medicare surtax on investment gains and income was added as well. There’s a good chance this area of the tax code will remain a political football for years to come. Despite the aggravation, it’s well worth the effort to watch and adjust to changing tax laws as they unfold. Big gains are great, but it’s what’s left after all the taxes are paid that really matters.