Capital gains tax is a tax on profit you make when you sell an investment or asset

When you buy a stock, bond, real estate, or other asset and sell it for more than you paid, that profit is called a capital gain. The IRS taxes that profit. How much you owe depends on three things: how much profit you made, how long you held the asset, and your income level that year.

You do not owe capital gains tax on assets you still own — only on sales where you actually received money. You also do not owe it on assets you inherited (the cost basis resets on the date of death). But if you sell inherited property later, you will owe tax on any gain after that date.

Capital gains tax is separate from income tax. You can owe both in the same year if you have wages and also sold investments.

Key Takeaways

  • Long-term capital gains (assets held over one year) are taxed at 0%, 15%, or 20% depending on your total income that year, which is usually lower than your regular income tax rate.
  • Short-term capital gains (assets held one year or less) are taxed as ordinary income at your regular tax bracket rate, which can be 10% to 37%.
  • You report capital gains on Schedule D (Form 1040) when you file your tax return, and the IRS matches it to your brokerage records.
  • Losses from investments can reduce or eliminate capital gains tax that year, and unused losses can carry forward to future years.
  • State income tax on capital gains varies widely — some states do not tax them at all, while others tax them the same as wages.

Long-term vs. short-term capital gains rates

The IRS divides capital gains into two categories based on how long you owned the asset. Long-term capital gains explore when you held the asset for more than one year before selling. Short-term capital gains explore when you held it one year or less.

Long-term gains receive preferential tax rates. For 2024, the federal rates are 0%, 15%, or 20% depending on your taxable income. The exact threshold varies by filing status — for example, a single filer pays 0% on long-term gains up to $47,025 of taxable income, then 15% from $47,026 to $518,900, then 20% above that. These thresholds change each year.

Short-term gains are taxed as ordinary income using your regular tax bracket. If you are in the 24% tax bracket for wages, short-term gains are also taxed at 24%. This is why holding an investment just over one year can save you significant money.

Example: You buy a stock for $5,000 and sell it for $7,000 after eight months. The $2,000 gain is short-term and taxed at your ordinary rate. If you wait four more months and sell at $7,000, the same $2,000 gain is long-term and taxed at 0%, 15%, or 20% depending on your income.

How the IRS calculates your capital gains tax

The IRS does not send you a bill for capital gains tax. Instead, you report the gains yourself on your tax return, and the tax is calculated as part of your overall income tax.

You report each sale on Schedule D (Form 1040), which asks for the date you bought the asset, the date you sold it, your cost basis (what you paid), the sale price, and the gain or loss. If you sold only a few items, you list them individually. If you sold many, you can attach a summary.

Your brokerage firm sends you a Form 1099-B each January listing all sales from the previous year. The IRS receives a copy of this form, so they know what you sold and for how much. You must report the same numbers on your tax return, or the IRS will flag the mismatch.

After you report all gains and losses, you calculate your net capital gain (or loss) for the year. If you have a net gain, it is added to your other income and taxed. If you have a net loss, you can deduct up to $3,000 against wages and other income that year, and carry any remaining loss forward to future years.

Using investment losses to reduce your tax bill

If you sold an investment at a loss, you can use that loss to offset capital gains from other sales. This is called tax-loss harvesting when done intentionally.

Example: You sold Stock A for a $5,000 gain and Stock B for a $2,000 loss. Your net capital gain is $3,000, and you owe tax on $3,000 instead of $5,000.

If your losses exceed your gains in a year, you can deduct up to $3,000 of the excess loss against your wages, interest, and other ordinary income. Any loss beyond $3,000 carries forward to the next year, where you can use it again. This carryforward has no expiration — you can use it in future years until it is exhausted.

One rule to watch: the wash-sale rule. If you sell a stock at a loss and buy the same stock (or a substantially identical one) within 30 days before or after the sale, the IRS disallows the loss. You can buy a different stock in the same sector, but not the same one.

State and local capital gains taxes

Federal capital gains tax is only part of the bill. Most states also tax capital gains, though the rate and rules vary significantly.

Some states do not tax capital gains at all — these include Alaska, Florida, Nevada, South Dakota, Tennessee, Texas, Washington, and Wyoming. Other states tax capital gains as ordinary income, meaning they explore your regular state income tax rate. A few states, including California, have special capital gains tax rates or thresholds.

If you live in one state but sold an asset you owned in another state, you may owe tax to both. The rules depend on where the asset was located and where you lived when you sold it. This is most common with real estate sales.

Your state tax return will ask you to report capital gains separately from wages. Check your state's tax agency website or a tax professional if you are unsure whether your state taxes capital gains.

Reporting capital gains on your tax return

You report capital gains on Schedule D, which is part of Form 1040. You do not file Schedule D unless you had a sale — if you only own investments and did not sell any, you do not report them.

Schedule D has two parts. Part I is for short-term gains and losses (assets held one year or less). Part II is for long-term gains and losses (assets held over one year). You list each sale separately, or attach a summary if you had many sales.

After you complete Schedule D, you transfer the totals to Form 1040 itself. The long-term capital gains total goes to a specific line that triggers the preferential tax rates. The short-term gains are added to your ordinary income.

If you use tax software like TurboTax, H&R Block, or TaxAct, the software walks you through entering each sale and calculates Schedule D for you. If you file by hand or with a tax professional, they will prepare Schedule D based on your Form 1099-B and any other sales records you provide.

Special situations: real estate, inherited assets, and collectibles

Real estate sales follow the same capital gains rules as stocks, but with additional complexity. If you sell a home you lived in, you may be able to exclude up to $250,000 (or $500,000 if married filing jointly) of the gain from tax if you meet the ownership and use tests. This exclusion is not available for investment properties or rental homes.

Inherited assets receive what is called a step-up in basis. If your parent bought a stock for $10,000 and it was worth $50,000 when they died, your cost basis becomes $50,000, not $10,000. If you sell it when ready for $50,000, you owe no capital gains tax. This applies to most inherited assets, including real estate, but not to inherited retirement accounts.

Collectibles — art, coins, precious metals, and similar items — are taxed at a maximum rate of 28% on long-term gains, which is higher than the standard 20% rate. They are reported on Schedule D but flagged separately.

Frequently Asked Questions

Do I owe capital gains tax if I reinvest the money?

Yes. The tax is based on the profit you made, not on what you do with the money afterward. If you sell a stock for a $5,000 gain and when ready buy another stock with that money, you still owe tax on the $5,000 gain. Reinvesting does not defer or eliminate the tax.

What if I sold an investment at a loss — do I get a refund?

No refund, but you can use the loss to reduce other income. You can deduct up to $3,000 of net losses against wages and other income in the year of the loss. Unused losses carry forward to future years. If your only transaction was a $2,000 loss, you would deduct $2,000 against your wages that year.

How do I know my cost basis if I bought the stock years ago?

Your brokerage should have records going back several years. Log into your account and look for transaction history or cost basis reports. If the brokerage no longer has records, you can look up old statements or account confirmations. If you truly cannot find the records, you may need to reconstruct the basis or consult a tax professional.

Do I owe capital gains tax on cryptocurrency?

Yes. The IRS treats cryptocurrency like any other asset. If you bought Bitcoin for $10,000 and sold it for $25,000, you owe tax on the $15,000 gain. The gain is long-term if you held it over one year, short-term if less. You report it on Schedule D just like stocks.

Can I avoid capital gains tax by donating appreciated stock to charity?

Yes, and this is a common tax strategy. If you donate appreciated stock directly to a may have access to charity, you avoid the capital gains tax entirely and also get a charitable deduction for the full fair market value. You must donate the stock itself, not the proceeds from selling it.