Photo: Flickr user Global X.

You've probably heard of capital gains, and you may know that our friends at the IRS collect taxes on them. But maybe you don't know exactly what capital gains are or how the taxation of them works. If that sounds about right, read on.

First off, know that most of the things you own are capital assets. These include not only investments, but also homes, cars, books, and that pair of vintage clown shoes in the back of your closet. (For businesses, capital assets are generally things such as land or factories or equipment -- items typically held for more than a year that are used to generate profits and are difficult to liquidate into cash.)

If you own a capital asset and then sell it, you will probably realize a gain or loss. These gains and losses are of great interest to the IRS, which expects you to report them.

Capital gains tax rates
When it comes to taxing your capital gains, the length of time you held the asset makes a difference. Gains on assets held for a year or less are taxed at your ordinary income-tax rate -- which can approach 40% for the highest earners. Assets held for longer than a year enjoy long-term capital gains tax rates, which are usually lower than income-tax rates for most people. For those in the 10% or 15% tax brackets, the tax rate is often 0%. For most folks in higher tax brackets, it's 15%. And for some high earners, it's 20%.

Capital losses are treated differently. In general, you get to offset your capital gains with your capital losses. For example, if your gains total $12,000 and your losses total $7,000, you're only taxed on the $5,000 difference. What happens if your losses exceed your gains? Well, then you get to offset some of your income tax with that loss by deducting the excess loss from your taxable income. You can deduct up to $3,000 in losses from your taxable income per year. If you still have losses left, you can generally carry them over into following years.

As another example, imagine you have $10,000 in losses and $5,000 in gains. You can wipe out your gains with $5,000 of your losses, so you owe nothing on the gains. With your remaining $5,000 loss, you can subtract $3,000 from your taxable income. You'll be left with $2,000 in losses that you can apply in the following year. As the IRS explains, "You may use the Capital Loss Carryover Worksheet found in either Publication 550, Investment Income and Expenses, or the Form 1040, Schedule D Instructions (PDF), Capital Gains and Losses, to figure the amount eligible to be carried forward."

Image: Flickr user DonkeyHotey.

Extra wrinkles and details
Of course, when it comes to taxes, few things are simple and clear-cut. For some kinds of capital assets, there are steeper maximum rates. As my colleague Dan Caplinger has explained:

If you've depreciated certain types of property, then you have to recapture some of that depreciation when you sell, and the resulting gains get taxed at 25%. Meanwhile, for sales of collectibles and small-business stock, a maximum of 28% applies. For investors, the key to remember is that precious-metals bullion investments like gold and silver coins are treated as collectibles, as are the popular exchange-traded vehicles SPDR Gold Shares and iShares Silver. Bear in mind, though, that you'll never pay more than your ordinary tax rate.

Meanwhile, the IRS only lets you reduce your taxes with capital losses if they're related to investments. (Remember, when it comes to gains, it levies taxes on capital assets whether or not they're investments.) As my colleague Matthew Frankel explained perfectly: "So when you buy a couch for $1,000 and sell it for $300 years later, you can't write off the difference, but if you sell it for more than $1,000, you'll get taxed on the profit." It may seem even more unfair if you suffer a $100,000 loss when you sell your primary home and don't get to deduct that loss. Your primary home is considered an asset for your personal use, not an asset held for investment purposes.

Spend a little time learning about taxes, and you can save money. One strategy, for example, is to sell some underwater stocks before you might otherwise want to just to generate a capital loss with which to offset some gains. (If you plan to buy that stock back, know that you need to wait for at least 31 days, lest you run afoul of the "wash sale" rules. Also, if you're thinking of selling a stock you've held for 11 months for a gain, you might consider holding off until it qualifies for a lower, long-term capital gains tax rate.

That said, tax considerations alone should not drive your investment decisions. If your investment thesis and your gut tell you it's time to sell now, then let them be your guide.