Capital Gains Tax Calculator
Enter what you paid, what you sold for, how long you held it and your other income. The calculator works out the extra tax the sale adds to your return.
Total Tax on the Sale
$4,500.00
Capital Gain (Loss)
$30,000.00
Federal Income Tax on the Gain
$4,500.00
Net Investment Income Tax
$0.00
State Tax
$0.00
Total Tax as a Share of the Gain
15%
Sale Price After Tax
$75,500.00
Other Taxable Income (Without the Sale)
$58,900.00
Taxable Income With the Sale
$88,900.00
Long-Term Gain Taxed at 0%
$0.00
Long-Term Gain Taxed at 15%
$30,000.00
Long-Term Gain Taxed at 20%
$0.00
How it works
Your capital gain is the sale price less your cost basis. How it is taxed depends on how long you held the asset. A gain on something held one year or less is short-term and is taxed exactly like wages, at your ordinary income tax brackets. A gain on something held more than one year is long-term and is taxed at 0%, 15% or 20%.
Long-term rates are not chosen by the size of the gain alone. The gain is stacked on top of your other taxable income, and the part that falls below the 0% threshold (for 2026, taxable income of $49,450 single, $98,900 married filing jointly, $66,200 head of household) is untaxed; the part up to $545,500 single ($613,700 joint, $579,600 head of household) is taxed at 15%; anything above at 20%.
On top of income tax, the net investment income tax of 3.8% applies to the smaller of your investment income and the amount by which your modified AGI exceeds $200,000 ($250,000 joint, $125,000 separate). These thresholds are set in the statute and are not adjusted for inflation.
The result is the extra tax the sale adds: income tax with the gain minus income tax without it, plus the investment tax and your state rate on the gain.
Formula
gain = sale price − purchase price
other taxable = max(0, other income − deduction)
taxable with sale = max(0, other income + gain − deduction)
short-term: federal tax = tax(taxable with sale) − tax(other taxable)
long-term: gain stacked above other taxable; 0% to the first threshold, 15% to the second, 20% above
(never more than taxing the gain as ordinary income)
NIIT = 3.8% × min(gain, max(0, other income + gain − NIIT threshold))
total = federal tax + NIIT + state rate × gainExample
A single filer in 2026 sells shares bought for $50,000 for $80,000 after more than a year, with $75,000 of other income and the $16,100 standard deduction. Taxable income is $58,900 without the sale and $88,900 with it. The 0% band ends at $49,450, below where the gain starts, so all $30,000 is taxed at 15%: $4,500. Income is far below the $200,000 investment tax threshold, so the total is $4,500 and the seller keeps $75,500.
Had the shares been held a year or less, the same $30,000 gain would sit entirely in the 22% bracket: $6,600 of tax.
In the IRS's net investment income tax Q&A, a single filer with $180,000 of wages and $90,000 of investment income has modified AGI of $270,000, $70,000 over the threshold, and owes 3.8% × $70,000 = $2,660. Entered here as a $90,000 long-term gain, the calculator gives the same $2,660, plus $13,500 of income tax at 15%.
Assumptions and limitations
- Brackets, standard deductions and the long-term capital gains thresholds come from the shared federal tax data for the year you choose (for 2026, IRS Revenue Procedure 2025-32). The investment tax rate and thresholds are fixed by statute (IRC §1411) and not indexed.
- The standard deduction is the basic amount for your filing status, without the additions for age 65 or blindness or the senior deduction; choose itemized and enter your total if yours differs.
- Your other income is assumed to be ordinary income with no other capital gains, losses, qualified dividends or investment income. Modified AGI for the investment tax is taken as other income plus the gain.
- A loss shows zero tax. Capital losses offset other gains and up to $3,000 of ordinary income a year ($1,500 if married filing separately; IRC §1211(b)), with the rest carried forward; that saving is not calculated.
- Collectibles (taxed at up to 28%), unrecaptured depreciation on real estate (up to 25%), the home sale exclusion, wash sales, inherited or gifted basis and the alternative minimum tax are not modelled.
- State tax is a single flat rate on the gain, not your state's actual rules.
- Results are estimates for planning and are for informational and educational purposes only. They are not financial, tax or legal advice.
Frequently asked questions
Can I really pay 0% on a long-term gain?
Yes, on the part of the gain that fits under the 0% threshold after your other taxable income. A retiree or someone with a low-income year can often sell appreciated shares without federal income tax, though the gain still counts toward AGI for other purposes such as the taxation of Social Security benefits.
Does a big gain push my wages into a higher bracket?
No. Long-term gains are stacked on top of ordinary income, so they never change the tax on your wages; a large gain can only move more of itself into the 15% or 20% band. A short-term gain is ordinary income and is taxed at whatever brackets it fills.
More in Finance calculators.