What you owe depends on your total income and how long you held the asset
Long-term capital gains tax is calculated by taking your profit from selling an asset you owned for more than one year, then explore a tax rate that depends on your total income for that year. The rate is not fixed — it changes based on your tax bracket. Most people pay 0%, 15%, or 20%, though the exact rate depends on your filing status and how much you earned from all sources combined.
The calculation itself is straightforward: subtract what you paid for the asset from what you sold it for. That number is your gain. Then you look up which tax bracket applies to you, and that tells you the percentage you owe. The tricky part is understanding that your capital gains stack on top of your regular income, so a large gain can push you into a higher tax bracket.
Key Takeaways
- Your long-term capital gains tax rate is 0%, 15%, or 20% depending on your total income and filing status, not on the size of the gain itself.
- To find your gain, subtract your cost basis (what you paid, plus fees) from your sale price, then subtract any losses you had that year.
- Capital gains stack on top of your regular income, so you need to know your total taxable income before you can find the right rate.
- The IRS publishes tax bracket tables each year that show which income range puts you in each rate tier.
- You report long-term gains on Schedule D of your tax return, and the tax is calculated on Form 1040.
Finding your cost basis and calculating your gain
Your cost basis is what you paid for the asset plus any fees or commissions you paid to buy it. If you bought 100 shares of stock at $50 per share and paid a $10 commission, your cost basis is $5,010 (not $5,000). This matters because the IRS wants to know your actual out-of-pocket cost.
When you sell, subtract your cost basis from the sale price. If you sold those 100 shares for $7,500, your gain is $2,490 ($7,500 minus $5,010). If you sold for less than you paid, you have a loss instead — and losses can reduce your taxable gains for the year.
Your brokerage or mutual fund company will send you a form called a 1099-B after you sell, which shows the sale price and sometimes the cost basis. Check it carefully, because the basis shown is not always correct — especially if you bought the shares over time or reinvested dividends. The IRS expects you to report the correct basis, not just what the 1099-B says.
Understanding tax brackets and how gains stack on income
The tax rate you pay on long-term gains depends on your taxable income, which includes your wages, interest, dividends, and now your capital gains. The IRS publishes tax bracket tables each year that show the income ranges for each rate. For 2024, for example, a single filer with taxable income up to roughly $47,000 pays 0% on long-term gains, between roughly $47,000 and $518,000 pays 15%, and above that pays 20%. These numbers change every year.
The key point is that your gains are added to your other income. If you earned $60,000 in wages and sold an asset for a $50,000 gain, your total taxable income is $110,000. You do not pay 15% on the entire $110,000 — instead, the first portion of your gain fills in the remaining space in the 0% bracket, and the rest is taxed at 15%. This is called "stacking."
To find the exact rate you owe, you need to know your filing status (single, married filing jointly, head of household, etc.) and your total taxable income before adding the capital gain. Then you look at the IRS tax bracket table for your status and see which bracket your income falls into.
Netting gains and losses in the same year
If you sold multiple assets in the same year, you combine all the gains and losses. If you had a $10,000 gain on one stock and a $3,000 loss on another, your net gain for the year is $7,000. You only pay tax on the $7,000.
If your losses exceed your gains — say you had $5,000 in gains and $8,000 in losses — you have a net loss of $3,000. You can use up to $3,000 of that loss to reduce your other income (like wages) in that year. Any loss beyond $3,000 carries forward to future years, where you can use it again.
This is why it matters to track all your sales, not just the profitable ones. A loss in one investment can reduce the tax you owe on a gain in another.
The difference between long-term and short-term gains
Assets you owned for more than one year generate long-term gains, taxed at 0%, 15%, or 20%. Assets you owned for one year or less generate short-term gains, taxed as ordinary income at your regular tax bracket — which is usually higher. If you are in the 24% tax bracket for regular income, short-term gains are taxed at 24%, not 15%.
The holding period is measured from the day after you buy to the day you sell. If you bought on January 15 and sold on January 16 of the next year, that is long-term. If you sold on January 15, it is short-term.
When you have both long-term and short-term gains in the same year, you calculate them separately. Long-term gains use the 0%/15%/20% brackets. Short-term gains use your ordinary income brackets. You report both on Schedule D.
Reporting capital gains on your tax return
You report all sales on Schedule D (Capital Gains and Losses), which is part of Form 1040. List each sale separately: the asset, the date you bought it, the date you sold it, the cost basis, the sale price, and the gain or loss. At the bottom of Schedule D, you calculate your net long-term gain or loss and your net short-term gain or loss.
The totals from Schedule D transfer to Form 1040, where they are added to your other income to calculate your total taxable income. The tax on long-term gains is then calculated using the tax bracket tables and entered on Form 1040 as well.
If you use tax software, it usually walks you through Schedule D step by step. If you file by hand or with a tax preparer, make sure you have all your 1099-B forms and your own records of cost basis, because the software or preparer will need both.
Special situations: inherited assets and wash sales
If you inherit an asset, your cost basis is reset to its value on the day the person died, not what they paid for it. This is called a step-up in basis. If your parent bought a house for $100,000 and it was worth $400,000 when they died, your cost basis is $400,000. If you sell it a month later for $410,000, your gain is only $10,000, not $310,000. This can save a large amount of tax.
A wash sale happens when you sell an asset at a loss and then buy the same or a substantially identical asset within 30 days before or after the sale. The IRS disallows the loss and adds it to your cost basis in the new purchase instead. This rule prevents people from selling stocks to claim a loss for tax purposes and when ready buying them back. If you sold a stock at a loss, wait at least 31 days before buying it again if you want to claim the loss.
Frequently Asked Questions
Do I owe capital gains tax if I sold at a loss?
No, you do not owe tax on a loss. Instead, you can use the loss to reduce your taxable gains from other sales that year. If losses exceed gains, you can use up to $3,000 to reduce your other income, and carry the rest forward to future years.
What if I do not know my cost basis?
Contact your brokerage or the company that sold you the asset — they may have records going back years. If you cannot find it, the IRS allows you to estimate it based on the asset's value on a specific date, though this is complicated and often requires a tax professional. It is better to reconstruct records if possible.
Do I have to pay capital gains tax the year I sell, or can I pay it later?
You owe the tax in the year you sell. You report it on your tax return for that year, and if you owe money, you pay it when you file (usually by April 15 of the following year). If you expect a large gain, you can make estimated tax payments throughout the year to avoid a big bill at tax time.
How do I know which tax bracket applies to me?
The IRS publishes tax bracket tables each year on its website and in the instructions to Form 1040. Find the table for your filing status (single, married filing jointly, etc.), then look at your total taxable income before adding capital gains. That tells you which rate applies to your gains.
Can I reduce my capital gains tax by donating to charity?
Donating to charity reduces your overall taxable income, which can lower your tax bracket and the rate you pay on capital gains. But a more direct strategy is to donate appreciated assets (like stock) directly to the charity instead of selling them first. You avoid the capital gains tax entirely and still get a charitable deduction.