{
  "id": "capital-gains-tax",
  "version": "a9906e7f85bd",
  "status": "published",
  "name": "Capital Gains Tax Calculator",
  "question": "How much capital gains tax will I pay?",
  "summary": "Estimates the 2026 federal capital gains tax on a sale of stock, a home you do not exclude, or other property: short-term at ordinary rates, long-term at 0%, 15%, or 20%, plus the 3.8% net investment income tax.",
  "category": "finance",
  "subcategory": "tax-and-pay",
  "url": "https://www.acalculator.org/finance/capital-gains-tax-calculator",
  "markdown": "https://www.acalculator.org/finance/capital-gains-tax-calculator.md",
  "kind": "function",
  "method": "Gain = sale price − basis. Tax on the gain = Form 1040 tax with the gain − Form 1040 tax without it, both with the standard deduction: a long-term gain at 0%, 15%, or 20% by the Qualified Dividends and Capital Gain Tax Worksheet, a short-term gain at the ordinary rates, a loss limited to $3,000 ($1,500 separately), plus the 3.8% net investment income tax.",
  "assumptions": [
    "An estimate for tax year 2026 (IRS Rev. Proc. 2025-32), not tax advice.",
    "Other income is ordinary income such as wages, with the standard deduction and no credits; it is not earned income for the earned income credit.",
    "Not modelled: the 25% rate on unrecaptured section 1250 gain (depreciation on real estate), the 28% rate on collectibles, the home sale exclusion ($250,000 or $500,000), carryover losses from earlier years, the alternative minimum tax, and state tax on the gain."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "basis": {
        "title": "Purchase price (cost basis)",
        "description": "What you paid for the asset, plus buying costs and improvements.",
        "type": "number",
        "x-unit": "USD",
        "minimum": 0,
        "maximum": 1000000000
      },
      "sale": {
        "title": "Sale price",
        "description": "What you received for the asset, less selling costs.",
        "type": "number",
        "x-unit": "USD",
        "minimum": 0,
        "maximum": 1000000000
      },
      "held": {
        "title": "Held for",
        "description": "How long you owned the asset: more than one year is long-term.",
        "type": "string",
        "enum": [
          "long",
          "short"
        ]
      },
      "status": {
        "title": "Filing status",
        "description": "Your federal filing status for the year.",
        "type": "string",
        "enum": [
          "single",
          "mfj",
          "mfs",
          "hoh",
          "qss"
        ]
      },
      "income": {
        "title": "Other income",
        "description": "Your other income for the year before deductions: wages, interest, and so on.",
        "type": "number",
        "x-unit": "USD",
        "minimum": 0,
        "maximum": 1000000000
      },
      "year": {
        "title": "Tax year",
        "description": "The tax year of the sale. A year with no published rates uses the latest year this site has.",
        "type": "integer",
        "minimum": 2026,
        "maximum": 2035
      }
    }
  },
  "outputs": {
    "tax": {
      "label": "Tax on the gain",
      "description": "Federal tax with the sale minus the tax without it; negative when a loss saves tax.",
      "format": "money"
    },
    "gain": {
      "label": "Gain or loss",
      "description": "Sale price minus cost basis.",
      "format": "money"
    },
    "rate": {
      "label": "Rate on the gain",
      "description": "The tax on the gain as a percent of the gain.",
      "format": "percent"
    },
    "niit": {
      "label": "Net investment income tax part",
      "description": "The 3.8% net investment income tax the sale adds.",
      "format": "money"
    },
    "afterTax": {
      "label": "Gain after tax",
      "description": "The gain minus the tax on it.",
      "format": "money"
    },
    "taxWith": {
      "label": "Total tax with the sale",
      "description": "Federal tax after credits with the sale.",
      "format": "money"
    },
    "taxWithout": {
      "label": "Total tax without the sale",
      "description": "Federal tax after credits without the sale.",
      "format": "money"
    },
    "ratesYear": {
      "label": "Rates of tax year",
      "description": "The tax year whose rates were used.",
      "format": "integer"
    },
    "notice": {
      "label": "Note",
      "description": "A note when another year’s rates were used.",
      "format": "text"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "basis": 30000,
      "sale": 50000,
      "held": "long",
      "status": "single",
      "income": 60000,
      "year": 2026
    },
    "outputs": {
      "tax": 2167.5,
      "gain": 20000,
      "rate": 10.8375,
      "niit": 0,
      "afterTax": 17832.5,
      "taxWith": 7190.5,
      "taxWithout": 5023,
      "ratesYear": 2026
    },
    "text": "Selling for $50,000.00 what cost $30,000.00 gives a $20,000.00 gain and $2,167.50 of federal tax."
  },
  "examples": [
    {
      "given": {
        "basis": 30000,
        "sale": 50000,
        "held": "long",
        "status": "single",
        "income": 60000
      },
      "expect": {
        "gain": 20000,
        "taxWithout": 5023,
        "taxWith": 7190.5,
        "tax": 2167.5,
        "rate": 10.8375
      },
      "source": "Qualified Dividends and Capital Gain Tax Worksheet: $5,550 at 0% (up to $49,450), $14,450 at 15%; hand calculation in content.mdx; Python 3 check in docs/progress/WP-82/fed.py (tax with the sale − tax without it)"
    },
    {
      "given": {
        "basis": 30000,
        "sale": 50000,
        "held": "short",
        "status": "single",
        "income": 60000
      },
      "expect": {
        "tax": 3753,
        "taxWith": 8776
      },
      "source": "Short-term gains are ordinary income: Tax Table rows $63,900 and $43,900; hand calculation in content.mdx; Python 3 check in docs/progress/WP-82/fed.py (tax with the sale − tax without it)"
    },
    {
      "given": {
        "basis": 100000,
        "sale": 200000,
        "held": "long",
        "status": "mfj",
        "income": 250000
      },
      "expect": {
        "tax": 18800,
        "niit": 3800,
        "taxWithout": 37468
      },
      "source": "15% on $100,000 plus the 3.8% net investment income tax on AGI over $250,000 (Form 8960); hand calculation in content.mdx; Python 3 check in docs/progress/WP-82/fed.py (tax with the sale − tax without it)"
    },
    {
      "given": {
        "basis": 15000,
        "sale": 10000,
        "held": "short",
        "status": "single",
        "income": 40000
      },
      "expect": {
        "gain": -5000,
        "tax": -360
      },
      "source": "A loss offsets ordinary income up to $3,000 (Schedule D line 21): 12% × 3,000 = 360 saved; Python 3 check in docs/progress/WP-82/fed.py (tax with the sale − tax without it)"
    }
  ],
  "sources": [
    "IRS, Rev. Proc. 2025-32 (Internal Revenue Bulletin 2025-45), sections 4.01 (rate tables), 4.03 (capital gains breakpoints), and 4.14 (standard deduction). https://www.irs.gov/irb/2025-45_IRB",
    "IRS, 2025 Instructions for Form 1040: Qualified Dividends and Capital Gain Tax Worksheet (line 16). https://www.irs.gov/instructions/i1040gi",
    "IRS, Topic no. 409, Capital gains and losses. https://www.irs.gov/taxtopics/tc409",
    "IRS, Instructions for Form 8960, Net Investment Income Tax. https://www.irs.gov/instructions/i8960"
  ],
  "related": [
    "income-tax",
    "tax-bracket",
    "effective-tax-rate",
    "agi"
  ],
  "changelog": []
}
