Source: stuartpilbrow

When investing for the long-term, it is generally a good idea to max out your contributions to your tax-deferred accounts, such as IRAs, before putting money into standard brokerage accounts. However, with IRA contributions capped at $5,500 per year, many investors will have no choice but to put some of their investing dollars in taxable investment accounts. 

This shouldn't matter too much to you, as long as you optimize the allocation of your holdings as to take full advantage of the tax-deferred accounts' power to compound your money. Here is a quick guide to why it is so important to place your stocks in the correct type of accounts. There are three main types of stocks to consider: high-yield stocks (which I'll define as 6% annual yield or better), growth stocks that don't pay dividends, and low-yielding stocks (most blue chip companies fall into this category).

High-yielders will get killed by taxes, if you let them
Let's consider what the difference is for high-yielding stocks such as American Capital Agency (AGNC -0.83%) between holding them in an IRA account versus a taxable brokerage account. American Capital Agency is one of the largest mREITs, and currently yields almost 12%.

For the sake of this comparison, let's look at a hypothetical $10,000 investment held over a period of 30 years just accounting for the dividends and no stock price growth. We'll assume that all dividends are reinvested (you should be doing this anyway!) and that no withdrawals or additional share purchases take place during the 30 years. These calculations also assume that the dividends meet the IRS's definition of "qualified" and are taxed at a 15% rate.

So, the "little" 15% tax on qualified dividends could cost you over $115,000 in potential gains over a 30-year period. If possible, all of your high-yielding stocks should be allowed to grow tax-free.

Growth stocks
These are the stocks that are OK for taxable accounts, assuming you plan to hold them for the long haul and that the particular company does not pay a dividend. While it is always better for any investment to be held in a tax-advantaged account, these are the ones to pay tax on, if you have to choose.  

Let's say you purchased 1000 shares of Google (GOOGL -2.76%) at its IPO for $85,000. Your investment would be worth $1,177,440 as of this writing. If this were held in a Roth IRA, the entire amount would be yours to keep, withdraw, and use (provided that you are over 59 years old). 

In a taxable account, if you chose to sell your investment, it would be taxed at the 15% long-term capital gains rate, making your tax $163,866. This leaves you with just over $1 million. While it is not ideal, making 15% less money on an investment is much better than losing nearly 40% of your potential gains, as is the case with a high-yielder compounded over time.

This is a broad category that includes every stock that pays a dividend that is less than 6%. These are in the middle, and should be allocated as favorably as possible provided the high-yielders have already been placed in a tax-free account. The tax impact on this type of stock over time will be greater than non-dividend growth stocks, but far less than high-yielders whose primary means of appreciation is to compound dividends over time.

Make the right choice
As you can see, it is very important to maximize your contributions to tax-advantaged accounts in order to owe as little as possible on your successful investments. However, if it's not totally possible to put all of your investments in accounts like these, prioritizing in the order presented here (high-yielders first, then low-yielders, then growth stocks) can have a massive impact on the overall performance of your accounts over time.