Many companies featured on Money advertise with us. Opinions are our own, but compensation and
in-depth research may determine where and how companies appear. Learn more about how we make money.

Jon Higgs/Gallery Stock

There's one absolutely foolproof way to become a better investor: Don't leave free money on the table. Designing your portfolio so that it takes best advantage of the tax code is a risk-free way to boost your true, after-tax return.

The basics: Use tax-advantaged accounts first

Before you make any other investments, max out your 401(k) and Individual Retirement Account options first. Deductible traditional IRAs and 401(k)s allow you to invest pre-tax dollars now and have the money accumulate tax-free until you make withdrawals in retirement. The withdrawals are then taxed as ordinary income.

With a Roth IRA, you pay the taxes up front -- that is, unlike with a traditional IRA, your contributions aren't deductible. But withdrawals in retirement are tax free.

There are limits to how much you can contribute to either kind of IRA, and some high earners might not be able to contribute to a deductible IRA or directly to a Roth. There is, however, a "back door" into a Roth for those above the income limits. You can contribute to a non-deductible IRA and then immediately convert to a Roth. (Caution: If you hold other money in traditional IRAs, there are potential tax consequences to this move.)

Roth or traditional IRA?

In general, a traditional IRA makes sense if you think you will face a lower tax rate in retirement than you do today. But of course you can't be 100% certain what tax rates will be when you retire, so some advisers say it makes sense to hedge your bets by holding some money in both kinds of tax-advantaged accounts.

Investments that hold down the tax bill

Once you've exhausted your tax-advantaged options, look for investments that minimize what you'll owe. If you are investing in stocks, an index fund is usually a good option. Because these funds tend to hang onto the stocks they buy, they are less likely than most actively managed funds to incur lots of taxable capital gains that must be distributed to shareholders.

Income-seeking investors can consider tax-exempt municipal bonds, either directly or via a fund. These bonds are generally issued by state or local governments, and the income they pay is free from federal taxes. They may also be free from state income taxes, depending on where you live and where the bond was issued.

Because the tax break is valuable, these bonds don't have to offer yields as high as comparable fixed-income investments. That means they make the most sense for high-income investors who face relatively high income-tax rates.

Currently, however, a number of factors have combined to make municipals look attractive to a broader range of investors. In particular, the rates on other types of bonds remain low, and municipal bonds appear to have been unfairly stigmatized by a few high-profile recent crises like those in Detroit and Puerto Rico; as a result, tax-exempt munis are worth a look even if you're not in a high tax bracket.

Location, location, location

Investors with significant assets spread across both tax-advantaged and taxable accounts should think carefully about which investments go where. Investments that pay out ordinary income, such as bond funds, may be best suited to tax-advantaged accounts, since that income faces higher rates than long-term capital gains or qualified stock dividends.