Skip to main content

HomeAll guides

How Federal Capital Gains Tax Works When You Sell an Investment

Federal capital gains tax is the tax the U.S. government charges on the profit you make when you sell an investment for more than you paid for it

When you sell a stock, bond, real estate, or other asset at a profit, that profit is called a capital gain. The federal government taxes this gain as income. The amount you owe depends on how long you held the asset, your total income for the year, and your tax filing status. The IRS treats gains you hold for less than a year differently from gains you hold for longer, and the tax rates differ based on your income bracket.

Capital gains tax is separate from income tax on wages or salary, though both are calculated on your annual tax return. You do not pay this tax when you buy an investment — only when you sell it at a profit. If you sell an investment for less than you paid, that loss can reduce your taxable gains.

Key Takeaways

  • Short-term capital gains (assets held one year or less) are taxed as ordinary income at rates ranging from 10% to 37%, depending on your income bracket.
  • Long-term capital gains (assets held more than one year) are taxed at lower rates: 0%, 15%, or 20%, depending on your income and filing status.
  • The tax is calculated on the difference between what you paid for the asset and what you sold it for, not the total sale price.
  • Capital losses can offset capital gains dollar-for-dollar, and excess losses can reduce other income by up to $3,000 per year.

Short-term vs. long-term capital gains rates

The holding period determines which tax rate applies. If you own an asset for one year or less before selling it, any profit is a short-term capital gain. Short-term gains are taxed at your ordinary income tax rate, which ranges from 10% to 37% depending on your income bracket and filing status.

If you own an asset for more than one year before selling it, any profit is a long-term capital gain. Long-term gains receive preferential tax treatment and are taxed at lower rates: 0%, 15%, or 20%. Which rate you pay depends on your taxable income and filing status. For example, in 2024, a single filer with taxable income up to $47,025 pays 0% on long-term gains; income from $47,026 to $518,900 is taxed at 15%; and income above that is taxed at 20%.

These income thresholds change each year with inflation. The IRS publishes updated brackets annually, and your tax software or tax preparer will use the correct year's rates when you file.

How the IRS calculates your capital gain

Your capital gain is the sale price minus your cost basis — the original price you paid plus any fees or commissions. If you bought 100 shares of stock for $50 per share ($5,000 total) and sold them for $75 per share ($7,500 total), your capital gain is $2,500, not $7,500.

Cost basis can be more complex if you inherited an asset, received it as a gift, or bought it over time. Inherited assets receive a "step-up" in basis, meaning the cost basis becomes the asset's value on the date of death, not what the original owner paid. Gifts retain the original cost basis. If you bought shares at different prices over time, you can choose which shares to sell — a method called "specific identification" — to control how much gain you report.

Your brokerage or investment platform usually tracks cost basis and reports it to the IRS on Form 1099-B. You should keep records of your original purchase price, date of purchase, and sale date to verify the calculation.

Capital losses and how they reduce your tax bill

If you sell an investment for less than you paid, you have a capital loss. Capital losses offset capital gains dollar-for-dollar. If you have $10,000 in long-term gains and $3,000 in long-term losses, you report a net gain of $7,000.

If your losses exceed your gains in a year, you can use the excess loss to reduce other income — such as wages or interest — by up to $3,000 per year. Any remaining loss carries forward to future years, where you can use it again. This means a large loss in one year does not disappear; you can spread its benefit across multiple years.

Losses must be matched by type: long-term losses offset long-term gains first, and short-term losses offset short-term gains first. Only after one category is exhausted do losses from one type offset gains from the other.

Who pays federal capital gains tax and when

Anyone who sells an investment at a profit owes federal capital gains tax, regardless of age or income level. You report the gain on your tax return for the year in which you sold the asset. The tax is due when you file your return, typically by April 15 of the following year.

If you expect a large capital gain, you may need to make estimated tax payments throughout the year to avoid penalties. Your tax preparer or software can calculate whether you owe estimated taxes based on your projected income and gains.

Some people are exempt from paying capital gains tax on specific types of assets. For example, you can exclude up to $250,000 in gains (or $500,000 if married filing jointly) on the sale of a primary residence if you meet certain conditions. Certain charitable donations of appreciated assets also have tax benefits. These exceptions are narrow and have specific requirements.

State and local capital gains taxes

Federal capital gains tax is separate from state and local taxes. Most states tax capital gains as ordinary income, meaning your state tax rate applies to the gain. A few states — including Alaska, Florida, Nevada, South Dakota, Tennessee, Texas, Washington, and Wyoming — do not tax capital gains at all. Others, like California and New York, tax them at high rates.

Some states and cities have introduced capital gains taxes in recent years. Washington State, for example, imposes a 7% tax on long-term capital gains above $250,000. These state and local taxes are in addition to federal tax and vary widely by location. You should check your state's rules when calculating your total tax liability.

How to report capital gains on your tax return

You report capital gains on Schedule D (Form 1040), which you attach to your federal tax return. Your brokerage sends you Form 1099-B, which lists all sales you made during the year, including the sale price and (usually) the cost basis. You use this form to complete Schedule D.

Schedule D separates short-term and long-term gains and losses. You calculate net short-term gains or losses and net long-term gains or losses, then combine them. The result goes on your Form 1040 and is included in your taxable income for the year.

If you have a large number of transactions, you may need to attach additional statements. Tax software typically walks you through this process and generates the correct forms based on your 1099-B data. If you use a tax preparer, bring your 1099-B forms and any records of transactions your brokerage did not report.

Frequently Asked Questions

Do I owe capital gains tax if I sell an investment at a loss?

No. You only owe tax on gains, not losses. However, you should still report the loss on your tax return because it can offset gains from other investments and reduce your taxable income by up to $3,000 per year.

What if I hold an investment for exactly one year — is it short-term or long-term?

It is short-term. Long-term status requires holding the asset for more than one year. If you bought on January 15, 2023, and sold on January 15, 2024, it is still short-term. You must sell on January 16, 2024, or later for it to may have access to as long-term.

Can I avoid capital gains tax by not selling?

Yes. Capital gains tax is only triggered when you sell. If you hold an investment indefinitely, you owe no federal capital gains tax on the unrealized gain. However, if you pass the investment to heirs, they receive a step-up in basis and can sell without owing tax on the gain that occurred during your lifetime.

Are dividends from stocks taxed the same way as capital gains?

may have access to dividends are taxed at the same rates as long-term capital gains (0%, 15%, or 20%), but they are reported separately on your tax return. Non-may have access to dividends are taxed as ordinary income. Your brokerage will specify which type you received on your 1099-DIV form.

What happens if I do not report a capital gain?

The IRS receives a copy of your 1099-B from your brokerage and matches it to your tax return. Unreported gains can trigger an audit, penalties, and interest charges. It is important to report all gains, even small ones, on your annual return.

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.