Home / US Calculators / Capital Gains Tax

Investing & Tax

Capital Gains Tax Calculator

Estimate the federal tax on an investment sale and see the difference between short-term and long-term treatment, so you know your after-tax profit before you sell.

Estimated capital gains tax

$4,500

Capital gain$30,000
Applied rate15% (long-term)
If short-term instead$6,600 (22%)
If long-term instead$4,500 (15%)
After-tax profit$25,500

Short-term vs long-term tax on this gain

Holding more than a year usually means a lower rate.

Capital gains, defined

A capital gain is the profit when you sell an asset for more than your cost basis (what you paid). The federal tax depends on your holding period: short-term gains (held one year or less) are taxed as ordinary income, while long-term gains (held over a year) get lower rates of 0%, 15% or 20% based on your taxable income.

How the capital gains tax calculator works

capital gain = sale price − cost basis
short-term tax = gain × your ordinary marginal rate
long-term tax = gain × (0%, 15%, or 20% by income)
after-tax profit = gain − tax

Worked example

Buy stock for $20,000, sell for $50,000 → a $30,000 gain. Held long-term with $70,000 of income (single), you're in the 15% bracket: 30,000 × 15% = $4,500. Held short-term, the same gain is added to your ordinary income and taxed at 22% here, about $6,600, the reason holding past a year matters.

2026 long-term capital gains brackets

Filing status0% rate up to15% rate up to20% rate above
Single$49,450$545,500$545,500
Married filing jointly$98,900$613,700$613,700
Head of household$66,200$579,600$579,600

The thresholds apply to total taxable income, with gains stacked on top of ordinary income. Higher earners may also owe the 3.8% net investment income tax, which applies above $200,000 of modified adjusted gross income for single filers and $250,000 for married couples filing jointly. Those NIIT thresholds are not indexed for inflation.

How gains "stack" on top of your other income

The tool applies a long-term rate chosen from the income entered before the gain. For short-term gains it picks the marginal rate after adding the gain, then applies that one rate to all of it. Neither method splits a gain across brackets. This can materially understate or overstate tax; the independent example below shows why.

Example: a single filer has $40,000 of ordinary taxable income and sells shares for a $30,000 long-term gain. Total taxable income is $70,000. The first $9,450 of the gain fills the space up to the $49,450 threshold and is taxed at 0%. The remaining $20,550 is taxed at 15%, or about $3,083. That is roughly $1,400 less than applying 15% to the full gain. If your income is close to $49,450 (single) or $98,900 (married filing jointly), work through the split by hand or ask your tax software to confirm.

A low-income year can leave room in the zero-rate band, but qualified dividends, other gains and deductions can use the same room. Review the complete return before deciding how much to sell. The calculator cannot determine a tax-free sale amount reliably near a threshold.

Getting the cost basis right

Your gain is the sale price minus your basis, so a higher basis means less tax. Make sure the purchase price field includes everything that counts:

Legal ways to pay less

Hold for more than a year

Holding period can change the tax treatment, but waiting also exposes you to price changes. The holding period generally starts the day after acquisition and includes the sale date.

Harvest losses

Losses offset gains of the same type first, then the other type. If losses are bigger than gains, up to $3,000 a year ($1,500 if married filing separately) can reduce your ordinary income, and the rest carries forward indefinitely. The wash-sale rule disallows a loss if you buy the same or a substantially identical investment within 30 days before or after the sale.

Use the home sale exclusion

A main-home sale may qualify for an exclusion if the applicable ownership, use and other conditions are met. The purchase and sale fields alone cannot establish eligibility or the excluded amount. Use the IRS home-sale guidance before treating a gain as taxable or exempt.

Keep growth inside tax-advantaged accounts

Trading within tax-advantaged accounts generally does not produce a current capital-gains tax bill. Distribution rules differ by account. The investment calculator models growth without calculating those taxes.

Gains this calculator does not cover

Collectibles, depreciated real estate and other special assets can have different federal treatment. Capital losses, wash-sale adjustments, NIIT and state taxes also require separate work. This is not a return-preparation tool, and changing the income input cannot make it model every omitted rule.

Capital gains in the UK, Canada and Australia

This page covers a simplified US federal calculation. UK, Canadian and Australian capital-gains rules are different, so converting the currency does not make this tool applicable. Use current guidance for your tax residence and the asset involved.

Check the income and basis before comparing results

Use taxable income before this sale for the income field, not salary or adjusted gross income. The labels do not resolve bracket splitting, so a result close to a threshold still needs an independent calculation. For a straightforward example entirely within one rate band, the percentage multiplication can be a useful cross-check.

Identify the lots sold and retain each lot's basis and holding period. One average purchase price can hide these differences. This tool does not select tax lots or reconcile a broker statement.

Frequently asked questions

What is capital gains tax?

Federal tax on profit from selling an asset above its cost basis.

Short-term vs long-term?

Short-term (≤1 yr) is ordinary income; long-term (>1 yr) gets 0/15/20%.

What are the long-term rates?

0%, 15% or 20% depending on your taxable income and filing status.

How do I lower the tax?

The tax can depend on holding period, cost basis, losses and account type. Check the full return before selling for tax reasons; waiting longer also leaves you exposed to market price changes.

Does this include NIIT or state tax?

No, it's a simplified federal estimate.

What are the 2026 capital gains tax brackets?

For single filers, 0% up to $49,450 of taxable income, 15% up to $545,500 and 20% above; for married couples filing jointly, 0% up to $98,900 and 15% up to $613,700.

Related calculators

Content checked 27 October 2026. Method: local calculator assumptions and IRS Publication 505. Planning estimates; check the stated exclusions.