Tax calculator

Free capital gains tax calculator

Enter your gain, holding period, and income — this capital gains tax calculator applies the correct 2024 long-term (0/15/20%) or short-term ordinary-income rate and flags the NIIT if it applies, updated live, as you type.

InputsLive
Investment cost
$
Total gain (revenue / proceeds)
$
Include the original investment amount if it was returned.
Annual cash flow (for payback)
$/yr
Optional. Used to calculate simple payback period.
Result
ROI
50%
Net gain: $2,500 · Payback: 2.5 yrs
ROI50%
Net gain$2,500
Total gain$7500
Payback2.5 yrs

ROI = (gain − cost) ÷ cost × 100. This is simple ROI and does not account for time value of money.

Results are estimates. Consult a professional.

How it's calculated

How the capital gains tax calculator works

Capital gains tax depends on two variables: how long you held the asset and your total taxable income. Assets held longer than one year qualify for preferential long-term capital gains (LTCG) rates of 0%, 15%, or 20%. Assets held one year or less are short-term gains taxed as ordinary income — the same rates as wages. The net investment income tax (NIIT) may add an additional 3.8% on top.

Capital Gain = Sale Price Cost Basis (purchase price + improvements depreciation)
Short-Term Gain → taxed at ordinary income brackets (10%–37%)
Long-Term Gain → taxed at 0% / 15% / 20% based on taxable income
NIIT (3.8%) → applies to lesser of: net investment income OR MAGI above $200k (single) / $250k (MFJ)

Short-term gains are stacked on top of your ordinary income to determine your bracket — they do not get their own separate rate schedule. Long-term gains are also stacked on ordinary income to find the applicable LTCG rate, but the gains themselves are taxed at the lower preferential rate, not the ordinary rate.

IRS Publication 550 — Investment Income and Expenses (2024)
Example

Worked example: selling stock held more than one year

Example: Single filer, $60,000 ordinary income, $20,000 long-term gain

Alex is a single filer with $60,000 in wages (taxable income after deductions) and sells stock purchased 18 months ago for a $20,000 long-term capital gain. His total taxable income is $80,000. In 2024, the 15% LTCG rate applies to single filers with taxable income from $47,025 to $518,900.

Taxable Income (wages only) = $60,000
Total Taxable Income = $60,000 + $20,000 LTCG = $80,000
LTCG rate: $80,000 > $47,025 → 15% rate applies to the gain
Federal Capital Gains Tax = $20,000 × 0.15 = $3,000
NIIT check: MAGI $80,000 < $200,000 single threshold → no NIIT
$3,000
Alex's federal capital gains tax on a $20,000 long-term gain — an effective rate of 15%, compared to 22% he would pay on the same amount as ordinary income.
Quick reference

2024 long-term capital gains rates by taxable income

The table below shows 2024 long-term capital gains tax rates for the two most common filing statuses. Qualified dividends — dividends from domestic corporations and qualifying foreign corporations held for the required period — are taxed at the same preferential rates as long-term capital gains.

LTCG RateSingle — Taxable IncomeMarried Filing Jointly — Taxable Income
0%$0 – $47,025$0 – $94,050
15%$47,026 – $518,900$94,051 – $583,750
20%Over $518,900Over $583,750
+3.8% NIITMAGI over $200,000MAGI over $250,000

Source: IRS Rev. Proc. 2023-34 (2024 LTCG brackets). Short-term gains are taxed at ordinary income rates (10%–37%). The 3.8% NIIT applies separately to the lesser of net investment income or MAGI above the threshold.

Practical tips

Tips for minimizing capital gains tax

Capital gains tax is one of the most controllable taxes in the US system because you largely choose when to realize gains. These strategies are widely used by financial advisors and tax planners to reduce the tax bill on investment portfolios.

  • Hold for more than one year — The difference between a short-term gain (taxed at up to 37%) and a long-term gain (taxed at 0%–20%) is the single largest lever in capital gains planning. Waiting one day beyond the one-year mark to sell can dramatically reduce your tax bill.
  • Harvest tax losses to offset gains — Tax-loss harvesting sells underperforming positions to generate capital losses, which directly offset capital gains dollar-for-dollar. Up to $3,000 of excess losses per year can offset ordinary income, and unused losses carry forward indefinitely. Watch the 30-day wash-sale rule: buying a substantially identical security within 30 days before or after the sale disallows the loss.
  • Use the 0% bracket for lower-income years — If your taxable income falls below $47,025 (single) or $94,050 (MFJ) in 2024, long-term gains in that range are taxed at 0%. This creates planning opportunities in early retirement years, gap years, or years with large deductions — you can realize gains at zero cost.
  • Donate appreciated stock instead of selling it — Donating long-term appreciated shares directly to a qualified charity or donor-advised fund eliminates the capital gains tax entirely while generating a deduction equal to the fair market value. This is far more efficient than selling the stock and donating cash.
  • Consider Opportunity Zone funds for large gains — Gains reinvested in a Qualified Opportunity Zone (QOZ) fund within 180 days of the sale can defer federal capital gains tax until 2026 and eliminate gains on QOZ appreciation held 10+ years. Complexity and illiquidity make this strategy appropriate only for sophisticated investors with large gains.
Accuracy & limits

Accuracy and limitations

This calculator estimates federal capital gains tax for common scenarios. It does not model state capital gains taxes (California taxes all gains as ordinary income at rates up to 13.3%; most other states follow a similar approach). It also does not account for the alternative minimum tax (AMT), depreciation recapture on real estate (taxed at up to 25%), Section 1202 exclusions for qualified small business stock (QSBS), installment sale treatment, or carryover losses from prior years.

The cost basis calculation for inherited assets (stepped-up basis), gifts (carryover basis), and stock compensation (RSUs, ISOs, NQSOs) involves complex basis-tracking rules that this calculator does not address. Real estate sales may involve the Section 121 exclusion ($250,000/$500,000 for a primary residence) as well as depreciation recapture on rental property. Consult a CPA or tax attorney for investment sales involving these situations.

Glossary

Capital gains tax terms defined

The profit from selling a capital asset (stocks, bonds, real estate, business interests) for more than its cost basis. A capital loss occurs when the sale price is below basis.
The original purchase price of an asset plus any acquisition costs (commissions, fees), capital improvements, and adjustments for reinvested dividends or return of capital. Basis is subtracted from the sale price to determine the gain.
The length of time you owned the asset before selling. Assets held more than one year qualify for long-term rates. The holding period begins the day after purchase and ends on the day of sale.
A 3.8% surtax imposed by the ACA on the lesser of net investment income or the amount by which modified AGI exceeds $200,000 (single) or $250,000 (MFJ). These thresholds are not inflation-indexed.
The deliberate sale of securities at a loss to offset capital gains, reducing the current tax bill. The wash-sale rule (IRC §1091) disallows the loss if a substantially identical security is purchased within 30 days before or after the sale.
Dividends paid by domestic corporations or qualifying foreign corporations on stock held for a required minimum period. Taxed at the same preferential 0%/15%/20% rates as long-term capital gains — not at ordinary income rates.
When a depreciable asset (rental property, equipment) is sold, previously claimed depreciation deductions are "recaptured" and taxed at up to 25% (Section 1250 unrecaptured gain for real estate) — a higher rate than the standard 0%/15%/20% LTCG rates.
About

About this capital gains tax calculator

This calculator runs entirely in your browser — nothing you enter is sent to any server.

Browse more in our tax calculators, or explore the complete library on the free calculators page.

Questions

Frequently asked questions about the free capital gains tax calculator

A capital gains tax calculator is a free online tool that helps you calculate tax on long-term or short-term capital gains. Long-term (>1 yr): 0/15/20% rates. Short-term: ordinary income. It runs entirely in your browser with instant results and no sign-up.
No — these are simplified estimates based on 2024 brackets. Real tax filing requires considering all your deductions, credits, AMT, state taxes, and the latest IRS guidance. Use professional tax software or a CPA for filing.
Marginal rate is what you pay on your next dollar of income. Effective rate is total tax ÷ total income — typically much lower because of the progressive brackets and deductions.
Federal only. State tax varies by jurisdiction; some states have no income tax (TX, FL, WA, etc.), others up to 13%+ (CA, NY). Add state tax separately based on your state.

Want a calculator built for your business?

Customize any of our 400+ tools to match your brand, or commission a new one tailored to how your business actually calculates — pricing, payroll, quotes, anything. Deployed on your domain, math runs in your visitors' browsers.