Skip to main content
TaxArith

Worked example

Capital Gains Example: Two Sales, One Carryover, and NIIT

Priya, a fictional single investor, sold a long-held fund at a gain and a recently purchased stock at a loss in 2026. She wants to see netting, rate stacking, and a separately entered NIIT estimate before setting aside cash. This is an illustrative 2026 scenario, not personal tax advice.

10 minute read · 2026 U.S. federal tax

Follow the numbers

Net by holding period

Short-term and long-term investment transactions moving through loss netting, carryover, preferential rate stacking, and an optional NIIT layer.
  1. 1Calculate each transaction
  2. 2Net by holding period
  3. 3Apply rate stack and optional NIIT
Net by holding period is the editorial focus of this worked example.
Visual summary: Short-term and long-term investment transactions moving through loss netting, carryover, preferential rate stacking, and an optional NIIT layer. This page highlights: Net by holding period.

The planning question behind the numbers

Priya, a fictional single investor, sold a long-held fund at a gain and a recently purchased stock at a loss in 2026.

She wants to see netting, rate stacking, and a separately entered NIIT estimate before setting aside cash. The filing-status context is Single, and every tax value uses the 2026 production calculation.

Scenario profile

She wants to see netting, rate stacking, and a separately entered NIIT estimate before setting aside cash.

Priya, a fictional single investor, sold a long-held fund at a gain and a recently purchased stock at a loss in 2026.

Single

Prepared inputs, grouped by role

Tax context

  • $118,000 ordinary taxable income before transactions
  • $4,000 qualified dividends
  • $1,500 short-term loss carryover
  • NIIT enabled with $225,000 MAGI and $30,000 net investment income

Transactions

  • fund sale: $52,000 proceeds, $150 selling costs, $31,000 basis, long term
  • stock sale: $13,000 proceeds, $50 selling costs, $18,500 basis, short term
A fictional planning profile keeps the calculation concrete without implying personal advice.
Visual summary: Priya, a fictional single investor, sold a long-held fund at a gain and a recently purchased stock at a loss in 2026. Filing-status context: Single. Inputs: $118,000 ordinary taxable income before transactions; $4,000 qualified dividends; fund sale: $52,000 proceeds, $150 selling costs, $31,000 basis, long term; stock sale: $13,000 proceeds, $50 selling costs, $18,500 basis, short term; $1,500 short-term loss carryover; NIIT enabled with $225,000 MAGI and $30,000 net investment income.

Inputs the fictional taxpayer has prepared

The scenario uses the same inputs accepted by the calculator. No deduction, credit, basis amount, or eligibility conclusion is created inside the example.

  • $118,000 ordinary taxable income before transactions
  • $4,000 qualified dividends
  • fund sale: $52,000 proceeds, $150 selling costs, $31,000 basis, long term
  • stock sale: $13,000 proceeds, $50 selling costs, $18,500 basis, short term
  • $1,500 short-term loss carryover
  • NIIT enabled with $225,000 MAGI and $30,000 net investment income

Follow the calculation from input to result

TaxArith passes the fixture through calculateCapitalGainsTax. The values below use the site’s production formatting.

Production calculation journey

Values are generated by calculateCapitalGainsTax.

calculateCapitalGainsTax

  1. 1. Gross long-term gain$20,850.00
  2. 2. Gross short-term loss$5,550.00
  3. 3. Final net long-term gain$13,800.00
  4. 4. Regular federal income-tax impact$2,070.00
  5. 5. Estimated NIIT$950.00
  6. 6. Combined estimated tax impact$3,020.00
The short-term loss and carryover reduce the opposite long-term result before rates apply. NIIT is a separate modeled layer based entirely on the entered MAGI and NII.
Visual summary: Gross long-term gain: 20850; Gross short-term loss: 5550; Final net long-term gain: 13800; Regular federal income-tax impact: 2070; Estimated NIIT: 950; Combined estimated tax impact: 3020

The short-term loss and carryover reduce the opposite long-term result before rates apply. NIIT is a separate modeled layer based entirely on the entered MAGI and NII.

Change one input and watch the consequence

If NIIT is not included because Priya has not yet established the necessary MAGI and NII amounts:

Base case versus one changed input

If NIIT is not included because Priya has not yet established the necessary MAGI and NII amounts

Base case

Combined estimated tax impact

$3,020.00

One-input change

Regular-tax-only impact

$2,070.00
Numeric change$950.00

If NIIT is not included because Priya has not yet established the necessary MAGI and NII amounts

This comparison isolates the optional input; it does not determine whether NIIT legally applies.
Visual summary: Combined estimated tax impact: 3020. Regular-tax-only impact: 2070.

This comparison isolates the optional input; it does not determine whether NIIT legally applies.

Before you use the estimate

  • Recreate the example only with records that support your own inputs.
  • Keep the same filing status and tax year when comparing the published numbers.
  • Change one material input at a time and read the full breakdown.
  • Review the stated limitations before using the estimate.

Where this estimate stops

  • The example assumes basis and holding-period character are correct and excludes special-rate assets, wash sales, home-sale rules, AMT, and state tax.
  • The fictional facts illustrate production logic and do not establish eligibility, filing treatment, or a recommended action for any reader.

Sources and references

Only the primary federal sources used for the rules discussed in this guide are listed here.

  • Revenue Procedure 2025-32

    Internal Revenue Service · The inflation-adjusted 2026 ordinary brackets, standard deductions, preferential-rate thresholds, and other indexed amounts used by the applicable calculation.

  • Topic No. 409, Capital Gains and Losses

    Internal Revenue Service · General capital gain and loss character, netting, the annual capital-loss deduction, and carryover treatment.

  • Publication 550, Investment Income and Expenses

    Internal Revenue Service · Investment income, basis, holding-period, capital netting, and wash-sale concepts discussed in the guide.

  • Net Investment Income Tax

    Internal Revenue Service · The separate 3.8% NIIT framework and MAGI-threshold concept used by the optional estimate.

TaxArith provides illustrative 2026 U.S. federal tax estimates for general information. It is not tax, legal, financial, or investment advice and does not prepare or file a return. Results depend on the accuracy and completeness of the submitted facts.