Tax Strategy & Portfolio Management • 12 min read • Updated October 2026

Short-Term vs. Long-Term Capital Gains Taxes: Brackets, Net Investment Income Tax & Tax-Loss Harvesting

Understand how the IRS taxes realized investment gains, how to qualify for the 0% and 15% long-term brackets, and how to execute tax-loss and tax-gain harvesting without triggering wash sales.

1. Realized vs. Unrealized Gains & The 365-Day Holding Rule

In a taxable brokerage account or real estate investment, price appreciation alone does not trigger an immediate tax bill. Under the U.S. Internal Revenue Code, you owe zero tax on unrealized ("paper") capital gains while you continue holding the asset. A taxable event occurs only upon realization—when you sell shares for cash, exchange one cryptocurrency or stock for another, or receive capital gain distributions from a mutual fund.

When you sell an appreciated capital asset for more than your adjusted cost basis, the IRS classifies your profit into one of two tax regimes based strictly on your holding calendar, which you can calculate down to the dollar using our Capital Gains Tax Calculator:

  • Short-Term Capital Gains (Held 365 Days or Fewer): If you sell an asset exactly 1 year (365 days) or less after the purchase date, your profit receives zero preferential treatment. It is added directly to your W-2 wages and taxed at ordinary federal income tax brackets (10%, 12%, 22%, 24%, 32%, 35%, or 37%).
  • Long-Term Capital Gains (Held 366 Days or More — "More Than One Year"): Waiting until at least Day 366 (one year plus one day from the trade execution date) unlocks preferential federal long-term capital gains tax rates of 0%, 15%, or 20%.

2. How Capital Gains Stack on Top of Ordinary Income

A common misconception is that long-term capital gains are taxed in a separate vacuum from your salary. In reality, when computing your tax return on the Qualified Dividends and Capital Gain Tax Worksheet, your ordinary taxable income sits at the bottom of the bucket, and your long-term capital gains stack directly on top of it:

Adjusted_Cost_Basis = Original_Purchase_Price + Reinvested_Dividends + Capital_Improvements + Commissions
Net_Realized_Gain = Gross_Sale_Proceeds - Adjusted_Cost_Basis
Stacking_Coordinate = Ordinary_Taxable_Income + Net_Long_Term_Capital_Gain
NIIT_Surtax (3.8%) = 0.038 * Min[ Net_Investment_Income, Max(0, MAGI - Statutory_Threshold) ]

Let's examine the federal Long-Term Capital Gains (LTCG) taxable income thresholds (after subtracting the Standard Deduction) alongside the 3.8% Net Investment Income Tax (NIIT) created under IRC Section 1411:

LTCG Tax Tier Single Filer Taxable Income Married Filing Jointly Taxable Income Base Federal LTCG Rate Effective Federal Rate (With 3.8% NIIT)
Tier 1: Tax-Free Zone $0 to $47,025 $0 to $94,050 0.0% 0.0%
Tier 2: Standard LTCG $47,026 to $200,000 (MAGI) $94,051 to $250,000 (MAGI) 15.0% 15.0%
Tier 3: LTCG + NIIT $200,001 to $518,900 $250,001 to $583,750 15.0% 18.8% (15% + 3.8%)
Tier 4: Top Bracket Over $518,900 Over $583,750 20.0% 23.8% (20% + 3.8%)

Crucially, just like ordinary income tax brackets, long-term capital gains brackets are marginal: if a married couple has $80,000 in taxable ordinary income (after their $29,200 standard deduction) and realizes a $30,000 long-term capital gain, the first $14,050 of that gain (filling the gap from $80,000 up to $94,050) is taxed at 0.0%, and only the remaining $15,950 is taxed at 15.0%!

3. Worked Case Study: Tax-Loss Harvesting & The $3,000 Ordinary Income Offset

How do strategic investors turn stock market volatility into permanent tax savings? Through Tax-Loss Harvesting (TLH). Under IRS rules, realized capital losses first offset realized capital gains of the same category (short-term losses offset short-term gains first, and long-term losses offset long-term gains first), and any excess losses then cross over to offset the other category. Furthermore, if your total realized capital losses exceed your total realized capital gains for the calendar year, you can deduct up to $3,000 of net capital losses ($1,500 if Married Filing Separately) directly against your ordinary W-2 salary, and carry forward any remaining unused losses indefinitely into future tax years.

Suppose an investor in the 32% federal ordinary income bracket (and 18.8% LTCG+NIIT bracket) executes the following portfolio rebalancing transactions during the calendar year:

  • Transaction 1 (Short-Term Gain): Sold a semiconductor stock held for 7 months for a +$12,000 short-term gain (which would normally trigger $12,000 * 32% = $3,840 in federal tax).
  • Transaction 2 (Long-Term Gain): Trimmed an appreciated tech position held for 3 years for a +$8,000 long-term gain (which would normally trigger $8,000 * 18.8% = $1,504 in federal tax).
  • Transaction 3 (Strategic Tax-Loss Harvest): During a market pullback, the investor sells an international equity ETF that is down -$25,000 from its purchase price, and on the exact same minute buys a different, non-identical international index ETF to stay 100% invested in the market.

Let's trace the tax-return netting waterfall on Schedule D:

  1. The -$25,000 harvested loss first wipes out the entire +$12,000 short-term gain (saving $3,840 in tax) and the entire +$8,000 long-term gain (saving $1,504 in tax), leaving -$5,000 in net unused capital loss.
  2. Next, -$3,000 of that remaining loss is deducted directly against the investor's W-2 salary on Form 1040, saving another $3,000 * 32% = $960 in ordinary income tax!
  3. Finally, the remaining -$2,000 loss carries forward on Schedule D to offset gains in the following tax year. Total immediate federal tax saved in the current year: $6,304—while the investor's portfolio remained 100% invested in equities every single day!

4. Navigating the 30-Day Wash Sale Rule (IRC Section 1091)

To prevent taxpayers from claiming artificial tax deductions by selling a losing stock at 11:59 AM and buying the exact same stock back at 12:00 PM, Internal Revenue Code Section 1091 enforces the 30-Day Wash Sale Rule:

  • The 61-Day Window: A wash sale occurs if you sell a security at a loss and purchase a "substantially identical" security (or acquire a call option to buy it) within 30 calendar days before or 30 calendar days after the sale date (a 61-day total window including the day of sale).
  • Cross-Account Enforcement (Including IRAs!): The wash sale rule applies across all accounts owned by you, your spouse, or an entity you control. Crucially, if you sell a stock at a loss in your taxable brokerage account and buy the same stock inside your Roth IRA or Traditional IRA within 30 days, the tax loss is permanently disallowed and lost forever (because your IRA has no cost basis to adjust).
  • How to Swap Cleanly Without a Wash Sale: Instead of sitting in cash for 31 days and risking missing a market rebound, swap between ETFs that track different underlying indices—for example, selling an S&P 500 ETF (tracking the S&P 500 Index) and immediately buying a Total U.S. Stock Market ETF (tracking the CRSP US Total Market Index). Because the two funds track different indices with different constituent counts, they retain ~99% return correlation without triggering a wash sale.

5. Advanced Strategies: Specific Lot Identification & 0% Tax-Gain Harvesting

Beyond harvesting losses in down markets, disciplined investors use two additional cost-basis levers:

  • Switch Brokerage Default from FIFO to SpecID (HIFO): By default, brokerages use First-In, First-Out (FIFO) when you sell part of a position, selling your oldest shares—which usually have the lowest cost basis and the largest taxable gain! Changing your tax-lot accounting setting to Specific Identification (SpecID) lets you select specific share lots held over 366 days with the highest purchase price, minimizing realized gains. Similarly, when managing tech equity compensation, use our RSU & Equity Tax Calculator to track your exact vesting cost basis so you never pay double tax on vested RSUs.
  • Tax-Gain Harvesting in the 0% Bracket: During a sabbatical year, graduate school, or the early years of retirement before Social Security starts, if your taxable income falls below $47,025 (single) or $94,050 (married), you can intentionally sell appreciated long-term stocks to fill up the 0% Long-Term Capital Gains bracket and immediately buy the exact same shares back one minute later! Why? Because the 30-day Wash Sale Rule only applies to losses, never to gains. You permanently step up your cost basis for free at a 0.0% federal tax rate.

Interactive Companion Financial Calculators