This is a post from staff writer Robert Brokamp of The Motley Fool. Robert is a Certified Financial Planner and the adviser for The Motley Fool’s Rule Your Retirement service.

Let’s say you’ve decided to add a new investment or two to your portfolio — maybe a stock, maybe a bond, maybe a mutual fund that invests in either or both.

But now you’re confronted with another decision: In which account should you buy them? You might have a regular, taxable brokerage account as well as traditional and Roth retirement accounts. Each account has its own tax treatment; the same is true of types of investments. Some are very tax-inefficient, requiring investors to hand over a good bit of the return over to Uncle Sam and Sister State — unless put inside a tax-advantaged retirement account. Other investments have built-in tax advantages, and putting them in an IRA or 401(k) isn’t as important.

The trick to smart asset location — the art of putting the different types of investments in the right accounts in order to increase after-tax wealth — starts with ordering your investments according to tax-inefficiency. Then, you consider the expected returns of the investments. Intelligently mixing both of those factors will help you decide which investments should go into your tax-advantaged accounts first.

Boring tax basics

First, some essential facts necessary to understand asset location.

For assets in a regular taxable account, interest and short-term capital gains (profits from investments that are sold within a year of buying them) are taxed as ordinary income, the same rate as a paycheck is taxed. That can be as high as 39.6 percent, though you have to be very wealthy to pay that much. I would guess that most folks who are reading this post are in the 15-25 percent tax brackets.

Long-term capital gains and qualified dividends (according to current law) are taxed at lower rates — as high as 20 percent, with an additional possible 3.8 percent thrown on top of that due to the new Medicare tax. Again, you have to be raking in the dough — to the tune of more than $400,000 in adjusted gross income — to pay a rate that high. Most taxpayers pay rates between 0 percent (yes, zilch) to 15 percent.

As for assets in tax-advantaged retirement accounts, the investments in a traditional account grow tax-deferred until the money is withdrawn; withdrawals are taxed as ordinary income. Distributions from a Roth account are tax-free as long as you follow the rules.

The hierarchy of tax-ification

One of the key strategies to increasing after-tax wealth is filling up your IRAs and 401(k) with the most tax-inefficient investments first, and using money outside those account for investments that aren’t heavily taxed or taxed at all.

Here’s a very oh-so-general order of investments, according to how much the return you earn is given back on the tax returns you file, if not kept in a 401(k) or IRA. The order will be different for each person, depending on the specific investments owned and how long until they’re sold. But this serves as a good starting point.

1. Stocks sold within a year. The gains are taxed as ordinary income.

2. Stocks that pay non-qualified dividends. Most of the payouts from real estate investment trusts (REITs) and some foreign companies do not qualify for a lower dividend rate, so they’re taxed as ordinary income.

3. Stocks that pay qualified dividends. The dividends will be taxed at a lower rate than ordinary income, but you’re still losing a portion of the return to taxes.

4. Options and shorts. The tax implications of options and shorts are much too complicated to address here. But it starts with the fact that many options strategies are not permitted in an IRA, and shorting is not allowed.

5. Non-dividend-paying stocks held for many years. These have built-in tax-deferral since you won’t pay taxes until you sell and then at lower long-term capital gains rates. The longer you hold, the bigger the benefit.

6. Corporate bonds. A mere few years ago, it was considered smart to put most bonds higher up on the list of tax-inefficiency, even ahead of most stocks. However, given today’s low rates, there’s not as much interest to tax. Also, many bonds these days are selling at a premium (i.e., higher than their issue price and the amount that the investor will get when the bond comes due) because as interest rates have fallen, the prices of existing bonds have gone up. For example, a bond that matures in a few years at $1,000 might be selling for $1,100 today. When it comes to that $100 difference, the investor might be able to use it to offset taxable interest or capital gains. It’s actually a bit complicated, but the main point is that you’ll lose those tax breaks if the bonds are kept in a tax-advantaged retirement account. All that said, it still might make sense to keep high-yield (a.k.a., “junk”) bonds in a tax-advantaged account.

7. Treasury Inflation-Protected Securities (TIPS). The interest rates on TIPS is very low. However, the inflation adjustments to the principal are taxed every year as “phantom income,” even though you don’t realize the gain of that adjustment until you sell or the TIPS mature.

8. Treasuries. The interest is taxable as ordinary income on the federal level, but exempt from state taxes.

9. Municipal bonds. Interest is exempt from federal income taxes and maybe state and local taxes, depending on the bond.

Where do mutual funds and ETFs fall on this list? The investments within a fund are taxed the same as if they were outside the fund, but with an extra layer of complexity because the shareholders are held responsible for the taxable activities of the fund manager. For example, you may hold onto a fund for 20 years, which would qualify any gain for long-term treatment. But if along the way the fund manager is frequently trading the investments within the fund, those short- and long-term gains get passed onto you.

The more tax-inefficient the fund, the more it should be kept in an IRA. Generally, actively traded funds are a bigger tax headache than index funds. But you can learn about a fund’s taxable habits at Morningstar.com entering its ticker and then clicking on “Tax.”

The role of expected return and holding period

The other consideration when it comes to asset location is how much you think an investment will be worth in the future. All else being equal, you want the investments that you think will be worth the most in the accounts with the lowest tax implications. That begins with the Roth, since those withdrawals will come out tax-free — and it’s always better to have a bigger tax-free account. Of course, knowing ahead of time which investments will have the highest growth can be tricky. But it’s a consideration.

Also, it should go without saying, but just in case: Money in retirement accounts is for retirement. Money you need beforehand should not be put in an IRA or 401(k), since withdrawals before age 59 ½ may be subject to taxes and a 10 percent penalty.

It’s not what you make, it’s what you keep

I’ve covered asset location, but decades-low interest rates and the increased popularity of more complex strategies such as options and shorting warrant a re-visiting of the topic. In some cases, the choice of which account to put which investments is clear; in others, the decision will not make much of a difference.

But in some ways, you’re not the only owner of your investments. Uncle Sam stands to benefit from the growth of your portfolio, too, depending on what you own and where you own it. Everyone should pay their fair share of the “price of civilization” (Oliver Wendell Holmes Jr. called taxes), but there’s nothing wrong with legally reducing as much as possible the stake of your co-owner.

This article is about Advanced, Investing, Retirement