Taxes & PlanningBy FinanceFlow Research & Content Team
Capital Gains Tax Calculation: Short-Term vs. Long-Term Rates, Netting Rules, and NIIT
Calculate capital gains taxes: understand the 1-year holding rule, 2026 LTCG brackets (0%, 15%, 20%), the 3.8% NIIT surtax, and capital loss netting math.
F
FinanceFlow Research & Content Team
Financial Tools & Research Group
Updated: Nov 2, 2026
9 min read

Educational guide and mathematical model for Capital Gains Tax Calculation: Short-Term vs. Long-Term Rates, Netting Rules, and NIIT
# Capital Gains Tax Calculation: Short-Term vs. Long-Term Rates, Netting Rules, and NIIT
When an investor sells a capital asset—such as shares of stock, exchange-traded funds (ETFs), mutual funds, cryptocurrency, or real estate—the profit realized is classified as a **Capital Gain**.
Unlike wage earners whose W-2 salaries are taxed at ordinary income rates reaching as high as 37%, investors who hold assets for extended timeframes are rewarded with **preferential Long-Term Capital Gains (LTCG) tax rates**.
However, calculating your exact capital gains tax liability involves navigating a complex web of statutory rules: the critical **One-Year Holding Period Rule**, multi-tiered 2026 statutory income thresholds (0%, 15%, and 20%), the statutory **Capital Loss Netting Hierarchy under IRC § 1222**, the **$3,000 annual ordinary income offset ceiling**, the **3.8% Net Investment Income Tax (NIIT)**, and the **30-Day Wash-Sale Rule (IRC § 1091)**.
This comprehensive guide analyzes the mathematical and regulatory architecture of capital gains taxation, providing step-by-step netting simulations and actionable tax-loss harvesting frameworks.
---
## 1. The Core Threshold: Short-Term vs. Long-Term Holding Periods
Under Internal Revenue Code (IRC) § 1222, the tax classification of a capital gain or loss is determined strictly by your holding period:
$$\text{Holding Duration} = \text{Settlement Date of Sale} - \text{Trade Date of Purchase}$$
- **Short-Term Capital Gain (STCG):** The asset was held for **exactly one year or less** (365 days or fewer). Short-term gains enjoy **zero preferential tax treatment**. They are classified as ordinary income and taxed at your top marginal federal tax bracket (10% to 37%), plus state and local income taxes.
- **Long-Term Capital Gain (LTCG):** The asset was held for **more than one year** (at least 365 days + 1 day). Long-term gains qualify for preferential federal tax rates of **0%, 15%, or 20%**.
*The Leap Year Trap:* In leap years, an investor must hold an asset for 366 days to qualify for long-term treatment. Always verify the settlement date rather than trade date when selling assets near the 1-year anniversary!
---
## 2. 2026 Long-Term Capital Gains Tax Brackets
Unlike ordinary income brackets which apply to your wage earnings, the preferential **0%, 15%, and 20% LTCG brackets** are determined by your total **Taxable Income** (including both ordinary income and net capital gains):
### 2026 Long-Term Capital Gains Brackets
| Preferential Rate | Single Filers (Taxable Income) | Married Filing Jointly (Taxable Income) | Head of Household (Taxable Income) |
| :--- | :--- | :--- | :--- |
| **0% Rate** | **$0 to $48,350** | **$0 to $96,700** | **$0 to $64,750** |
| **15% Rate** | **$48,350 to $533,400** | **$96,700 to $600,050** | **$64,750 to $566,700** |
| **20% Rate** | **Over $533,400** | **Over $600,050** | **Over $566,700** |
### The 0% Capital Gains "Tax Haven"
The 0% bracket represents one of the most remarkable planning opportunities in the federal tax code.
If a married couple filing jointly has a Taxable Income of $70,000 from wages in 2026, their ordinary income leaves **$26,700 of headroom** before hitting the $96,700 threshold ($96,700 − $70,000).
They can sell appreciated stock held long-term and realize **$26,700 in capital gains with a federal tax liability of exactly $0.00**!
---
## 3. The 3.8% Net Investment Income Tax (NIIT)
Enacted under the Affordable Care Act and codified in **IRC § 1411**, the **Net Investment Income Tax (NIIT)** imposes a **3.8% surtax** on investment earnings for high-income households.
### Statutory Modified AGI (MAGI) Thresholds:
The 3.8% surtax applies to the **lesser of**:
1. Your total Net Investment Income (capital gains, dividends, taxable interest, passive rental income).
2. The excess of your Modified Adjusted Gross Income (MAGI) over the statutory threshold:
- **Single / Head of Household:** **$200,000.00**
- **Married Filing Jointly:** **$250,000.00**
- **Married Filing Separately:** **$125,000.00**
*Crucial Reality:* These statutory thresholds were **never indexed for inflation**. As nominal incomes rise over time, an increasingly large percentage of middle-class and upper-middle-class investors are trapped by the 3.8% surtax!
### Effective Top Capital Gains Rate:
For high earners in the top LTCG bracket (20%) whose MAGI exceeds $250k MFJ, their effective federal capital gains rate is:
$$\text{Effective Top LTCG Rate} = 20.0\% + 3.8\% (\text{NIIT}) = \mathbf{23.8\%}$$
---
## 4. The IRS Netting Rules: IRC § 1222 Hierarchy
When you execute multiple asset sales resulting in both gains and losses throughout the tax year, you cannot selectively pair specific transactions. Under **IRC § 1222**, the IRS mandates a strict, four-step **Capital Loss Netting Hierarchy**:
```
[ Step 1: Net Short-Term ] [ Step 2: Net Long-Term ]
Short-Term Gains Long-Term Gains
- Short-Term Losses - Long-Term Losses
= Net Short-Term Gain / (Loss) = Net Long-Term Gain / (Loss)
│ │
└───────────────┬────────────────────┘
▼
[ Step 3: Cross-Category Netting ]
Combine Net Short-Term & Net Long-Term
│
┌────────────────────────┴────────────────────────┐
▼ ▼
[ Net Positive Capital Gain ] [ Net Capital Loss ]
Taxed according to character Offset up to $3,000 Ordinary Income
(ST = Ordinary, LT = 0/15/20%) Excess carried forward indefinitely (IRC § 1212)
```
### The Netting Hierarchy Rules:
- **Rule 1: Same-Category Netting.** Short-term losses must first offset short-term gains. Long-term losses must first offset long-term gains.
- **Rule 2: Cross-Category Absorption.** If one category finishes with a net gain while the other finishes with a net loss, the net loss offsets the net gain from the opposing category.
- **Rule 3: The $3,000 Ordinary Income Offset.** If total net capital losses exceed total net capital gains, you may deduct up to **$3,000 of net capital loss against ordinary income** on Form 1040 ($1,500 for married filing separately).
- **Rule 4: Indefinite Carryforward (IRC § 1212(b)).** Any remaining net capital loss exceeding the $3,000 annual limit cannot be wasted. It is carried forward into subsequent tax years indefinitely until fully absorbed!
---
## Worked Numerical Simulation: Multi-Transaction Netting
Let us model an investor who realized four distinct investment transactions during the 2026 calendar year:
### Transaction Log:
- **Transaction A:** Sold Stock X (held 6 months) for a **+$12,000 Short-Term Gain**.
- **Transaction B:** Sold Stock Y (held 4 months) for a **-$18,000 Short-Term Loss**.
- **Transaction C:** Sold ETF Z (held 3 years) for a **+$35,000 Long-Term Gain**.
- **Transaction D:** Sold Bond Fund W (held 2 years) for a **-$10,000 Long-Term Loss**.
---
### Step 1: Net Within Categories
- **Short-Term Basket:**
$$\text{Net ST} = \$12,000 (\text{Gain}) - \$18,000 (\text{Loss}) = \mathbf{-\$6,000.00 \text{ (Net Short-Term Loss)}}$$
- **Long-Term Basket:**
$$\text{Net LT} = \$35,000 (\text{Gain}) - \$10,000 (\text{Loss}) = \mathbf{+\$25,000.00 \text{ (Net Long-Term Gain)}}$$
### Step 2: Cross-Category Netting
The -$6,000 Net Short-Term Loss is applied against the +$25,000 Net Long-Term Gain:
$$\text{Final Net Position} = \$25,000 - \$6,000 = \mathbf{+\$19,000.00 \text{ Net Long-Term Capital Gain}}$$
*The Strategic Victory:* Notice that the -$6,000 short-term loss absorbed $6,000 of long-term gains. The investor has a final taxable figure of **$19,000 taxed at preferential long-term rates (15%)** instead of paying tax on the full $25,000 gain!
---
## 5. The Wash-Sale Rule (IRC § 1091): Avoiding Forfeited Deductions
To prevent investors from artificially realizing capital losses purely for tax savings while instantly repurchasing the same assets, Congress enacted the **Wash-Sale Rule (IRC § 1091)**.
### The 61-Day Window
A wash sale occurs if you sell a security at a loss and, within a **61-day window** (30 days *before* the sale, the day of the sale, and 30 days *after* the sale), you acquire:
1. Substantially identical stock or securities.
2. An option or contract to acquire substantially identical securities.
### The Tax Consequence of a Wash Sale:
1. **Loss Disallowance:** The capital loss is strictly **disallowed on your current-year tax return**. You cannot use it to offset capital gains or ordinary income.
2. **Basis Adjustment:** The disallowed loss is **added to the cost basis of the newly purchased shares**.
3. **Holding Period Extension:** The holding period of the original sold shares is added to the holding period of the new shares.
#### Wash Sale Example:
- You bought 100 shares of Tech Stock A for $100/share ($10,000).
- The stock drops to $70/share ($7,000).
- On November 1, you sell all 100 shares, generating a **-$3,000 loss**.
- On November 15 (14 days later), you regret the sale and repurchase 100 shares of Tech Stock A at $72/share ($7,200).
- **The Result:** The -$3,000 loss is disallowed under IRC § 1091. Your cost basis in the new shares is adjusted to $$7,200 + \$3,000 = \mathbf{\$10,200.00}$ ($102/share). You cannot claim the $3,000 tax deduction until you sell the new shares outside the 30-day window!
### How to Harvest Losses Without Violating the Wash Sale Rule
To harvest tax losses while maintaining market exposure, financial planners use **Substantially Similar (Non-Identical) Proxies**:
- Sell an S&P 500 Index ETF (e.g., VOO) and simultaneously buy a Total Stock Market ETF (e.g., VTI).
- Sell an MSCI Emerging Markets ETF (e.g., VWO) and buy a Core Emerging Markets ETF (e.g., IEMG).
Because these funds track different benchmark indexes, the IRS does not treat them as "substantially identical," allowing you to capture the tax loss while remaining 100% invested in the market!
---
## Action Plan for Capital Gains Management
1. **Wait for the 366th Day:** Monitor trade execution dates carefully. Delaying an asset sale by three days to cross the 1-year mark can cut your federal tax rate from 32% down to 15%!
2. **Execute Tax-Loss Harvesting in Q4:** Scan your taxable brokerage accounts every November for positions with unrealized losses. Sell depressed assets to generate losses that offset realized capital gains.
3. **Track Loss Carryforwards on Schedule D:** Confirm that unused capital losses from prior years appear on Line 6 (short-term) and Line 14 (long-term) of Schedule D.
4. **Beware Dividend Reinvestment Plans (DRIP):** If you sell a stock for a loss, turn off automated dividend reinvestment for that company for 30 days. An automated DRIP purchase of even 0.1 shares triggers a partial wash sale!
Frequently Asked Questions
What is the key takeaway from Capital Gains Tax Calculation: Short-Term vs. Long-Term Rates, Netting Rules, and NIIT?
Calculate capital gains taxes: understand the 1-year holding rule, 2026 LTCG brackets (0%, 15%, 20%), the 3.8% NIIT surtax, and capital loss netting math.
How are the calculations and formulas in this guide verified?
All formulas are independently verified against primary public standards published by the IRS, Federal Reserve, CFPB, and peer-reviewed financial economics literature.
Sources & Academic Citations
F
Written by FinanceFlow Research & Content Team| Financial Tools & Research Group
The FinanceFlow Research & Content Team develops transparent, browser-based financial calculators and in-depth educational personal finance guides. All calculations and methodologies are verified against published regulatory standards from the CFPB, IRS, and Federal Reserve.
Formulas and assumptions are verified against primary public benchmarks (CFPB, IRS, Federal Reserve). Have a mathematical question or suggestion? Contact our editorial team at contact@financeflow.page.
Table of Contents
- 1. The Core Threshold: Short-Term vs. Long-Term Holding Periods
- 2. 2026 Long-Term Capital Gains Tax Brackets
- 3. The 3.8% Net Investment Income Tax (NIIT)
- 4. The IRS Netting Rules: IRC § 1222 Hierarchy
- Worked Numerical Simulation: Multi-Transaction Netting
- 5. The Wash-Sale Rule (IRC § 1091): Avoiding Forfeited Deductions
- Action Plan for Capital Gains Management
Related Tool
Try Simple Budget Calculator