⚖️ Capital Gains Tax Calculator

A capital gains tax calculator for stocks and for a house sale: 2026 IRS brackets, the $250k/$500k home exclusion, depreciation recapture and the 3.8% NIIT.

Free No Signup Required Browser-Based
Net Capital Profit (After Taxes)
+$14,407.50
Gross Profit: $16,950 (113.0% ROI) • Estimated Tax: $2542.50 (15.0%)
Gross Capital Gain
$16,950
Tax Bracket Applied
15.0% (Long-Term)
Total Cash in Pocket
$29,407.50

What Capital Gains Tax Calculator Does

Capital gains tax depends on three things: how long you held the asset, what your other taxable income is, and what kind of asset it was. Hold something more than a year and the gain is long-term, taxed at 0%, 15% or 20%. A year or less and it is short-term, taxed as ordinary income — which for most people is a materially higher rate.

The detail people miss is that a gain stacks on top of your ordinary income rather than being taxed in isolation. A single gain can therefore be partly untaxed and partly taxed at 15%, because it straddles a threshold. A calculator that applies one flat rate to the whole gain gets this wrong in both directions.

The other thing generic calculators omit is that the asset type often matters more than the rate table. Inherited property usually gets a stepped-up basis that wipes out decades of gain. A primary residence has a large exclusion. A rental has depreciation recapture taxed at up to 25%. Those rules routinely change the answer by more than the bracket does.

How to Use Capital Gains Tax Calculator

  1. Choose whether you are selling securities or a home or rental property
  2. Enter original purchase price and final selling price
  3. For property, add capital improvements, selling costs and any depreciation claimed while it was rented
  4. Select holding period (Long-term over 1 year or Short-term under 1 year)
  5. Choose tax filing status and annual taxable income bracket
  6. For a main home, confirm the 24-of-60-month ownership and use test to apply the Section 121 exclusion
  7. View estimated tax owed, net profit after tax, and true after-tax ROI %

Formula Used by Capital Gains Tax Calculator

Capital gain

gain = sale_price − selling_costs − adjusted_basis

adjusted_basis
Usually what you paid, plus capital improvements, minus any depreciation claimed
selling_costs
Commission, closing costs, transfer taxes — these reduce the gain

Worked example

Stock bought for $15,000, sold for $32,000, $50 in fees.

  1. 32,000 − 50 − 15,000 = 16,950

Result: A $16,950 capital gain. Long-term if held more than one year.

Long-term tax — the gain stacks on your income

tax = Σ (portion of gain falling in each rate band × that band's rate)

stacking
The gain sits above ordinary taxable income, so the bands are measured from your income upward, not from zero

Worked example

A single filer with $45,000 taxable income realizes a $10,000 long-term gain in 2026. The 0% band runs to $49,450.

  1. Room left in the 0% band: 49,450 − 45,000 = 4,450
  2. That first $4,450 of gain is taxed at 0% = $0
  3. The remaining $5,550 falls in the 15% band = $832.50

Result: $832.50, a blended 8.3% — not the $1,500 a flat 15% calculation would produce. Straddling matters.

Net Investment Income Tax

NIIT = 3.8% × min(net investment income, MAGI − threshold)

threshold
$200,000 single, $250,000 married filing jointly. Set by statute and never indexed for inflation

Worked example

A single filer with $190,000 income and a $30,000 long-term gain, so MAGI is $220,000.

  1. Excess over threshold: 220,000 − 200,000 = 20,000
  2. Lesser of gain and excess: 20,000
  3. 20,000 × 3.8% = 760

Result: An extra $760 on top of the ordinary capital gains tax. Because the threshold is not indexed, this catches more people every year.

Long-Term Capital Gains Rates — Tax Year 2026

Thresholds are measured against total taxable income including the gain. From IRS Revenue Procedure 2025-32, section .03.

Filing status0% up to15% up to20% above
Single$49,450$545,500$545,500
Married filing jointly$98,900$613,700$613,700
Married filing separately$49,450$306,850$306,850
Head of household$66,200$579,600$579,600
Estates and trusts$3,300$16,250$16,250

Source: IRS Revenue Procedure 2025-32 (PDF), §.03 Maximum Capital Gains Rate

Rates Above 20% — the Exceptions

Not every long-term gain gets the headline rates. These three exceptions catch people out, particularly on rental property.

AssetMaximum rateApplies to
Collectibles (art, coins, metals)28%Long-term gains on collectible assets
Qualified small business stock (§1202)28%The taxable portion of a §1202 gain
Unrecaptured §1250 gain25%Depreciation previously claimed on real property
Short-term gainsUp to 37%Anything held one year or less — ordinary rates

Source: IRS Topic no. 409 — Capital gains and losses

Selling a Main Home — Three Sales of the Same House

Bought for $300,000. Joint filers with $150,000 of other income, except the rental case which is a single filer with $100,000. Every figure computed by the calculator and re-derived by hand in scripts/verify-capital-gains-property.mjs.

CaseTotal gain§121 exclusionTaxableFederal tax
Sold $700,000, $50,000 improvements, $42,000 costs$308,000$308,000$0$0
Sold $1,000,000, $50,000 improvements, $60,000 costs$590,000$500,000$90,000$13,500
Rental sold $400,000, $60,000 depreciation, no exclusion$236,000$0$236,000$45,854

What Moves the Gain on a Property Sale

Publication 523 is specific about which of these count. A repair is not an improvement, however much it cost.

ItemEffectExamples
Capital improvementsAdded to basis — reduces gain 1:1New roof, added bathroom, kitchen modernization, heating system, storm windows
Repairs and maintenanceNo effect at allRepainting, fixing a leak, replacing a broken pane
Selling expensesReduce the amount realized 1:1Sales commission, advertising, legal fees, points paid for the buyer
Depreciation while rentedReduces basis — raises gain, and is taxed first at up to 25%Any amount allowed OR allowable after 6 May 1997, claimed or not

Rules That Change the Answer More Than the Rate Does

For the asset types people actually search for, these provisions usually dominate the bracket calculation.

SituationRuleEffect
Inherited propertyStepped-up basisBasis resets to fair market value at the date of death, so gain accrued during the deceased's lifetime is never taxed
Primary residence§121 exclusionExclude up to $250,000 of gain ($500,000 filing jointly), if you owned and lived in it 2 of the last 5 years
Rental property§1250 recaptureDepreciation you claimed is recaptured at up to 25%, even though it lowered your tax in earlier years
Gifted propertyCarryover basisYou inherit the giver's original basis — no step-up, so the built-in gain comes with it
Losses§1211 limitNet losses offset gains fully, then up to $3,000 of ordinary income a year ($1,500 if filing separately); the rest carries forward

How to Read Your Result

The one-year line is worth planning around

The difference between day 365 and day 366 can be the difference between a 22% ordinary rate and a 15% long-term rate. On a $50,000 gain that is $3,500. The holding period counts from the day after acquisition through the day of disposal, so check the actual dates rather than assuming.

Inherited property is the biggest misunderstanding

People routinely assume they owe tax on decades of appreciation when they sell a parent's house. Usually they do not. The basis steps up to the fair market value on the date of death, so only appreciation after that date is taxable — which, if you sell soon after, is often close to nothing. Get a dated valuation at the time of death; reconstructing it later is much harder.

Selling a house is a different calculation, not the same one with bigger numbers

Four things change. Capital improvements are added to your basis, so a $50,000 kitchen and roof reduce the gain by $50,000 — repairs and maintenance do not count. Selling costs come off the sale price, so a 6% commission on a $1,000,000 sale reduces the gain by $60,000 before anything else happens. Any depreciation you claimed while it was a rental comes off your basis, raising the gain. And then §121 can erase up to $250,000 of what is left, or $500,000 on a joint return. On a home bought for $300,000, improved by $50,000 and sold for $700,000 with $42,000 of costs, the gain is $308,000 and the federal tax is zero.

The exclusion has a hard ceiling, and it has not moved since 1997

$250,000 and $500,000 are statutory amounts, not inflation-adjusted ones. They were set in 1997 and the median US house has more than tripled since. That is why long-held homes in expensive markets now generate taxable gains that would have been fully covered a generation ago. On the same house sold for $1,000,000 with $60,000 of costs, the gain is $590,000, $500,000 is excluded, and $90,000 is taxable — $13,500 at the 15% rate for a joint filer with $150,000 of other income. The tests are mechanical: own it for 24 of the last 60 months, live in it as your main home for 24 of the previous 60.

Renting it out changes the answer permanently

Depreciation is recaptured before the exclusion is applied, and the exclusion cannot touch it. Worse, the recapture is on depreciation "allowed or allowable" — so it applies even if you never claimed the deduction. A $250,000 house with $40,000 of depreciation sold for $800,000 has a $542,000 gain: $40,000 is unrecaptured §1250 gain taxed at up to 25%, the remaining $502,000 gets the $500,000 joint exclusion, and $2,000 stays taxable. The bill is about $9,000 on a sale that would otherwise have been tax free.

Depreciation recapture surprises landlords

Depreciation on a rental reduces your taxable income each year, but it also reduces your basis. When you sell, that accumulated depreciation is recaptured at up to 25% — and the IRS applies recapture on depreciation you were *allowed* to claim, whether or not you actually claimed it. Not taking the deduction does not avoid the recapture.

The 0% band is a genuine planning opportunity

In a low-income year — a career break, early retirement before pensions start, a year between jobs — a long-term gain can be realized entirely at 0%. Some people deliberately sell and immediately repurchase to reset basis upward at no tax cost. The wash sale rule blocks this for losses, not for gains.

Limitations & Accuracy Notes

  • The property mode models adjusted basis, the §121 exclusion and §1250 depreciation recapture. It does not model stepped-up basis on inherited assets, §1031 like-kind exchanges, a partial exclusion under the unforeseen-circumstances rules, non-qualified use after 2008, wash sales, or carried-forward losses from prior years.
  • Unrecaptured §1250 gain is taxed here by stacking it on your ordinary income and capping each layer at 25%, then stacking the 0/15/20 gain above it. That reproduces the effect of the Schedule D worksheet in ordinary cases; the worksheet itself is longer and can differ where other rate-specific gains are also present.
  • State capital gains tax is excluded. Most states tax gains as ordinary income; a few have no income tax at all; Washington taxes capital gains despite having no wage tax.
  • The collectibles and §1202 rates of 28% are not applied — the security mode assumes ordinary capital assets such as stocks or funds.
  • Tax year 2026 thresholds are used, from IRS Rev. Proc. 2025-32. These are adjusted annually. If you are reading this in a later tax year, verify against IRS.gov before relying on the figures.
  • The NIIT calculation uses your entered income as a proxy for modified adjusted gross income, which is a simplification.
  • This is an estimate for planning, not tax advice. Capital gains on property, inherited assets or business interests routinely involve rules this tool does not model — speak to a qualified tax professional before acting.

Frequently Asked Questions

What is the difference between short-term and long-term capital gains?
Assets held for 1 year or less are taxed as short-term capital gains at ordinary income tax rates (10%–37%). Assets held over 1 year benefit from lower long-term rates (0%, 15%, or 20%).
How do capital losses offset capital gains?
Capital losses can offset capital gains dollar-for-dollar. If net losses exceed gains, you can deduct up to $3,000 against ordinary income per tax year.
What is the Net Investment Income Tax (NIIT)?
An additional 3.8% federal tax on investment income, including capital gains, for taxpayers with modified adjusted gross income above $200,000 (single) or $250,000 (married filing jointly).
Do I owe capital gains tax on selling my primary home?
Often no — under IRC Section 121, you can exclude up to $250,000 ($500,000 married filing jointly) of gain if you owned and lived in the home for at least 2 of the last 5 years.
Which country's rules does this use?
The tool page states the jurisdiction and tax year its rates come from, and cites the source. Capital gains rules differ substantially between countries and change frequently, so check the date shown before relying on any figure.
How do I calculate capital gains tax on the sale of a house?
Switch the calculator to property mode. Your adjusted basis is the purchase price plus capital improvements minus any depreciation claimed while it was rented; the amount realized is the sale price minus selling costs such as the agent commission. The difference is the gain. If it was your main home, Section 121 can exclude up to $250,000 of it, or $500,000 filing jointly. A $300,000 house improved by $50,000 and sold for $700,000 with $42,000 of costs produces a $308,000 gain and, for a joint filer, no federal tax at all.
How much can I exclude when I sell my primary residence?
$250,000, or $500,000 on a joint return. IRS Topic 701 sets two mechanical tests: you must have owned the home for at least 24 months of the last 5 years, and used it as a residence for at least 24 months of the previous 5. The amounts are statutory and have not been adjusted for inflation since 1997, which is why long-held homes in expensive markets increasingly produce a taxable gain.
What happens to the exclusion if I rented the house out?
Depreciation is recaptured before the exclusion is applied and the exclusion cannot cover it. That portion is unrecaptured Section 1250 gain, taxed at a maximum of 25% under IRS Topic 409. The rule bites on depreciation "allowed or allowable", so it applies even if you never claimed the deduction — a common and expensive surprise.
Do home improvements reduce capital gains tax?
Yes, dollar for dollar, because they raise your basis. Publication 523 counts additions, a new roof, new siding, storm windows, a heating or air conditioning system, kitchen modernization and built-in appliances. It explicitly excludes repairs and maintenance that keep the home in good condition without adding value or prolonging its life — repainting before a sale is not an improvement. Keep the receipts; the burden of proving basis is yours.
Is capital gains tax calculated after the standard deduction?
Not directly, but your deductions still change the answer. The 0%, 15% and 20% bands are measured against taxable income, which is after deductions, and the gain stacks on top of that figure. So a larger standard deduction lowers the income the gain sits on and can move part of the gain into a lower band. Enter your taxable income, not your gross pay, for this to come out right.
What is the difference between short-term and long-term gains?
Many systems tax an asset held beyond a threshold period at a lower rate than one sold quickly. Where that applies, the holding period is measured precisely and selling shortly before the threshold can cost a materially higher rate on the whole gain.
What is a cost basis?
What you paid, adjusted for things that legitimately change it — purchase commissions, reinvested dividends, capital improvements on a property. Getting the basis wrong is the most common error in a gains calculation, and it almost always overstates the gain and therefore the tax.
Can losses offset gains?
In most systems yes, with rules about ordering and about carrying unused losses forward. There are usually anti-avoidance provisions preventing you from claiming a loss while immediately repurchasing the same asset, and the exact window varies by jurisdiction.
Do I owe tax if I have not sold?
Generally not — most systems tax a realized gain, so an unrealized increase in value is not taxable until disposal. Some jurisdictions treat certain events as disposals even without a sale, such as gifting or moving assets abroad.
Is this tax advice?
No. It applies stated rates to figures you enter. Capital gains is an area where the detail matters and the penalties for getting it wrong are real — consult a qualified tax professional.

References & Further Reading

By OnlineToolHubs Team • September 2026