Tax

Capital Gains Tax Calculator

Total the real burden on an investment gain — the headline 15% or 20% bracket is only part of it once the Net Investment Income Tax and state tax are added.

Capital Gains Tax Calculator

Results recalculate instantly on every keystroke. Nothing you type is transmitted.

The Gain
$
$
Your Position
$
$
State
%
Real Effective Rate On The Gain
Federal, NIIT and state tax combined, as a share of the gain
Total Tax On The Gain
Federal Capital Gains Tax
How The Gain Stacks
Net Investment Income Tax
State Tax
What The Surtaxes Add
Net Proceeds After Tax
Value Of Harvesting Losses

What this result does not account for

  • Results are a model, not a quotation — an institution's own figures govern.
  • Every input is an assumption; change one and the answer changes with it.
  • Rounding is applied only at the display layer, so totals may differ by a cent from a statement that rounds each line.
Zero-Server Execution Updated 11 Aug 2026 Reviewed by Imran S. Qureshi, CFA IEEE-754 Double Precision

In short: A $180,000 long-term gain alongside $210,000 of income is taxed at the 15% federal rate — $27,000 — but the 3.8% Net Investment Income Tax adds $6,840 and a 9.3% state adds $16,740. The real burden is $50,580, an effective 28.10%, with the surtaxes contributing 13.10 points.

Formula

Federal = gain stacked above ordinary income across 0% / 15% / 20% bands  ·   NIIT = 3.8% × min(gain, MAGI − $200,000)  ·   Total = federal + NIIT + state

Gains stack on top of ordinary income, so your other earnings determine which capital-gains band the gain falls into.

Worked Example

  1. Stack the gain. Ordinary taxable income of $195,400 puts the entire $180,000 gain in the 15% band.
  2. Federal tax. $180,000 × 15% = $27,000.
  3. Add NIIT. MAGI of $390,000 exceeds $200,000, so 3.8% applies to the full gain — $6,840.
  4. Add state. 9.3% of $180,000 = $16,740.
  5. Total the burden. $50,580 — an effective 28.10%, with surtaxes adding 13.10 points.

Analyst's note. Investors routinely plan around the 15% or 20% headline and are then surprised by the bill. The Net Investment Income Tax adds a flat 3.8% once modified AGI clears $200,000, and most states tax gains as ordinary income with no preferential rate at all — together they add 13.10 points here, taking a nominal 15% to a real 28.10%. That changes the arithmetic of holding versus selling materially. It also makes loss harvesting considerably more valuable than the headline rate implies: each dollar of harvested loss is worth $0.28 of tax here, not $0.15, because it removes a dollar from all three layers simultaneously.

Strengths & Limits Of This Model

Where this engine is strong

  • Runs entirely in your browser — no figure you type is transmitted or stored.
  • Shows the full working, so every number can be traced and challenged.
  • Free, unmetered and free of affiliate incentives.

Where it stops

  • Generalised assumptions cannot capture every individual circumstance.
  • Jurisdiction-specific rules and mid-year changes may not be reflected.
  • A model output is not a substitute for a professional review of your position.

Risk & accuracy notice. Figures produced here are estimates derived from the inputs you supply. They are not a forecast, an offer, or a guarantee of any outcome, and no result should be read as a promise of future performance. Rates, thresholds and statutory rules change, and your own circumstances may differ materially from the assumptions modelled.

Practical Use Cases

Deciding whether to realise a gain

Compute the full burden, not the bracket. At 28.10% the after-tax proceeds are $129,420 on a $180,000 gain — which may change whether the sale is worth making at all.

Valuing tax-loss harvesting

Each dollar of loss offsets a dollar of gain across federal, NIIT and state simultaneously, so it is worth the combined rate. Harvesting $40,000 saves $11,240 here.

Comparing a taxable sale with a charitable donation

Donating appreciated securities held over a year avoids the gain entirely while still deducting market value. Against a 28.10% burden that is a substantial saving — model the alternative with the Capital Gains Calculator.

Methodology & Editorial Standards

The engine stacks the long-term gain on top of ordinary taxable income and applies 2024 single-filer capital-gains bands of 0% to $47,025, 15% to $518,900 and 20% above. The Net Investment Income Tax applies 3.8% to the lesser of net investment income or the excess of modified AGI over $200,000 for single filers, which is the correct statutory formulation. State tax is applied as a flat rate to the full gain; most states tax capital gains as ordinary income, a minority offer partial exclusions, and nine levy no income tax at all. Collectibles taxed at 28%, unrecaptured Section 1250 gain at 25%, qualified small business stock exclusions and opportunity zone deferrals are outside scope. Harvested losses are assumed to offset gains directly; the $3,000 annual limit against ordinary income applies only to net losses. Not tax advice. The engine implements the standard published formula for this calculation. Inputs are validated for domain and sign before evaluation, and any undefined case returns an em-dash rather than a spurious value.

Computation runs in IEEE-754 double precision at full internal precision; rounding to two decimal places occurs strictly at the display layer, so no cumulative drift enters the result. All monetary outputs use accounting presentation — grouped thousands, two decimals, negatives in parentheses — so figures can be transcribed directly into a model or working paper. Division-by-zero and out-of-domain inputs return an em-dash rather than a misleading number.

This engine was reconciled against an independent reference implementation and hand-verified for the worked example above before release. Our full five-stage review process is published on the About Us page.

Imran S. Qureshi, CFA Head of Quantitative Modelling · ApexConverter

Cross-border taxation and treasury reporting across multiple jurisdictions. Last reviewed: 11 August 2026.

Disclaimer. This calculator is provided for informational and modelling purposes only and does not constitute financial, tax, legal, medical, or engineering advice. Verify all figures with a qualified professional before acting on them.


Capital Gains Tax Calculator — 20 Expert FAQs

20 analyst-written answers to the questions practitioners actually ask — optimised for voice and answer-engine retrieval.

What is my real capital gains tax rate?

Here 28.10%, not the 15% federal headline. The 3.8% Net Investment Income Tax and a 9.3% state rate add 13.10 points, taking $27,000 of federal tax to $50,580 in total.

What is the Net Investment Income Tax?

A flat 3.8% on the lesser of net investment income or the amount by which modified AGI exceeds $200,000 for single filers, $250,000 for joint. It applies to gains, dividends, interest and rents.

Do states tax capital gains?

Most tax them as ordinary income with no preferential rate — which is why the state layer is often larger than the federal one for high earners. Nine states levy no income tax and therefore none on gains.

How do capital gains stack with my income?

Gains sit on top of ordinary taxable income for the purpose of finding the band. With $195,400 of ordinary taxable income, the entire gain lands in the 15% band rather than touching the 0% band at all.

Is tax-loss harvesting worth it?

More than the headline suggests. Each dollar of loss removes a dollar from federal, NIIT and state simultaneously, so it is worth $0.28 here rather than $0.15. Harvesting $40,000 saves $11,240.

What is the wash sale rule?

Selling at a loss and buying a substantially identical security within 30 days before or after disallows the loss. It is added to the new basis instead, so the benefit is deferred rather than lost.

Can I offset gains with losses from a different asset?

Yes. Capital losses offset capital gains of either type, with short-term losses applied against short-term gains first. Net losses beyond that offset up to $3,000 of ordinary income annually and carry forward indefinitely.

Does the NIIT apply to my whole gain?

To the lesser of the gain or your MAGI excess over the threshold. Here MAGI exceeds $200,000 by $190,000, which is more than the $180,000 gain, so the full gain is subject to it.

How can I reduce capital gains tax?

Hold for more than a year to qualify for the preferential rates, harvest offsetting losses, donate appreciated securities directly, use tax-advantaged accounts, or spread realisations across years to stay in lower bands.

What about donating appreciated stock?

Donating securities held over a year avoids the gain entirely while deducting full market value. Against a 28.10% burden plus a deduction at your marginal rate, it is usually far better than selling and donating cash.

Do I pay capital gains tax on my home?

A principal residence has a $250,000 exclusion for single filers and $500,000 for joint filers, subject to ownership and use tests. Gains above the exclusion are taxed normally, including NIIT.

What is the 20% bracket threshold?

Taxable income above $518,900 for single filers in 2024, counting the gain stacked on ordinary income. Combined with NIIT that is a 23.8% federal rate before any state tax.

Are dividends taxed the same way?

Qualified dividends use the same 0/15/20 schedule and are also subject to NIIT. Ordinary dividends are taxed as regular income at your marginal bracket.

Should I sell before or after year end?

It depends on which year has lower other income, since gains stack. Deferring into a low-income year can move part of the gain into a lower band, and it delays the tax by a full year regardless.

Does this apply to crypto?

Yes. Digital assets are property for US tax purposes, so the same holding-period rules and rates apply. Note that the wash sale rule has historically not applied to crypto, though this is subject to legislative change.

Is this capital gains tax calculator free to use?

Yes. It is free, requires no account, and has no usage limits. ApexConverter is funded by contextual advertising, never by selling user data.

Is my data sent to a server?

No. The engine runs as Vanilla JavaScript inside your browser under our Zero-Server Client-Side Execution model. Your figures are computed locally and are never transmitted, logged, or stored.

How accurate is this calculator?

It applies the standard closed-form formula in IEEE-754 double precision, rounding only at the display layer. The engine is reconciled against an independent reference implementation before release.

Does it work on mobile?

Yes. The interface is mobile-first with numeric keypad hints and is tested down to a 320-pixel viewport with no horizontal scrolling.

Can I use it offline?

Largely, yes. Because computation is client-side, the page continues to calculate without a network connection once it has loaded.

Related Tax Engines