Many companies featured on Money advertise with us. Opinions are our own, but compensation and
in-depth research may determine where and how companies appear. Learn more about how we make money.

When you own stocks outside of tax-sheltered retirement accounts such as IRAs or 401(k)s, there are two ways to get hit with a tax bill.

If you sell a stock at a gain, you owe taxes on the difference between what you got from the sale and what you originally paid for the stock — including any purchase and selling commission costs.

Those profits are known as capital gains, and the tax is called the capital gains tax. If you fall in the 10% or 15% tax bracket, you pay 0% on any profits. Everyone else pays 15%. If you're an individual with over $400,000 or a couple with over $450,000 in taxable income, you pay 20% on the amount of income above that limit.

One exception: If you hold a stock for less than a year before you sell it, you'll have to pay your regular income tax rate on that "short-term" gain. That's higher than the capital gains tax for most people.

If you sell stocks at a loss and those losses outweigh any gains you've made, the difference can be deducted on your tax return, and used to reduce other income, like wages, up to $3,000 or $1,500 for married couples filing separately. If your losses are greater than that yearly limit, you can carry over the unused part to the next year and treat it as a loss you incurred in that next year.

If your stock pays a dividend, those dividends are generally taxed at the capital gains tax rate. Qualified dividends, such as dividends paid from domestic corporations, are taxed this way.

Non-qualified dividends, like the kind you get from employee stock options, REITs or savings accounts, are taxed at your normal income tax rate.

You could also pay an additional flat 3.8% tax rate, known as the Medicare or net investment income tax, on any investment income above $200,000 for singles or $250,000 for couples.