The primary goal of all investors is to make money on their investments. Once you're fortunate enough to earn a profit on an investment, however, you also have to do what you can to keep as much as possible out of the hands of the tax man. With some investments, you can reinvest proceeds to avoid capital gains, but for stock owned in regular taxable accounts, no such provision applies, and you'll pay capital gains taxes according to how long you held your investment.

Special tax provisions don't apply to stock
The Internal Revenue Code is full of provisions that allow people to take proceeds from sales of property and reinvest it without having to recognize capital gain. The most popular is in the real-estate industry, where so-called "1031 like-kind exchanges" make it possible for owners to swap properties without any tax consequences. Similarly, in the life insurance industry, what are known as "1035 exchanges" allow policyholders to switch from one life insurance policy or annuity policy to another without having to pay capital gains tax on the paper profits from the policy being swapped out.

No such provisions apply to sales of stock in taxable accounts. Taxpayers have to recognize all of their capital gains. If they've owned the stock for a year or less, then they'll pay short-term capital gains tax at their ordinary income tax rate on the profit. If they've held the stock for longer than a year, then the lower long-term capital gains tax rates will apply.

How to avoid capital gains tax
The fact that there's no way out of paying tax on reinvested gains is one key reason why tax-favored retirement accounts are so popular. Within an IRA, 401(k), or other tax-favored retirement account, you can make sales of stock or other investments without any immediate tax consequences at all. You can then reinvest those proceeds in new stock. Only once you make withdrawals from your retirement account will tax issues come into play.

For your taxable account, though, your best defense against capital gains taxes is to be a long-term investor. You don't have to recognize capital gains on stock until you sell, so that gives those who invest in companies they're comfortable holding for years or even decades a leg up on short-term traders, who will end up paying a much higher tax burden.

Some argue that reinvesting gains from stock sales should be tax-free. Lacking major reform, though, investors should simply take steps to minimize the number of sales that force them to recognize such gains. Click here to compare brokers and choose the one that offers the most benefits for your investing style.

This article is part of The Motley Fool's Knowledge Center, which was created based on the collected wisdom of a fantastic community of investors. We'd love to hear your questions, thoughts, and opinions on the Knowledge Center in general or this page in particular. Your input will help us help the world invest, better! Email us at [email protected]. Thanks -- and Fool on!