★ MONEY · CAPITAL GAINS TAX · GUIDE

How to Calculate Capital Gains Tax: Formula & Example

$10,000 in, $25,000 out — a $15,000 gain on $80,000 of taxable income costs $2,250.00 in federal tax and leaves $22,750.00 after tax.

What capital gains tax is

Capital gains tax is the federal tax on the profit from selling something you own. The tax is on the gain, not the sale price: buy for $10,000, sell for $25,000, and only the $15,000 profit is taxed. The rate depends on how long you held it and how much taxable income you have: more than a year is long-term, at 0%, 15% or 20%; a year or less is short-term, at ordinary rates — usually a bigger bill. Every figure here is checked against the capital gains tax calculator.

The capital gains tax formula

The formula has three parts. First, the gain: sale price minus purchase price. Second, stack income plus gain through the 2026 bands — 0% to $49,450 single ($98,900 joint), 15% to $545,500 ($613,700 joint), 20% above — taxing only the part of the gain in each band. Third, the 3.8% NIIT, which applies above $200,000 single or $250,000 joint. In short: gain = sale − purchase; tax = the gain’s share in each band; proceeds = sale − tax − NIIT.

Step 1: Find your gain: sale price minus purchase price

Subtract what you paid from what you sold it for. In this guide: $25,000 minus $10,000 is a $15,000 gain. Fees to buy are part of the purchase price; fees to sell count against the sale price. If the sale price is below the purchase price, you have a loss, not a gain, and a loss owes no capital gains tax.

Step 2: Check how long you held it (more than one year is long-term)

Count from the day after you bought to the day you sold. More than one year is long-term, at the 0%, 15% and 20% rates. One year or less is short-term, taxed at your ordinary income-tax rates. The one-year line is a cliff: sell on day 366 and the rate drops; sell on day 365 and it does not.

Step 3: Work out your taxable income before the gain

Take your taxable income before adding the gain — income after the standard deduction, not gross pay. This guide uses $80,000 for a single filer. It decides where your gain starts stacking: the 0% band is already partly used up by your other income. The thresholds are on taxable income, not gross income — worth saying twice, because people get it wrong.

Step 4: Stack the gain through the 0%, 15% and 20% bands

Add the gain on top of your taxable income and tax only the part in each band. With $80,000 of income and a $15,000 gain, the gain runs from $80,000 to $95,000 — all inside the 15% band, which runs to $545,500 for single filers. So the tax is 15% of $15,000, or $2,250.00. At $40,000 of income, the first $9,450 sits in the 0% band (up to $49,450) and only $5,550 is taxed at 15%, for $832.50. At $30,000 the whole gain fits in the 0% band and the tax is $0.00.

Step 5: Add the 3.8% NIIT if your income is high enough

The net investment income tax adds 3.8% on the smaller of your gain and the amount your income exceeds $200,000 single or $250,000 joint. Here, income means MAGI, approximated as taxable income plus the gain. In this guide, $80,000 plus the gain is $95,000 — far below $200,000 — so the NIIT is $0.00. At $250,000 of income the NIIT on a $15,000 gain would be $570.00. The NIIT applies to short-term gains too.

Step 6: Subtract the tax from the sale price for your after-tax proceeds

The money you keep is the sale price minus the tax and the NIIT: $25,000 minus $2,250.00 of tax and $0.00 of NIIT leaves $22,750.00. The effective rate is $2,250.00 divided by $15,000, or 15.00% — the number to compare against other uses of the money.

Worked example: $10,000 in, $25,000 out, $80,000 of income

Put the six steps together: buy for $10,000, sell for $25,000, a $15,000 gain, $80,000 of income, single, held more than a year. The gain stacks entirely in the 15% band, so the federal tax is $2,250.00, the NIIT is $0.00, the proceeds are $22,750.00, and the effective rate is 15.00%. Note that totals are computed from unrounded values, so rounded parts may differ by a cent from their rounded sum.

What changes if you sell within a year?

The same sale as a short-term gain is taxed at ordinary rates instead. Your $80,000 of income plus the $15,000 gain is taxed through the 2026 ordinary brackets, and the gain’s share is $3,300.00 — a 22.00% rate. Proceeds fall to $21,700.00, which is $1,050.00 less than the long-term version. Holding past the one-year mark is the single biggest lever here.

Working backwards: what sale price gives a $5,000 tax bill?

The calculation also runs in reverse. To owe exactly $5,000.00 of tax on a long-term gain with $80,000 of income, you need a sale price of $43,333.33 — a gain of $33,333.33, all taxed at 15%. Seven cents less, $43,333.26, gives $4,999.99. The 20% band starts further up: at $530,500 of income the whole $15,000 gain still sits at 15% and the tax is $2,250.00; one dollar more, $530,501, and the tax becomes $2,250.05.

What the calculation leaves out

The calculation leaves out five things. First, state tax: this is federal only, and most states tax the gain as ordinary income on top. Second, collectibles at up to 28% and unrecaptured Section 1250 gain at up to 25% — rates this calculation does not model. Third, the home-sale exclusion: up to $250,000 of gain on a primary home is excluded for single filers ($500,000 joint). Fourth, losses: a loss offsets other gains, and up to $3,000 a year can offset ordinary income. Fifth, the thresholds are on taxable income, not gross income.

What to do next

Run your own numbers through the capital gains tax calculator: try your purchase price, sale price, and income, then work backwards to see what sale price your tax goal needs. For the full table across all four filing statuses, see the 2026 capital gains tax brackets page.

Cite this guideBright Side Kit. “How to Calculate Capital Gains Tax: Formula & Example” brightoolbox.com, 2026. Method: gain = sale − purchase; 2026 single bands 0% to $49,450, 15% to $545,500, 20% above. Worked example: $10,000 in, $25,000 out, $80,000 income, single → $2,250.00 tax, $22,750.00 proceeds. Bright Side Kit. "How to Calculate Capital Gains Tax: Formula & Example" https://brightoolbox.com/guides/how-to-calculate-capital-gains-tax/ Accessed October 26, 2026.

Frequently asked questions

How do you calculate capital gains tax?

Gain = sale price − purchase price, then stack the gain through the 0%, 15% and 20% bands on top of your taxable income. Buy for $10,000 and sell for $25,000 on $80,000 of income, single, long-term: a $15,000 gain, $2,250.00 of tax, $22,750.00 after tax.

What is the capital gains tax on a $15,000 gain?

At $80,000 of taxable income, single, long-term: $2,250.00. At $40,000 of income the tax is $832.50, because part of the gain sits in the 0% band; at $30,000 of income the whole gain fits in the 0% band and the tax is $0.00.

What is the difference between short-term and long-term capital gains tax?

Long-term gains (held more than a year) are taxed at 0%, 15% or 20%; short-term gains are taxed at ordinary income rates. The same $15,000 gain costs $2,250.00 long-term but $3,300.00 short-term — $1,050.00 more, with proceeds of $21,700.00 instead of $22,750.00.

What are the 2026 capital gains tax thresholds?

Single: 0% to $49,450, 15% to $545,500, 20% above. Joint: 0% to $98,900, 15% to $613,700, 20% above. The thresholds are on taxable income, not gross income. The full four-status table is on the 2026 capital gains tax brackets page.

What is the 3.8% NIIT and when does it apply?

The net investment income tax adds 3.8% on the smaller of your gain and the amount your income exceeds $200,000 single or $250,000 joint. At $80,000 of income the NIIT is $0.00; at $250,000 of income the NIIT on a $15,000 gain is $570.00. It applies to short-term gains too.

What sale price gives a $5,000 capital gains tax bill?

$43,333.33 — a $33,333.33 gain on a $10,000 purchase, all taxed at 15% with $80,000 of income, gives $5,000.00 of tax. Seven cents less, $43,333.26, gives $4,999.99.