Skip to main content

HomeAll guides

How Capital Gains Tax Works When You Sell an Investment

Capital gains tax is the tax you owe when you sell an investment for more than you paid for it

When you buy a stock, bond, real estate, or other investment and later sell it for a profit, that profit is called a capital gain. The IRS taxes that gain as income. The amount you owe depends on how long you held the investment before selling it, your total income that year, and your filing status. You do not owe capital gains tax on investments you still own — only on the ones you sell.

The tax applies whether you sell through a brokerage account, real estate transaction, or any other way. Your broker or title company will report the sale to the IRS on a form called a 1099, and you report it on your tax return. If you do not report it and the IRS finds out, you can face penalties and interest on top of the tax owed.

Key Takeaways

  • Capital gains tax applies only to profits from selling investments, not to the investments themselves or to gains you have not yet sold.
  • Long-term capital gains (held over one year) are taxed at lower rates than short-term gains, which are taxed as ordinary income.
  • Your tax rate depends on your income bracket and filing status, and rates range from 0% to 20% for long-term gains.
  • You report capital gains on Schedule D of your tax return, and your broker sends you a 1099-B form showing what you sold.

The difference between long-term and short-term capital gains

How long you own an investment before selling it determines which tax rate applies. If you sell within one year of buying, the gain is short-term and taxed as ordinary income — at the same rate as your wages or salary. If you hold it for more than one year, the gain is long-term and taxed at a lower rate.

Short-term gains can be taxed at rates up to 37%, depending on your income bracket. Long-term gains are taxed at 0%, 15%, or 20%, depending on your income and filing status. For most people, long-term rates are significantly lower. This is why many investors hold investments longer than a year — the tax savings can be substantial.

The holding period starts the day after you buy and ends the day you sell. If you buy on January 15 and sell on January 16 of the next year, that counts as long-term. If you sell on January 15 of the next year, it is still short-term.

How the IRS calculates your capital gains tax

To find your capital gain, subtract what you paid for the investment (your cost basis) from what you sold it for. If you paid $5,000 for a stock and sold it for $7,000, your capital gain is $2,000. If you paid $7,000 and sold for $5,000, you have a capital loss of $2,000, which can reduce your taxes.

Your cost basis includes the price you paid plus any fees or commissions. If you reinvested dividends, those count toward your basis too. Keep records of what you paid, when you bought it, and when you sold it. Your broker keeps these records, but having your own copies makes tax time easier.

Once you know your gain or loss, you report it on Schedule D of your tax return. If you have multiple investments, you add up all your long-term gains and losses separately from your short-term ones. The IRS then applies the appropriate tax rate to each group.

Capital gains tax rates for 2024

Long-term capital gains rates depend on your taxable income and filing status. The rates are 0%, 15%, or 20%. A single filer with taxable income up to $47,025 may pay 0% on long-term gains. Income from $47,026 to $518,900 is taxed at 15%. Income above $518,900 is taxed at 20%. These income thresholds change each year.

Married couples filing jointly have higher thresholds. Married filing separately and head of household have different thresholds again. Your taxable income includes wages, interest, dividends, and capital gains all added together, so a large capital gain can push you into a higher tax bracket.

Short-term gains have no special rate — they are taxed as ordinary income at your regular tax bracket, which ranges from 10% to 37% depending on your total income.

Using capital losses to reduce your tax bill

If you sell an investment at a loss, you can use that loss to offset capital gains. If you have $10,000 in long-term gains and $3,000 in long-term losses, you report a net gain of $7,000 and pay tax only on that amount. You can also use losses to offset gains from the other category — a short-term loss can reduce long-term gains and vice versa.

If your losses exceed your gains in a year, you can deduct up to $3,000 of the excess loss against your ordinary income (wages, salary, interest, and so on). Any losses beyond $3,000 carry forward to future years, so you can use them later when you have gains again or when you have more income to offset.

This strategy, called tax-loss harvesting, is common among investors who want to reduce their tax burden. You sell a losing investment to lock in the loss, then may buy a similar investment to maintain your portfolio balance.

Real estate and capital gains tax

When you sell a home or rental property, capital gains tax applies the same way it does for stocks. Your gain is the sale price minus your cost basis (what you paid plus improvements like a new roof or addition). However, if the home is your primary residence, you may be able to exclude up to $250,000 of the gain from tax if you are single, or $500,000 if you are married filing jointly — but only if you owned and lived in the home for at least two of the last five years.

Rental properties do not get this exclusion. If you sell a rental property at a profit, you owe capital gains tax on the full gain. You also owe tax on any depreciation you claimed in prior years, though at a higher rate (25%) than regular long-term gains.

Keep records of what you paid for the property, the date you bought it, and the date you sold it. If you made improvements, keep receipts for those too — they increase your cost basis and reduce your taxable gain.

What happens if you do not report capital gains

Your broker sends the IRS a 1099-B form showing what you sold and for how much. The IRS matches this to your tax return. If you do not report the sale, the IRS will notice the mismatch and may send you a notice asking for the missing information and the tax owed.

If you owe tax and do not pay it, the IRS charges interest on the unpaid amount plus penalties. The longer you wait, the more you owe. It is always better to report the gain, even if you cannot pay the full amount right away — you can set up a payment plan with the IRS.

Frequently Asked Questions

Do I owe capital gains tax on investments I have not sold yet?

No. Capital gains tax applies only when you sell. If you own a stock that has doubled in value but you have not sold it, you owe no tax on that gain. You will owe tax only when you sell it. This is why some people hold investments for decades without paying tax on the gains.

Can I avoid capital gains tax by gifting an investment to someone else?

You do not owe capital gains tax on the gift itself, but the person who receives it inherits your cost basis. If they later sell it, they will owe tax on the gain from your original purchase price, not from the date they received it. There is one exception: if someone inherits an investment after you die, they get a "step-up" in basis to the value on the date of death, which can eliminate the tax.

What if I have more capital losses than gains in a year?

You can deduct up to $3,000 of net losses against your ordinary income in that year. Any losses beyond $3,000 roll forward to future years. You can use them to offset gains in later years or to deduct more ordinary income, up to $3,000 per year, until the losses are used up.

Are dividends taxed the same way as capital gains?

No. Dividends are taxed differently. may have access to dividends (from most U.S. stocks held over 60 days) are taxed at the same rates as long-term capital gains. Ordinary dividends are taxed as regular income. Capital gains are profits from selling an investment; dividends are payments the company makes to shareholders while you still own the stock.

Do I need to report capital gains if I sold at a loss?

Yes. You report losses on Schedule D so you can use them to offset gains or reduce your ordinary income. Even if you have no gains to offset, reporting the loss lets you claim the deduction and carry forward any unused losses to future years.

This guide is for general information only and is not medical, financial, legal, or other professional advice. For decisions specific to your situation, consult a qualified professional. See our Editorial Policy.