When you sell an asset above its purchase price, you pay a tax on your gains. That's called a capital gains tax. Now, to help pay for Obamacare, higher-income earners have to pay an additional tax on income from investments, known as the net investment income tax. Read on to learn more about the capital gains tax, how big of a bite it takes out of your investments, the net investment income tax, and whether you will you be affected.

Capital gains tax
The capital gains tax is charged only on non-inventory assets, so any assets held for sale as part of the normal operation of a business aren't counted. So while you might consider a piece of jewelry an asset, a jeweler such as Zale would count the same piece as inventory and not owe capital gains on it when the item sold. For most people, non-inventory assets are stocks, bonds, property, and other similar investments.

Capital gains are taxed at two rates, depending on how long the asset was held. Short-term capital gains, which are gains on property held for less than one year, are taxed as normal income. Long-term capital gains are taxed based on the individual's tax bracket. Here are the long-term capital gains rates for 2013 and 2014.

Tax Bracket

Long-Term Capital Gains Tax Rate

10%-15%

0%

25%-35%

15%

39.6%

20%

Collectibles, precious metals, and depreciated assets get taxed at higher rates of 25%-28%, depending on the type of asset. Read more here.

When you sell an asset for less than you paid, you end up with a capital loss instead of a capital gain. You can offset your capital gains with capital losses all the way to zero, and you can also write off up to a total of $3,000 of capital losses each year against other earned income. Any remaining unused capital losses can be carried forward into future tax years.

Net investment income tax
Also known as the Medicare Surcharge Tax, the net investment income tax is a 3.8% tax on capital gains, as well as dividends and distributions from investments. Individuals earning over $200,000 could owe this tax. It applies to the lesser of your modified gross income above the threshold amount or your net investment income, but it doesn't include gains on the sale of a primary residence.

Source: IRS.

Say you're a single taxpayer with $50,000 in salary and $200,000 in capital gains. Your modified adjusted gross income is $250,000. So your net investment income is $200,000, but your modified adjusted gross income exceeds the threshold by $50,000, so the tax applies to the $50,000 -- the lesser of the two. You would owe the IRS an extra $1,900 ($50,000 times 3.8%).

Bottom line
Capital gains taxes and the net investment income tax both cut into your gains on profitable investments. If possible, investors should take advantage of the various types of retirement savings accounts that allow your investments to grow tax-free, such as IRAs and 401k(s).