Tax Loss Harvesting Optimizer Calculator
Optimize your tax-loss harvesting strategy by calculating potential tax savings from offsetting capital gains with investment losses.
Formula
Net Gain = Capital Gains - Min(Capital Losses, Capital Gains); Tax Savings = (Offset Gains ร Combined Rate) + (Min(Excess Losses, $3,000) ร Ordinary Rate)
The formula calculates tax savings in two parts: first, the capital gains that are offset dollar-for-dollar by harvested losses (taxed at your combined federal and state capital gains rate), and second, any excess losses up to $3,000 that can offset ordinary income (taxed at your marginal income tax rate). Remaining losses carry forward to future years. The combined rate includes federal LTCG rate (0%, 15%, or 20%), potential Net Investment Income Tax (3.8%), and state capital gains taxes. This formula works because the tax code treats capital losses as direct offsets to capital gains, with the $3,000 ordinary income provision providing additional value for excess losses.
Worked Examples
Example 1: Basic Loss Harvesting
Problem:Sarah has $30,000 in long-term capital gains and $12,000 in unrealized losses. She's in the 24% federal bracket with 15% LTCG rate and 5% state tax.
Solution:Capital gains: $30,000 Unrealized losses: $12,000 Net gains: $30,000 - $12,000 = $18,000 Tax without harvesting: $30,000 ร (15% + 5%) = $6,000 Tax with harvesting: $18,000 ร 20% = $3,600 Tax savings: $6,000 - $3,600 = $2,400 Harvesting efficiency: $2,400 / $12,000 = 20%
Result:$2,400 tax savings from harvesting $12,000 in losses
Example 2: Excess Losses with Carryover
Problem:Mike has $10,000 in gains but $25,000 in losses. He's in the 32% bracket.
Solution:Capital gains: $10,000 Capital losses: $25,000 Step 1 - Offset gains: $10,000 gains fully offset โ $0 capital gains tax Step 2 - Remaining losses: $25,000 - $10,000 = $15,000 excess Step 3 - Ordinary income deduction: Year 1: $3,000 deduction ร 32% = $960 savings Step 4 - Carryover: $15,000 - $3,000 = $12,000 carries to next year Total Year 1 benefit: Gains tax avoided: $10,000 ร 20% = $2,000 Ordinary deduction: $960 Total: $2,960
Result:$2,960 Year 1 savings + $12,000 loss carryforward
Example 3: Strategic Partial Harvesting
Problem:Emma has $50,000 gains, $60,000 unrealized losses, and expects similar gains next year. Should she harvest all losses?
Solution:Option A - Harvest all $60,000: Year 1: Offset $50,000 gains + $3,000 ordinary = $53,000 used Carryover: $7,000 Option B - Harvest $53,000 strategically: Year 1: Offset $50,000 gains + $3,000 ordinary Retain $7,000 unrealized for Year 2 Analysis: Option B preserves flexibility Remaining $7,000 unrealized may grow/shrink Avoids locking in carryover timing If 20% combined rate: Year 1 savings either way: $50,000 ร 20% + $3,000 ร 32% = $10,960 Recommendation: Option B - harvest only what's needed
Result:$10,960 Year 1 savings, retain flexibility by harvesting only $53,000
Frequently Asked Questions
What is tax-loss harvesting?
Tax-loss harvesting is a strategy of selling investments at a loss to offset capital gains taxes. The losses can offset gains dollar-for-dollar, plus up to $3,000 in ordinary income annually, with excess losses carrying forward to future years.
What is the wash sale rule?
The wash sale rule prevents claiming a loss if you buy a substantially identical security within 30 days before or after the sale. This 61-day window means you must wait or buy a different (but similar) investment to maintain market exposure.
Can I harvest losses in retirement accounts?
No, losses in tax-advantaged accounts like IRAs and 401(k)s cannot be used for tax-loss harvesting because these accounts are already tax-deferred or tax-free. Harvesting only works in taxable brokerage accounts.
How much can I deduct against ordinary income?
You can deduct up to $3,000 per year ($1,500 if married filing separately) of net capital losses against ordinary income. Any excess losses carry forward indefinitely to future tax years.
Should I harvest short-term or long-term losses first?
Generally, short-term losses are more valuable because they offset short-term gains taxed at higher ordinary income rates. However, the IRS requires netting short-term against short-term and long-term against long-term first.
What are substantially identical securities?
Securities are substantially identical if they're the same stock, bonds from the same issuer, or funds tracking the same index. You can avoid wash sales by switching to similar but not identical investments, like S&P 500 to Total Market funds.
When is the best time to harvest losses?
Year-end is traditional, but harvesting throughout the year captures more opportunities. Market downturns, portfolio rebalancing, and any time losses exceed a meaningful threshold are good times to harvest.
How do carryover losses work?
Unused capital losses carry forward indefinitely until used. They first offset future capital gains, then up to $3,000 of ordinary income annually. Track carryovers carefully on Schedule D and Form 8949.
Does tax-loss harvesting always make sense?
Not always. Transaction costs, wash sale complications, and the benefit of deferral vs. elimination should be considered. If you're in a low tax bracket now but expect higher rates later, harvesting may be less beneficial.
How does state tax affect harvesting decisions?
State taxes can significantly increase harvesting value. High-tax states like California (13.3%) or New York (10.9%) make harvesting more valuable, while states without income tax see reduced but still meaningful benefits.
Background & Theory
Tax-loss harvesting represents one of the most reliable methods for improving after-tax investment returns. Understanding its mechanics, limitations, and optimal implementation can meaningfully impact long-term wealth accumulation.
Concept Overview
At its core, tax-loss harvesting exploits the asymmetry between when you choose to realize gains versus losses. While you must eventually pay taxes on gains (unless held until death for stepped-up basis), you control the timing of loss realization. By strategically harvesting losses, you offset current gains, potentially convert high-taxed short-term gains to lower-taxed long-term gains, and generate ordinary income deductions.
The mathematical benefit comes from the time value of tax deferral. A dollar saved today and invested grows more valuable than paying that dollar in taxes now and having less capital working for you. Even if you eventually pay the same nominal tax, deferral provides real economic benefit.
The strategy works because the IRS treats each sale as a separate taxable event. Selling a losing position crystalizes that loss for tax purposes, even if you immediately reinvest in a similar (but not substantially identical) security, maintaining your market exposure.
Key Variables & Intuition
- Unrealized losses - The raw material for harvesting; more losses mean more harvesting opportunity
- Capital gains to offset - Determines immediate tax savings; dollar-for-dollar offset
- Tax bracket - Higher brackets increase ordinary income deduction value
- LTCG rate - 0%, 15%, or 20% depending on income; plus 3.8% NIIT for high earners
- State tax rate - Adds 0% to 13.3% to federal rates
- Holding period - Short-term losses offset short-term gains first (higher value)
- Carryover losses - Accumulated losses from prior years available for use
Assumptions
- Investor has taxable accounts (not applicable to IRAs/401(k)s)
- Wash sale rules are properly observed
- Transaction costs don't exceed tax benefits
- Reinvestment maintains desired asset allocation
- Investor has capital gains or ordinary income to offset
- Tax rates remain relatively stable
Limitations & Edge Cases
- Low/no income years - If your capital gains rate is 0% (income under ~$44,625 single), harvesting provides no immediate benefit on LTCG
- Future rate increases - Harvesting at 15% that resets basis could result in 20%+ tax later
- Stepped-up basis at death - Heirs receive stepped-up basis, making unharvested losses disappear but gains tax-free
- Wash sale complexity - Rules apply across all your accounts, including IRAs, potentially disallowing losses unexpectedly
- State tax variations - Some states don't conform to federal treatment
Interpretation Guide
A harvesting efficiency above 15-20% indicates strong tax benefit relative to losses realized. Efficiency below 10% suggests minimal benefit, potentially not worth transaction costs or wash sale tracking complexity. Consider whether the $3,000 ordinary income deduction is valuable given your bracket.
Practical Tips
- Harvest throughout the year - Don't wait for December; market timing opportunities occur randomly
- Use specific lot identification - Sell highest-cost lots first to maximize losses
- Track wash sales across accounts - IRAs purchasing substantially identical securities trigger wash sales
- Consider charitable giving - Donate appreciated securities instead of harvesting; double benefit
- Pair with rebalancing - Natural rebalancing creates harvesting opportunities
- Maintain records meticulously - Cost basis tracking is essential for accurate tax reporting
- Review before year-end - Final opportunities expire December 31
Common Mistakes
- Triggering wash sales inadvertently - Automatic dividend reinvestment can trigger wash sales
- Ignoring state taxes - Undervaluing harvesting in high-tax states
- Harvesting too aggressively - Creating large carryovers when gains are uncertain
- Forgetting about the 30-day window - Both before AND after sale triggers wash sale
- Not reinvesting - Missing market exposure while waiting out wash sale period
- Ignoring transaction costs - Commission and spread can exceed small harvest benefits
When NOT to Use
- In tax-advantaged accounts (IRAs, 401(k)s, HSAs)
- When your capital gains rate is 0% and you have no short-term gains
- When transaction costs exceed expected tax benefit
- When you plan to donate the securities anyway (better to donate appreciated shares)
Advanced Notes
Consider "loss harvesting" as part of a broader "tax-aware" strategy that includes asset location (holding tax-inefficient assets in tax-advantaged accounts), tax-efficient fund selection, and coordination with other income sources. For substantial portfolios, factor analysis can help identify replacement securities that maintain factor exposures while avoiding wash sales.
History
Tax-loss harvesting emerged as a sophisticated tax planning strategy in the early 20th century, evolving alongside the development of the modern income tax system established by the 16th Amendment in 1913. Initially, only wealthy investors and their advisors understood and utilized this technique, as it required careful tracking of cost basis and an understanding of complex tax rules.
Origins & Why It Emerged
The strategy developed organically as investors and tax professionals recognized that the tax code allowed losses to offset gains. The Revenue Act of 1921 first established preferential treatment for capital gains, creating the foundation for loss harvesting strategies. As marginal tax rates climbed during the Depression era (reaching 94% in 1944), sophisticated investors increasingly sought legal methods to reduce tax burdens, making loss harvesting more valuable.
How It Evolved in Practice
The wash sale rule, codified in 1921, arose to prevent abusive round-trip transactions where investors would sell and immediately repurchase the same security solely to realize losses. This rule shaped how harvesting strategies developed, requiring investors to wait 30 days or find substantially similar (but not identical) replacement investments.
The Tax Reform Act of 1986 significantly impacted harvesting by equalizing tax rates on capital gains and ordinary income temporarily, reducing but not eliminating the strategy's value. When preferential capital gains rates returned in 1990 and expanded in 1997 (with the 20% rate) and 2003 (15% rate), tax-loss harvesting regained prominence.
Modern Usage Today
The 2010s brought democratization through robo-advisors like Betterment and Wealthfront, which automated daily tax-loss harvesting for retail investors. Studies showed automated harvesting could add 0.77% to 1.5% in after-tax returns annually. Today, even traditional brokerages offer harvesting tools, making the strategy accessible to everyday investors.
Modern harvesting considers factors beyond simple loss realization: tracking specific lots, managing wash sales across accounts, considering state tax implications, and coordinating with other tax strategies like qualified opportunity zones and charitable giving.
Common Misconceptions Historically
- Losses must be "real" to have value - Paper losses have identical tax value when realized strategically
- Harvesting creates money from nothing - It defers rather than eliminates taxes (though deferral has time value)
- Only works in down markets - Individual positions decline even in bull markets
- Too complex for average investors - Modern tools have simplified implementation dramatically
- Wash sale rule applies across all securities - Only substantially identical securities trigger the rule
References
- IRS Publication 550: Investment Income and Expenses
- IRS Wash Sale Rules - IRC Section 1091
- Vanguard: Tax Planning and Investment Taxes
- Betterment Tax-Loss Harvesting White Paper
- Kitces: Tax-Loss Harvesting Best Practices
- SEC Investor Bulletin: Capital Gains and Losses
- Tax Foundation: Capital Gains Tax Rates