DayCents

Taxes

Capital Gains Tax Calculator

Holding an asset for more than a year usually changes its tax rate, not just its return. Long-term gains are taxed at 0%, 15%, or 20% for most people; sell a day early and the whole gain is taxed as ordinary income.

Formula shown below · Tested against worked examplesHow we verify

What you paid, including commissions and fees.

Estimated tax owed: $3,000

Estimated tax owed

$3,000

Federal capital gains tax at the rate you selected.

Capital gain
$20,000
You keep
$67,000
Tax as a share of the gain
15%
Your gain$20K
You keep$17,00085%
Tax$3,00015%

One email with a link back to these numbers. We'll also send our twice-monthly money guide — unsubscribe in one click.

Compare scenariosTry three values of one input
Capital Gains Tax Calculator results for three values of Purchase price (cost basis)
Purchase price (cost basis)
Estimated tax owed$3,750$3,000$750$2,250$1,500
Capital gain$25,000$20,000$5,000$15,000$10,000
You keep$66,250$67,000+$750$67,750+$1,500

Every other input stays at the value you set above — currently $50,000 for purchase price (cost basis). Differences are measured against the first column.

Saved scenariosSave this calculation

Saved in this browser only — no account, and nothing is sent to us. Clearing your browser data deletes them.

How this calculator works

Gain = sale price − cost basis. Tax = gain × the rate you select, and nothing is owed on a loss. The effective rate divides tax by the gain, and 'you keep' is the sale price less the tax.

Federal only, with a single flat rate you choose — real liability depends on your total income, filing status, state, and the 3.8% net investment income tax. It also does not model losses carried forward or the primary-residence exclusion, which shelters up to $250,000 of gain ($500,000 married) on a home you lived in.

Formula

Gain = Sale price − Cost basis Tax = max(0, Gain) × t Net proceeds = Sale price − Tax
Cost basis
What you paid, PLUS reinvested dividends and commissions
t
The rate for your holding period and income

A loss produces no tax here and may be usable against other gains. Omitting reinvested dividends from the basis is the most common error, and it overstates both the gain and the tax.

What this assumes

  • The holding period decides the rate: more than a year is long-term, anything less is taxed as ordinary income.
  • Long-term rates of 0%, 15% or 20% depending on income. The net investment income tax and state capital gains tax are not included.
  • Cost basis as entered. Reinvested dividends increase basis and are commonly omitted, which overstates the gain.

What changes this number

Holding period
Crossing one year can halve the tax on the same gain. It is the cheapest planning decision available.
Your income that year
The 0% long-term band is real and useful in a low-income year — a career break, or early retirement.
Which lots you sell
Specifying high-basis shares rather than accepting first-in-first-out reduces the gain directly.

A worked example

Take the $20k long-term gain at 15% scenario. These figures are produced by the calculator above, not written alongside it, so they always match what the tool returns.

What you enter

Purchase price (cost basis)
$50,000
Sale price
$70,000
Your capital gains rate
15% — long-term, most filers

What it returns

Estimated tax owed
$3,000
Capital gain
$20,000
You keep
$67,000
Tax as a share of the gain
15%

Sources

This calculator uses no external data — the result follows entirely from the formula above and the values you enter, so there is nothing to cite beyond the arithmetic.

Calculator last reviewed August 9, 2026. How we verify

Try an example

Frequently asked questions

What's the difference between short-term and long-term gains?

The holding period. Sell an asset you have owned a year or less and the gain is short-term, taxed at your ordinary income rate — up to 37%. Hold longer than a year and it becomes long-term, taxed at 0%, 15%, or 20% depending on income. Waiting a few extra days can be the highest-paid decision of the year.

What is cost basis?

What you paid, adjusted — purchase price plus commissions and fees, and for property, plus capital improvements. A higher basis means a smaller taxable gain, which is why keeping records of improvements and reinvested dividends matters. Brokerages track basis for most securities.

Do I owe state tax too?

Usually. Most states tax capital gains as ordinary income, and a handful do not tax income at all. This calculator covers the federal portion only, so add your state rate for the full picture — our state income tax pages list them.

What about the 3.8% net investment income tax?

It applies on top of the rates above once modified adjusted gross income passes $200,000 single or $250,000 married filing jointly. It is not included here; if you are near those thresholds, add it to the rate you select or ask a tax professional.

Can I use losses to reduce the tax?

Yes. Capital losses offset capital gains dollar for dollar, and up to $3,000 of leftover loss can offset ordinary income each year, with the rest carried forward. Deliberately realising losses to offset gains is called tax-loss harvesting — watch the 30-day wash-sale rule.

Disclaimer: DayCents provides this calculator for educational purposes only. Results are estimates based on your inputs and the stated assumptions — they are not financial advice, a quote, or an offer of credit. Consult a qualified financial professional before making major money decisions.