Capital Gains Tax Calculator

Calculate short-term vs long-term capital gains tax on stocks, crypto, and real estate, including 3.8% NIIT.

Calculate federal taxes owed on the sale of investments, stocks, cryptocurrency, or capital assets. Distinguishes between short-term capital gains (assets held 1 year or less, taxed at ordinary rates) and preferential long-term capital gains (0%, 15%, 20%), plus the 3.8% Net Investment Income Tax (NIIT).

How this calculator works

Long-Term Gain Rate: 0% up to $48,350 (Single) / $96,700 (MFJ); 15% up to $533,400 / $600,050; 20% over. NIIT = 3.8% on lesser of Net Investment Income or MAGI over $200k / $250k.

Key benefits

Assumptions & exclusions

Frequently asked questions

How long do I have to hold an asset to qualify for long-term capital gains rates?

You must hold the asset for more than one year (at least 366 days) from the date of acquisition. Assets sold on or before the one-year mark are classified as short-term and taxed at higher ordinary federal income tax rates.

Who pays the 3.8% Net Investment Income Tax (NIIT)?

The 3.8% NIIT applies to individuals with Modified Adjusted Gross Income (MAGI) exceeding $200,000 for single filers or $250,000 for married couples filing jointly, levied on capital gains, dividends, interest, and passive rental income.

What is the difference between short-term and long-term capital gains?

Short-term gains come from assets held one year or less and are taxed at ordinary income rates. Long-term gains, from assets held more than one year, qualify for lower preferential rates of 0%, 15% or 20% depending on your total taxable income and filing status.

How is my capital gain calculated?

Your gain is the amount you sell the asset for minus your cost basis — generally what you paid for it, plus certain costs. Only the gain is taxed, not the full sale proceeds, so keeping records of your purchase price and improvements matters.

Can capital losses reduce my tax?

Yes. Capital losses first offset capital gains of the same type, then the other type. If losses still remain, up to $3,000 a year can offset other income, and any leftover loss carries forward to future tax years.

Do states tax capital gains too?

Most states tax capital gains as regular income, on top of the federal tax estimated here, though rates and any special treatment vary by state. A few states have no income tax at all. Budget for both layers before spending sale proceeds.

Formula-Based Calculator · By QalcTools Editorial Team. Formulas tested against independent reference values · Content reviewed November 2026 by the QalcTools Editorial Team.

Methodology note: Internal Revenue Code § 1(h) and § 1411 (Net Investment Income Tax) guidelines.

Related calculators

Category: Taxes & Income Calculators

About this calculator

Selling an investment for more than you paid creates a capital gain, and the tax on that gain depends less on the gain itself than on two surrounding facts: how long you held the asset, and how much other taxable income you have. Hold longer than a year and preferential rates of 0, 15 or 20 percent can apply; sell sooner and the gain is taxed like wages. Higher incomes can also attract an extra 3.8 percent tax on investment income. This calculator combines your gain, your holding period in days, and your other taxable income to estimate the federal tax and what you keep after paying it.

How it works

You enter the size of the gain and how many days you held the asset; the page takes your other taxable income from the federal tax calculation alongside it, together with your filing status. More than 365 days makes the gain long-term in the tool, and anything shorter makes it short-term. Short-term gains are taxed at a flat approximate ordinary rate. Long-term gains are matched against the preferential thresholds for your filing status to pick a single rate of 0, 15 or 20 percent. The tool then checks whether your combined income passes the threshold for the 3.8 percent net investment income tax, adds any amount due, and reports the total tax and your after-tax proceeds.

The formula, explained

Long-term tax = Gain × rate (0%, 15% or 20% by total income); NIIT = 3.8% × min(Gain, Income + Gain − threshold); Total = Long-term tax + NIIT

The engine first classifies the gain: holding period above 365 days is long-term, otherwise short-term. A short-term gain is taxed at a flat 22 percent, or 24 percent when your other taxable income exceeds $103,350 — an approximation of ordinary rates rather than a bracket-by-bracket calculation. For a long-term gain it adds your other taxable income to the gain and compares that total with the 2026 thresholds — $48,350 and $533,400 for single filers, $96,700 and $600,050 for joint filers — then applies one flat rate (0, 15 or 20 percent) to the entire gain. Finally it computes the net investment income tax: 3.8 percent of the smaller of the gain or the amount by which combined income exceeds $200,000 (single) or $250,000 (joint). Totals are rounded to cents.

Inputs and variables

VariableMeaningExample
Capital Gain AmountThe profit on the sale — what you received minus your cost. Enter the gain itself, not the full sale price, because only the profit is taxed.$45,000
Holding Period (days)How many days you owned the asset before selling. Crossing from 365 to 366 days moves the gain from short-term to long-term treatment in this tool.500 days
Ordinary Taxable IncomeYour other taxable income for the year, taken from the federal calculation on the page. It decides which long-term rate applies and whether the extra investment tax is triggered.$220,000
Filing StatusSingle or married filing jointly in this engine’s thresholds. Joint filers get roughly double the 0 percent threshold and a higher investment-tax threshold.Single

Worked example

A single filer with $220,000 of other taxable income sells stock held for 500 days at a $45,000 gain, and wants the federal tax including the extra investment income tax.

  1. Holding check: 500 days is more than 365, so the gain is long-term and qualifies for the preferential rates.
  2. Rate selection: combined income is $220,000 + $45,000 = $265,000. That is above the $48,350 zero-rate threshold and below the $533,400 top threshold for single filers, so the 15% rate applies.
  3. Preferential tax: $45,000 × 15% = $6,750.
  4. Net investment income tax: combined income exceeds the $200,000 single threshold by $65,000, which is more than the gain, so the full gain is subject: $45,000 × 3.8% = $1,710.
  5. Total tax: $6,750 + $1,710 = $8,460. After-tax proceeds: $45,000 − $8,460 = $36,540.

Federal tax of $8,460 on the $45,000 long-term gain — $6,750 at the 15% preferential rate plus $1,710 of net investment income tax — leaving $36,540 after tax.

Two lessons stand out. First, the 500-day hold was worth a great deal: the same gain sold within a year would have been taxed at the engine’s 24 percent short-term approximation, or $10,800 before any extra tax. Second, at this income the 3.8 percent surcharge is not a footnote — it adds $1,710, lifting the effective rate on the gain to 18.8 percent. High earners estimating a sale from the headline 15 percent rate alone will consistently under-reserve for the real bill.

Understanding your results

The applied rate line tells you which regime your sale fell into, but read it with the combined-income logic in mind: in this engine your other income plus the gain chooses one flat rate for the whole gain. That makes the estimate easy to follow — and means a gain that pushes combined income just over a threshold is taxed entirely at the higher of the two rates here. The separate investment-tax line deserves its own look, because it stacks on top of the preferential rate and is easy to miss when you only remember 0, 15 and 20.

After-tax proceeds are the figure to plan around if the sale funds something specific, like a house deposit. Compare scenarios by changing one input: sell a few weeks later to cross the one-year line, or split a large sale across two tax years to change the combined income in each. The tool makes the holding-period effect especially stark — a single day around the 365-day mark can move the entire gain between the short-term approximation and the preferential schedule.

Assumptions and limitations

This is a simplified federal estimate, and its simplifications matter. Real long-term gains stack on top of ordinary income bracket by bracket, so part of a gain can genuinely fall in the 0 percent band while the rest is taxed at 15 percent; this engine instead applies a single rate to the whole gain based on combined income. Short-term gains are approximated at a flat 22 or 24 percent rather than your true marginal bracket. State taxes on gains, which many states levy as ordinary income, are not included, and neither are loss carryforwards, offsetting losses, wash-sale adjustments, or special categories such as collectibles. Use the result to size a reserve and to compare timing choices, then confirm the final figure on your actual return.

Common mistakes to avoid

Sources