Capital Gains Tax Calculator

Estimate federal capital gains tax for several sales at once using taxable income, filing status, basis adjustments, and holding period.

Advanced options
Income used for the NIIT estimate
Calculating...
Estimated federal tax for all listed sales
Net gain across all listed sales
Effective federal rate on positive net gain
Gain or loss for each listed sale
Federal capital gains tax before NIIT
Extra NIIT amount
Short-term gain counted for tax
Long-term gain counted for tax
Estimate notes and warnings
Did we solve your problem today?


How to use our Capital Gains Tax Calculator

  1. Choose your Filing status as it will appear on your federal tax return.
  2. Enter Taxable income before these sales, not gross pay. Use income after deductions and before the sales in the list.
  3. Fill the Sales list with one sale per line or separate sales with semicolons. Use this order: name, purchase $, sale $, basis adjustment $, term.
  4. Open Advanced options only if you want to change the Include NIIT check, Other net investment income, or MAGI adjustment.
  5. After you calculate, compare Gain or loss for each listed sale with your records. A wrong sign in the basis adjustment or a short/long term mistake can change the tax estimate.
Example inputs for Capital Gains Tax Calculator
Example inputs for Capital Gains Tax Calculator

Definitions

Taxable income before these sales: Income after deductions, before adding the gains or losses from the sales list.

Sales list: The set of sale entries used together. Each entry needs a name, purchase price, sale price, basis adjustment, and term.

Basis adjustment: An amount added to or subtracted from purchase price before gain is found. A positive adjustment raises basis and lowers gain.

Adjusted basis: Purchase price plus basis adjustment.

Short-term: A sale term for an asset held 1 year or less. This calculator taxes short-term gain through ordinary income brackets.

Long-term: A sale term for an asset held more than 1 year. This calculator applies the 0%, 15%, and 20% long-term capital gains brackets.

NIIT: Net Investment Income Tax, an extra 3.8% federal tax that can apply when income is above the filing-status threshold.

MAGI: Modified adjusted gross income. The NIIT check uses an estimated MAGI amount based on the income and adjustment you enter.

Effective federal rate on net gain: Estimated federal tax for all listed sales divided by a positive net gain, shown as a percent.


2024 Long-Term Capital Gains RatesFederal rate bands for taxable income by filing status. Short-term gains use ordinary income brackets instead of these bands.2024 Long-Term Capital Gains RatesFederal rate bands for taxable income by filing status15% rate20% rate0 %518900 %999999 %Taxable income threshold by filing status ($)
2024 Long-Term Capital Gains Rates
Short-term gains use ordinary income brackets instead of these bands.

Common mistakes and quick fixes

Mistake: Using gross wages in Taxable income before these sales .
Fix: Enter taxable income after deductions and before the listed capital gains.

Mistake: Putting the Sales list columns in the wrong order.
Fix: Use name, purchase $, sale $, basis adjustment $, term for each sale.

Mistake: Entering a positive basis adjustment in Sales list when the adjustment should lower basis.
Fix: Use a negative basis adjustment if it lowers basis, and check Gain or loss for each listed sale .

Mistake: Typing held time or a date instead of short or long in Sales list .
Fix: Enter exactly short or long for the term column.

Mistake: Turning off Include NIIT check for a high-income case without checking whether NIIT might apply.
Fix: Leave Include NIIT check on unless you know you want to exclude the extra NIIT estimate.

Mistake: Leaving Other net investment income or MAGI adjustment at 0 when those amounts matter for NIIT.
Fix: Enter the best available amounts so Extra NIIT amount is not understated.


Limitations & Key Assumptions / Boundary Conditions

  • The estimate uses 2024 federal ordinary income tax brackets and 2024 long-term capital gains brackets.
  • It estimates federal tax tied to the listed sales only. It does not estimate your full federal tax return.
  • State tax, local tax, estimated tax penalties, and withholding are not included.
  • Special rules are not included, such as the primary residence exclusion, 1031 exchanges, wash sale adjustments, collectibles rates, qualified small business stock, installment sales, and depreciation recapture.
  • If all listed sales net to a loss, the calculator shows $0 capital gains tax and the negative net gain. It does not estimate the capital loss deduction against other income.
  • The NIIT amount is an estimate because actual NIIT depends on detailed Form 8960 net investment income and MAGI rules.
  • The calculator trusts the term you enter in the Sales list. It does not verify actual purchase and sale dates.

Methodology

How each sale is handled

Each sale is read from the Sales list as name, purchase price, sale price, basis adjustment, and term. Commas, spaces, and a leading $ are ignored in money cells, but formulas and ranges are rejected. Purchase price and sale price must be zero or more. Basis adjustment may be positive or negative.

adjusted_basis = purchase_price + basis_adjustment

sale_gain = sale_price - adjusted_basis

Losses stay negative. They are not clamped to zero because they can offset gains from other listed sales.

How gains are netted

Short-term sale gains and losses are totaled separately from long-term sale gains and losses.

short_net = total short sale gains and losses

long_net = total long sale gains and losses

If both totals are positive, both are taxed. If one total is a loss and the other is a gain, the loss offsets the gain before tax is estimated. If both totals are zero or negative, taxable short-term gain and taxable long-term gain are both set to 0 for this capital gains tax estimate.

How federal tax is estimated

Short-term gain counted for tax is stacked on top of Taxable income before these sales and taxed through the 2024 ordinary income tax brackets for the selected Filing status.

short_tax = ordinary_tax(income + taxable_short) - ordinary_tax(income)

Long-term gain counted for tax is stacked after ordinary taxable income and any taxable short-term gain. The calculator applies the 2024 long-term capital gains brackets at 0%, 15%, and 20%.

base_income = ordinary_taxable_income + taxable_short

long_tax = long_part_0 * 0 + long_part_15 * 0.15 + long_part_20 * 0.20

federal_tax_before_niit = short_tax + long_tax

If Include NIIT check is Yes, the calculator estimates NIIT at 3.8% of the smaller of net investment income or income above the NIIT threshold for the filing status.

estimated_MAGI = ordinary_taxable_income + taxable_short + taxable_long + other_net_investment_income + magi_adjustment

niit_tax = 0.038 * max(0, min(taxable_short + taxable_long + other_net_investment_income, estimated_MAGI - NIIT_threshold))

estimated_federal_tax_all_sales = federal_tax_before_niit + niit_tax

effective_rate_on_net_gain = estimated_federal_tax_all_sales / positive_net_gain * 100

When net gain is zero or negative, Effective federal rate on net gain is shown as N/A to avoid dividing by zero or by a loss.

Mini-example

A single filer with $50,000 of taxable income enters two sales: Fund A with a $10,000 purchase price, $16,000 sale price, $0 basis adjustment, and long term; Coin B with a $5,000 purchase price, $6,500 sale price, $0 basis adjustment, and short term. The long-term gain is $6,000 and the short-term gain is $1,500, so net gain across all listed sales is $7,500. The $1,500 short-term gain is taxed at the next ordinary bracket portion, producing $330 of short-term tax. The $6,000 long-term gain is taxed at 15%, producing $900 of long-term tax. NIIT is $0 in this example, so Estimated federal tax for all listed sales is $1,230 and the effective federal rate on net gain is 16.4%.