The basic formula: sale price minus what you paid, times your tax rate
Capital gains tax is calculated on the profit you make when you sell an asset — a house, stock, or business. The profit itself is called your capital gain. To find it, subtract what you originally paid (your cost basis) from what you sold it for. That number is your gain. Then multiply that gain by the tax rate that applies to you, which depends on how long you held the asset and your income level.
The math looks like this: Sale Price − Cost Basis = Capital Gain. Then: Capital Gain × Your Tax Rate = Tax Owed. But the tax rate is not the same for everyone, and it changes based on whether you held the asset for more or less than one year.
You do not owe tax on the full sale price — only on the profit. If you bought a house for $200,000 and sold it for $250,000, your capital gain is $50,000, not $250,000. This is the single most important thing to understand about how capital gains tax works.
Key Takeaways
- Your capital gain is the sale price minus what you paid for the asset, and you only pay tax on that gain, not the full sale price.
- Long-term capital gains (assets held over one year) are taxed at lower rates than short-term gains, with rates of 0%, 15%, or 20% depending on your income.
- Your cost basis includes the original purchase price plus any improvements you made, minus any depreciation you claimed.
- You must report capital gains on your federal tax return using Schedule D, and some states also tax capital gains.
- Losses on asset sales can offset gains, and unused losses can carry forward to future years.
Long-term versus short-term: why holding time matters
The IRS taxes capital gains at different rates depending on how long you owned the asset. If you held it for more than one year, it is a long-term capital gain. If you held it for one year or less, it is a short-term capital gain. This distinction changes your tax rate significantly.
Short-term capital gains are taxed as ordinary income — at the same rate as your wages or salary. For 2024, that means rates ranging from 10% to 37%, depending on your tax bracket. Long-term capital gains are taxed at preferential rates: 0%, 15%, or 20%, depending on your total income for the year. Most people fall into the 15% bracket for long-term gains.
The holding period starts the day after you buy and ends the day you sell. If you bought stock on March 15 and sold it on March 15 of the next year, you held it for exactly one year and it qualifies as long-term. If you sold it on March 14, it is short-term.
What counts as your cost basis
Your cost basis is not always just the price you paid. It includes the original purchase price plus any money you spent improving the asset. For real estate, improvements are things like a new roof, addition, or major renovation — not routine maintenance like painting or repairs. For inherited assets, the cost basis is usually reset to the fair market value on the date of death, which can significantly reduce or eliminate the tax.
If you received stock as compensation, your cost basis is the fair market value on the day you received it. If you bought mutual funds and reinvested dividends, each dividend reinvestment has its own cost basis. If you sold only some of your shares, you need to track which shares you sold — this matters because different purchase dates mean different cost bases.
For rental property or business assets, you may have claimed depreciation deductions on your tax returns over the years. When you sell, you subtract the depreciation you claimed from your cost basis. This is called recapture, and it is taxed at up to 25% even though it is technically a capital gain.
How to report capital gains on your tax return
You report capital gains on Schedule D, which is part of your federal tax return. Schedule D has two sections: one for long-term gains and losses, one for short-term. You list each asset you sold, the date you bought it, the date you sold it, your cost basis, the sale price, and the gain or loss.
If your total capital gains exceed your total capital losses, you report the net gain on your main tax return (Form 1040). If you have more losses than gains, you can deduct up to $3,000 of losses against your ordinary income in that year. Any losses beyond $3,000 carry forward to future years — you can use them to offset future gains or future income, with no time limit.
Some brokerages and real estate platforms report sales to the IRS on Form 1099-B (for securities) or Form 1099-S (for real estate). The IRS receives a copy of these forms, so if your Schedule D does not match what was reported to them, you may receive a notice. Keep records of your cost basis and all supporting documents for at least three years.
State capital gains taxes and special situations
Most states do not have a separate capital gains tax — they tax capital gains as part of ordinary income. However, a growing number of states have introduced capital gains taxes on high-income earners. Washington, Illinois, and California have capital gains taxes; rates and income thresholds vary by state. If you live in one of these states or sold an asset there, you may owe state tax in addition to federal tax.
Some assets have special rules. If you sell your primary residence, you may be able to exclude up to $250,000 of gain ($500,000 if married filing jointly) if you meet the ownership and use tests. If you sell a business, you may may have access to for a Section 1202 exclusion that allows you to exclude part of the gain. Collectibles like art or precious metals are taxed at a maximum of 28%, even if they would otherwise may have access to for the 20% long-term rate.
If you sold an asset at a loss, you can use that loss to offset other gains. This is called tax-loss harvesting when done intentionally. However, if you sell a security at a loss and buy the same or a substantially identical security within 30 days before or after the sale, the wash-sale rule disallows the loss. The loss is added to the cost basis of the new purchase instead.
Keeping records and working backward from a sale
The hardest part of calculating capital gains tax is often finding your original cost basis, especially for old purchases or inherited assets. Start by gathering your purchase confirmation, any brokerage statements, and receipts for improvements. For real estate, your closing statement shows the purchase price. For stocks, your brokerage can provide a cost-basis report.
If you cannot find the original purchase price, you can sometimes use historical price data or fair market value estimates, but this is less reliable and may trigger IRS scrutiny. For assets you inherited, you will need the estate tax return or a professional appraisal from the date of death. For gifts, the donor's cost basis carries over to you — you inherit their basis, not a stepped-up one.
Once you have the cost basis and sale price, the calculation is straightforward. Subtract one from the other. If the result is positive, you have a gain. If it is negative, you have a loss. Then apply the appropriate tax rate based on how long you held it and your income level. A tax professional or tax software can help you verify the numbers and ensure you report everything correctly.
Frequently Asked Questions
Do I owe capital gains tax if I sold an asset at a loss?
No. You only owe tax on gains, not losses. If you sold an asset for less than you paid, you have a capital loss. You can use that loss to offset capital gains from other sales, and if losses exceed gains, you can deduct up to $3,000 against your ordinary income. Unused losses carry forward indefinitely.
What if I inherited an asset — do I owe capital gains tax when I sell it?
Usually no, or much less. Inherited assets receive a "stepped-up basis," meaning your cost basis is the fair market value on the date the person died, not what they originally paid. If you sell shortly after inheriting, you typically owe little to no capital gains tax. If you hold it longer and it increases in value, you owe tax only on the gain after the inheritance date.
How do I know if my gain is long-term or short-term?
Count the days from the day after you bought to the day you sold. If it is more than one year, it is long-term. If it is one year or less, it is short-term. The exact date matters — if you bought on January 15, 2023 and sold on January 15, 2024, it is exactly one year and qualifies as long-term. If you sold on January 14, 2024, it is short-term.
Can I reduce my capital gains tax by donating the asset to charity instead of selling it?
Yes. If you donate an appreciated asset directly to a may have access to charity, you avoid the capital gains tax entirely and can deduct the fair market value of the asset as a charitable contribution. You must donate the asset itself, not the proceeds from a sale. This works for stocks, real estate, and other appreciated property.
What happens if I do not report a capital gain on my tax return?
The IRS receives a copy of Form 1099-B or 1099-S from your broker or title company. If your tax return does not match, the IRS will likely send you a notice. You will owe the tax plus interest and potentially penalties. It is better to report the gain, even if you cannot pay immediately — you can set up a payment plan with the IRS.