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.
On this page10 sections
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 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.
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)Worked example: selling stock held more than one year
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.
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 Rate | Single — Taxable Income | Married Filing Jointly — Taxable Income |
|---|---|---|
| 0% | $0 – $47,025 | $0 – $94,050 |
| 15% | $47,026 – $518,900 | $94,051 – $583,750 |
| 20% | Over $518,900 | Over $583,750 |
| +3.8% NIIT | MAGI over $200,000 | MAGI 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.
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 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.
Capital gains tax terms defined
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.