Capital Gains Tax Calculator

Capital gains tax depends on three things: how long you held the asset (long-term vs short-term), how much you made (the gain), and your total income (which determines your bracket). Long-term gains (held 1+ year) get preferential rates of 0%, 15%, or 20%. Short-term gains are taxed as ordinary income at 10-37%. High earners may also owe the 3.8% Net Investment Income Tax (NIIT). Our calculator handles all 2024 federal brackets for single, married filing jointly, and head of household, plus optional state tax.

star 4.9
auto_awesome AI
New

Capital Gains Tax Calculator calculator

receipt_longInvestment Details

paymentsTax Breakdown

Net Profit After Tax
$4,208
From $4,950 net gain
Long-term
Federal Tax
$743
Federal Rate
15%
State Tax
$0
NIIT (3.8%)
$0
Total Tax
$743
15% LTCG bracket

tips_and_updates Tips

  • Hold investments for at least 1 year + 1 day to qualify for long-term rates
  • Tax-loss harvesting: offset gains with realized losses to reduce tax
  • 0% LTCG bracket exists for low-to-middle earners — useful for retirees
  • NIIT (3.8%) applies above $200k single / $250k married — plan around it
  • Real estate primary home: $250k single / $500k married exclusion
  • Wash sale rule: can't claim loss if you rebuy same security within 30 days
  • Crypto is taxed like property, not currency — every trade is a taxable event
  • Hold tax-inefficient assets (REITs, bonds) in IRAs to avoid annual tax drag

How to Use the Capital Gains Tax Calculator

1

Enter purchase + sale price

How much you paid and what you sold for.

2

Set holding period in months

12+ months qualifies for long-term rates.

3

Choose filing status + income

Determines which LTCG bracket applies.

4

Add fees and state rate

Optional but improves accuracy.

5

Review tax breakdown

See federal, state, NIIT, and net profit after tax.

The Formula

Long-term gains (1+ year holding) get the lowest tax rates — 0% if you're in low tax brackets, 15% for most taxpayers, 20% for very high earners. Short-term gains (under 1 year) are taxed at your ordinary income rate, which can be much higher. This is why long-term investing is tax-efficient.

Net Gain = (Sale Price − Purchase Price − Fees); Tax = Net Gain × Federal Rate + Net Gain × State Rate + NIIT (if applicable)

lightbulb Variables Explained

  • Net Gain Profit after deducting purchase cost and selling fees
  • Federal Rate 0/15/20% LTCG, or 10-37% ordinary STCG
  • State Rate Varies by state (0% in TX/FL, 13.3% in CA)
  • NIIT 3.8% extra for MAGI over $200k single / $250k married

tips_and_updates Pro Tips

1

Hold investments for at least 1 year + 1 day to qualify for long-term rates

2

Tax-loss harvesting: offset gains with realized losses to reduce tax

3

0% LTCG bracket exists for low-to-middle earners — useful for retirees

4

NIIT (3.8%) applies above $200k single / $250k married — plan around it

5

Real estate primary home: $250k single / $500k married exclusion

6

Wash sale rule: can't claim loss if you rebuy same security within 30 days

7

Crypto is taxed like property, not currency — every trade is a taxable event

8

Hold tax-inefficient assets (REITs, bonds) in IRAs to avoid annual tax drag

Capital gains tax applies when you sell an asset — stocks, bonds, real estate, cryptocurrency, or collectibles — for more than your purchase price. The tax rate depends on how long you held the asset and your total taxable income. Short-term capital gains on assets held less than one year are taxed as ordinary income at rates from 10% to 37%. Long-term capital gains on assets held longer than one year receive preferential rates of 0%, 15%, or 20%. This capital gains tax calculator estimates your federal and state tax liability from any asset sale, factoring in your filing status, total income, holding period, purchase and sale prices, and transaction fees. It identifies whether your gain qualifies for long-term or short-term treatment, applies the correct 2024 federal bracket, adds the 3.8% Net Investment Income Tax (NIIT) for high earners, and includes optional state capital gains tax. The result shows your total tax bill, effective tax rate, and after-tax profit — the information you need to plan asset sales strategically and minimize your tax burden through timing, tax-loss harvesting, and other legitimate strategies.

2024 Long-Term Capital Gains Tax Brackets

For 2024, long-term capital gains tax rates depend on your taxable income and filing status. Single filers pay:

  • 0% on gains up to $47,025
  • 15% on gains from $47,026 to $518,900
  • 20% on gains above $518,900

Married filing jointly, the thresholds are $94,050 for the 0% bracket and $583,750 for the 20% bracket. These brackets are indexed for inflation annually.

The 0% bracket is particularly valuable for retirees and others with moderate income — if your total taxable income including gains stays below the threshold, you owe zero federal tax on those gains. Strategic tax planning involves 'filling up' the 0% bracket each year by selling appreciated assets in low-income years.

Additionally, taxpayers with modified adjusted gross income above $200,000 (single) or $250,000 (married filing jointly) owe an additional 3.8% NIIT on the lesser of net investment income or the excess over the threshold. Combined, the maximum federal rate on long-term gains is 23.8%.

Short-Term vs. Long-Term: The One-Year Holding Period Rule

The difference between short-term and long-term capital gains rates is substantial — up to 17.2 percentage points for high earners (37% ordinary rate vs. 20% long-term rate, before NIIT).

The holding period is measured from the day after you acquire the asset to the day you sell it. If you buy stock on January 15, 2024, you must sell on or after January 16, 2025 to qualify for long-term treatment.

For tax-loss harvesting, the wash sale rule prevents you from claiming a loss if you repurchase the same or substantially identical security within 30 days before or after the sale.

Real estate held over one year qualifies for long-term rates, but depreciation recapture on rental property is taxed at a flat 25% regardless of holding period. Cryptocurrency follows the same short-term and long-term rules as stocks.

For active traders making frequent short-term trades, the tax drag can significantly reduce after-tax returns — a 30% pre-tax return becomes approximately 19.5% after short-term capital gains tax for someone in the 35% bracket.

Strategies to Legally Minimize Capital Gains Tax

Several legitimate strategies can reduce or defer capital gains tax:

  • Tax-loss harvesting involves selling losing positions to offset gains — you can offset unlimited gains with losses, and deduct up to $3,000 of net losses against ordinary income annually, carrying forward excess losses indefinitely.
  • Donating appreciated stock to charity lets you deduct the full market value without paying capital gains tax.
  • Opportunity Zone investments allow deferral and partial exclusion of capital gains when invested in qualified zones.
  • The primary residence exclusion lets homeowners exclude up to $250,000 ($500,000 married) of gain when selling a home they have lived in for 2 of the past 5 years.
  • For real estate investors, 1031 like-kind exchanges defer capital gains tax by rolling proceeds into a replacement property within 180 days.
  • Installment sales spread the gain over multiple years, potentially keeping you in lower brackets.
  • Finally, holding appreciated assets until death provides a step-up in basis to the heir, permanently erasing the unrealized gain.

How to Calculate Capital Gains Tax: Cost Basis and Net Gain

Capital gains tax is owed on profit from selling an asset: sale price minus cost basis (what you paid plus acquisition and improvement costs and fees). That net gain is then taxed at short- or long-term rates depending on how long you held the asset.

Per the IRS, selling a stock bought for $10,000 and sold for $16,000 produces a $6,000 gain, taxed at your applicable rate.

This calculator computes net gain, federal and state tax, and the after-tax profit from your inputs.

The 0%, 15%, and 20% Long-Term Rates by Income

Assets held over one year qualify for preferential long-term capital gains rates. According to the IRS, for 2024 a single filer pays:

  • 0% on gains while taxable income stays under about $47,025
  • 15% up to roughly $518,900
  • 20% above that

Married thresholds are higher. This tiered structure means the same gain can be taxed at very different rates depending on your other income, and a large gain can push part of itself from the 15% into the 20% band.

Net Investment Income Tax: The Extra 3.8%

High earners owe an additional 3.8% Net Investment Income Tax (NIIT) on capital gains and other investment income. The IRS applies NIIT when modified adjusted gross income exceeds $200,000 (single) or $250,000 (married filing jointly).

Stacked on top of the 20% long-term rate, NIIT lifts the effective federal rate on large gains to 23.8%.

Many high-income sellers overlook NIIT and under-withhold, so this calculator includes it when your income crosses the threshold.

Cost Basis: What Counts and How to Track It

Accurate cost basis is the key to not overpaying capital gains tax. Basis includes:

  • the purchase price plus commissions
  • and for property, capital improvements that raise basis and reduce taxable gain
  • Reinvested dividends add to basis for funds and stocks

The IRS accepts several lot-identification methods (FIFO, specific identification), which affect the gain when you sell part of a holding.

Keeping records across the entire holding period prevents paying tax on 'gains' that are really returned capital.

Capital Gains on Real Estate: The Section 121 Home Exclusion

Selling a primary residence gets special treatment. Under IRS Section 121, a single filer can exclude up to $250,000 of gain and married couples up to $500,000, if they owned and lived in the home for at least two of the last five years.

Gain above the exclusion is taxed at long-term rates, and capital improvements raise basis to shrink taxable gain.

Investment property does not qualify but may defer tax through a 1031 like-kind exchange.

Capital Losses and Tax-Loss Harvesting

Losses offset gains dollar-for-dollar, and up to $3,000 of net capital loss can offset ordinary income each year, with the rest carried forward.

Tax-loss harvesting — deliberately selling losers to offset winners — is a standard year-end strategy.

The IRS wash-sale rule disallows the loss if you buy a substantially identical security within 30 days before or after the sale, so harvesting requires waiting out the window or buying a similar-but-not-identical asset.

State Capital Gains Tax

Most states tax capital gains as ordinary income, adding to the federal bill.

High-tax states like California tax gains at rates exceeding 13%, while states with no income tax — Florida, Texas, Washington (with exceptions), and others — impose no state capital gains tax.

Because state treatment varies so widely, the total tax on a large gain can differ by tens of thousands of dollars depending on residence. Factor your state rate in before assuming the federal rate is your full liability.

Common Capital Gains Tax Mistakes

The costliest mistakes are:

  • selling just before the one-year mark and losing long-term rates
  • forgetting NIIT
  • understating cost basis (overpaying tax)
  • and triggering the wash-sale rule while harvesting losses

Homeowners sometimes miss the Section 121 exclusion or fail to add improvements to basis. Investors also overlook that a large gain can raise adjusted gross income enough to affect other taxes and benefits.

Plan the timing, track basis carefully, and model the full federal-plus-state-plus-NIIT rate before selling.

Frequently Asked Questions

sell

Tags