Capital Gains Tax Calculator
Estimate the federal tax on selling stock, funds or other investments, at short- or long-term rates, with the 3.8% net investment income tax
Your Sale and Income
What you paid, including fees
What you received, after fees
Wages and other income, before deductions
Optional; many states tax gains as income
Estimated tax on your gain
$2,250
15.0% of a $15,000 long-term gain · you keep $12,750 of the profit
Federal income tax
$2,250
top rate on this gain: 15%
Net investment income tax
$0
none: income under $200,000
State tax
$0
enter your state's rate to include it
If sold within a year
$3,300
holding over a year saves you $1,050
How your gain is taxed
The $15,000 gain stacks on top of your other taxable income
Long-term vs short-term
Total tax on the same gain
How Capital Gains Are Taxed
Profit on an investment you held more than a year is a long-term gain, taxed at 0%, 15% or 20% depending on your taxable income. Gains on investments held a year or less are taxed as ordinary income, at up to 37%. Higher earners also pay the 3.8% net investment income tax.
This is a federal estimate using 2026 brackets. It doesn't cover collectibles (taxed at up to 28%), depreciation recapture on property, the alternative minimum tax or credits.
The Formulas
Gain = sale price − cost basis
Long-term rate: 0%, 15% or 20% by taxable income
NIIT = 3.8% × min(gain, income − threshold)
Long-term gains are stacked on top of your other taxable income, so they fill the 0% bracket first only if your other income leaves room.
Ways to Pay Less
- •Holding more than a year usually cuts the rate sharply
- •Sell losers to offset gains (tax-loss harvesting), up to $3,000 of other income too
- •Rebuying the same stock within 30 days of a loss sale disallows the loss (wash sale)
- •In a low-income year, long-term gains may fall in the 0% bracket
- •Gains inside a 401(k) or IRA aren't taxed when you sell
Frequently Asked Questions
Related Calculators
Related Articles
More articles in Saving & Investing →- Step-by-step guideCapital Gains Tax: 2026 and 2027 Rates and How to Calculate ItLearn how short- and long-term capital gains are taxed, the 2026 and 2027 brackets, the 3.8% net investment income tax and how losses lower the bill.
- How to Calculate Stock Profit, Return and Break-Even PriceWork out the profit and return on a stock trade including commissions and dividends, the yearly return, and the price you need to break even.
- How Much Can a Roth IRA Grow? Tax-Free Growth ExplainedSee how much a Roth IRA could grow by retirement, how much tax it can save compared with a taxable account, and the key rules for 2026.
- How to Calculate Your Average Cost per Share (and Average Down)Find your average cost per share across several purchases, and work out how many shares it takes to average down to a target price.