Capital Gains Tax Calculator (Long-Term)

This professional long term capital gains tax calculator estimates your U.S. federal tax on assets held for more than one year. It’s designed for investors, founders, and advisors who need an accurate, mobile-first tool that applies the 0% / 15% / 20% preferential rates, supports loss offsets, and optionally includes the 3.8% Net Investment Income Tax (NIIT).

Calculator

Rates and thresholds depend on your filing status.
Used to stack your gain into the 0%, 15%, and 20% brackets.
Gross amount you received from the sale.
Your original cost, adjusted for splits, return of capital, etc.
Added to basis to reduce the gain.
Reduces your net long‑term gain (not below zero).

Set to “Yes” and enter MAGI to estimate NIIT.

If blank, we approximate MAGI as taxable income + this gain.
Interest, dividends, rents, passive income, etc.

Results

Values update automatically as you type. Currency shown in USD.

Net long‑term gain $0.00
LTCG tax at preferential rates $0.00
Net Investment Income Tax (3.8%) $0.00
Total federal tax on this gain $0.00
Effective tax rate on gain 0.00%
After‑tax proceeds $0.00
This tool estimates U.S. federal tax only for long-term gains. It does not account for state/local taxes, depreciation recapture, collectibles/Section 1202/qualified dividends nuances, wash sales, basis tracking complexities, or AMT. Consult a qualified tax professional.

Data Source and Methodology

Authoritative data are sourced from the IRS:

Tutti i calcoli si basano rigorosamente sulle formule e sui dati forniti da questa fonte.

The Formula Explained

Net long‑term gain:

$$
G=\max\!\big(0,\; (P - B - C) - L \big)
$$

Preferential LTCG stacking across brackets (tax year 2024):

$$
\begin{aligned}
x &= \text{taxable income excluding this gain} \\
T_0, T_{15} &= \text{upper bounds for 0% and 15% brackets (by filing status)} \\
g_0 &= \min\!\big(G,\; \max(0, T_0 - x)\big) \\
g_{15} &= \min\!\big(G - g_0,\; \max(0, T_{15} - \max(x, T_0))\big) \\
g_{20} &= \max\!\big(0,\; G - g_0 - g_{15}\big) \\
\text{LTCG Tax} &= 0\cdot g_0 + 0.15\cdot g_{15} + 0.20\cdot g_{20}
\end{aligned}
$$

Net Investment Income Tax (optional):

$$
\begin{aligned}
\text{NII} &= G + \text{Other NII} \\
\text{MAGI} &\approx \text{user MAGI (or } x + G \text{ if not provided)} \\
T_{\text{NIIT}} &= \text{NIIT threshold (}200k~\text{Single/HOH},~250k~\text{MFJ/QW},~125k~\text{MFS)} \\
\text{NIIT base} &= \min\!\big(\text{NII},\; \max(0, \text{MAGI} - T_{\text{NIIT}})\big) \\
\text{NIIT} &= 0.038 \cdot \text{NIIT base}
\end{aligned}
$$

Glossary of Variables

Tax year
The calendar year of the transaction; this tool uses 2024 federal brackets.
Filing status
Your federal filing category: Single, Married Filing Jointly (MFJ), Married Filing Separately (MFS), Head of Household (HOH), or Qualifying Surviving Spouse (QW).
Taxable income (excluding this gain)
Taxable income before adding the current long-term gain; used to place your gain into the LTCG brackets.
Sale proceeds (P)
Total amount received from the sale.
Purchase price / Cost basis (B)
Adjusted cost basis of the asset.
Improvements & selling costs (C)
Capital improvements and transaction costs added to basis to reduce the gain.
Capital loss carryover (L)
Available capital losses applied to offset this gain.
Net long‑term gain (G)
Taxable long‑term gain after adjustments and loss offset.
Other net investment income
Other NII (interest, dividends, rents, passive income) for NIIT calculation.
Modified AGI (MAGI)
AGI adjusted for certain items, used to determine NIIT applicability.
LTCG tax
Tax calculated by allocating the gain across the 0%, 15%, and 20% brackets.
NIIT
3.8% surtax on the lesser of NII or MAGI excess over the NIIT threshold for your filing status.
Total federal tax on this gain
LTCG tax plus NIIT (if applicable).
Effective tax rate on gain
Total federal tax divided by the net long‑term gain.
After‑tax proceeds
Sale proceeds minus total federal tax on the gain.

How It Works: A Step‑by‑Step Example

Scenario: You are Single in 2024 with $85,000 of taxable income (excluding this sale). You sell stock for $250,000 that you bought for $150,000 and pay $5,000 in selling costs. You have $2,000 of capital loss carryover. NIIT is off.

  1. Compute net long‑term gain: G = (250,000 − 150,000 − 5,000) − 2,000 = 93,000.
  2. Determine stacking: x = 85,000. For Single in 2024, T0 = 47,025; T15 = 518,900. - 0% band available: max(0, 47,025 − 85,000) = 0 → g0 = 0. - 15% band capacity: 518,900 − 85,000 = 433,900 → g15 = min(93,000, 433,900) = 93,000. - g20 = 0.
  3. LTCG tax = 0·g0 + 0.15·g15 + 0.20·g20 = 0 + 13,950 + 0 = $13,950.
  4. Total federal tax on the gain = $13,950. Effective rate = 13,950 / 93,000 ≈ 15.0%.
  5. After‑tax proceeds = 250,000 − 13,950 = $236,050.

Turning NIIT on with MAGI $250,000 (Single) and no other NII would add 3.8% × min(93,000, 250,000 − 200,000 = 50,000) = $1,900 of NIIT.

Frequently Asked Questions (FAQ)

Do the 0% / 15% / 20% rates apply to all long‑term gains?

Generally yes, but special categories exist (e.g., collectibles at 28%, unrecaptured Section 1250 gain up to 25%). Those are outside the scope of this tool.

Are qualified dividends treated the same as long‑term gains?

Often yes; qualified dividends share the same preferential brackets. This calculator focuses on long‑term capital gains.

What if my loss carryover exceeds the gain?

The calculator caps the loss used at your current gain so the net long‑term gain doesn’t drop below zero.

Where can I find the official thresholds?

See IRS Rev. Proc. 2023-34 for 2024 thresholds and IRS Topic No. 409 for capital gains fundamentals.

Does the calculator handle short‑term gains?

No. Short‑term gains are typically taxed at ordinary income rates and are not modeled here.

Can this replace professional advice?

No. It provides educational estimates only. Engage a tax professional for personalized guidance.

Strumento sviluppato da Ugo Candido,. Contenuti verificati da,.
Ultima revisione per l'accuratezza in data: .