Skip to main content

Tax-Loss Harvesting: Offset Gains With Losses

Simple realized gain/loss scenarios

Model simple capital loss harvesting scenarios to see how selling losing positions might affect your capital gains tax.

⚠️ This is an educational calculator with simplified calculations. Not tax, legal, or investment advice. Does not fully model wash-sale rules. Always consult a tax professional for your specific situation.

Loading...

Last updated: January 11, 2026

Who This Is For

It's December 15th. Your brokerage statement shows $18,000 in realized gains from selling some winners earlier this year. Meanwhile, that tech stock you bought in March is down $12,000 and you're wondering whether it makes sense to sell it now, take the loss, and buy something similar.

This tool is for investors trying to figure out whether harvesting a loss makes sense and how much it would actually save. Not just the headline number—the real math, including short-term vs. long-term netting, the $3,000 ordinary income deduction, and what carries forward to next year.

If you have gains to offset and positions underwater, there's probably money on the table. This calculator shows you exactly how much.

The 5 Levers That Move Your Tax Savings

  • Short-term vs. long-term losses: Short-term losses offset short-term gains first (taxed at your ordinary rate, up to 37%). Long-term losses offset long-term gains first (taxed at 0-20%). Harvesting a short-term loss to offset a short-term gain saves more tax than the same loss against a long-term gain.
  • The $3,000 ordinary income deduction: If your losses exceed your gains, you can deduct up to $3,000 from your regular income. At a 32% marginal rate, that's $960 saved. Any excess carries forward indefinitely.
  • Wash-sale avoidance: If you buy the same (or "substantially identical") security within 30 days before or after selling at a loss, the loss is disallowed. You have to wait 31 days or buy something different.
  • Your tax bracket: The higher your income, the more valuable the loss. Someone in the 37% bracket saves $3,700 on a $10,000 short-term loss. Someone in the 12% bracket saves $1,200. Same loss, different value.
  • Carryforward strategy: If you expect a big gain next year (selling RSUs, exercising options, selling property), banking losses now gives you ammunition to offset that future gain.

Real Numbers: Two Investors, Two Outcomes

Example 1: Wei Harvests Strategically

Wei sold stock this year for $25,000 in short-term gains. She also has a position down $18,000 that she's been holding for 10 months. Her marginal tax bracket is 32%.

Without Harvesting:

  • Short-term gains: $25,000
  • Tax owed (32%): $8,000

With Harvesting:

  • Short-term gains: $25,000
  • Short-term loss harvested: $18,000
  • Net short-term gain: $7,000
  • Tax owed (32%): $2,240
  • Tax saved: $5,760

Wei sells the losing position, immediately buys a similar (but not identical) ETF to maintain market exposure, and saves $5,760 in taxes. The loss is short-term, offsetting short-term gains at the highest rate—maximum value.

Example 2: James Has More Losses Than Gains

James has $6,000 in long-term gains this year but is sitting on $22,000 in losses from a biotech stock that crashed. He's in the 24% bracket for ordinary income and would pay 15% on long-term gains.

If He Harvests the Full $22,000 Loss:

  • Long-term gains offset: $6,000 (saves $900 at 15%)
  • Ordinary income offset: $3,000 (saves $720 at 24%)
  • Carryforward to next year: $13,000
  • Total tax saved this year: $1,620

James gets immediate savings plus $13,000 in losses banked for future years. If he expects to sell RSUs next year with big gains, that carryforward becomes even more valuable.

Mistakes That Cost You Money

  • Triggering a wash sale: You sell at a loss on December 20, then buy the same stock on January 5 thinking the new year resets things. It doesn't—the 30-day window spans calendar years. Loss disallowed.
  • Buying in your IRA: You sell a stock in your taxable account, then buy it in your IRA the same week. That's a wash sale. IRAs count. The loss is disallowed, and the cost basis doesn't transfer.
  • Wasting long-term losses on short-term gains: If you use a long-term loss (worth 15-20% tax savings) to offset a short-term gain (worth 24-37%), the IRS nets them—you lose the ability to use that loss against future long-term gains. Think about sequencing.
  • Ignoring transaction costs: If the loss is $500 and you're paying bid-ask spreads on both the sale and the replacement purchase, the tax savings might not be worth it. Bigger losses are more obviously worth harvesting.
  • Waiting until December 30: Everyone harvests in late December. Spreads widen, prices are volatile, and you might miss settlement deadlines. Check your portfolio in October or November instead.

The Wash-Sale Rule in Plain English

Sell a stock at a loss, then buy it back within 30 days before or after? The IRS disallows the loss. The 30-day window goes both directions—so it's really a 61-day danger zone.

"Substantially identical" means the same stock or very close. Different share classes of the same company count. But swapping one S&P 500 ETF for a different S&P 500 ETF from another provider? The IRS has never explicitly said that's a wash sale, and most tax professionals consider it safe. Swapping Apple stock for a tech sector ETF? Clearly not identical.

If you trigger a wash sale, the disallowed loss gets added to the cost basis of the new shares. You'll eventually get the tax benefit—just not now.

This tool does NOT check for wash sales. You need to verify your actual trade dates and what you've bought in all accounts (including IRAs) within the 61-day window.

How We Calculate This

We follow IRS netting rules: short-term gains net against short-term losses first, long-term against long-term. If one category has a net loss and the other a net gain, they cross-offset. Net losses beyond gains offset up to $3,000 of ordinary income, with the rest carrying forward.

1. Net ST gains/losses → Net ST result

2. Net LT gains/losses → Net LT result

3. If opposite signs, cross-offset

4. If net loss remains: deduct up to $3,000 from ordinary income

5. Excess carries forward

What we include: Short-term and long-term gains/losses you enter, your federal tax rates, the $3,000 ordinary income offset, and carryforward calculation.

What we don't include: Wash-sale detection, state taxes (though you can add an optional state rate), or automatic position tracking from your brokerage. This is a planning tool—verify numbers with your broker's 1099-B before filing.

Sources

Capital gains rates and the $3,000 deduction limit are set by statute and could change with tax legislation.

Sources: IRS, SSA, state revenue departments
Last updated: January 2025
Uses official IRS tax data

For Educational Purposes Only - Not Financial Advice

This calculator provides estimates for informational and educational purposes only. It does not constitute financial, tax, investment, or legal advice. Results are based on the information you provide and current tax laws, which may change. Always consult with a qualified CPA, tax professional, or financial advisor for advice specific to your personal situation. Tax rates and limits shown should be verified with official IRS.gov sources.

Common Questions

I sold a stock at a loss on December 28. Can I buy it back on January 3?
No—that's a wash sale. The 30-day window spans calendar years. You'd need to wait until January 28 (31 days after the sale) to buy the same stock. Or you could immediately buy a similar but not identical investment, like a different company in the same sector or a sector ETF instead of the individual stock.
Does buying in my IRA count toward the wash-sale rule?
Yes. If you sell a stock at a loss in your taxable account and buy the same stock in your IRA within 30 days, the loss is disallowed. What's worse: in this case the disallowed loss doesn't even get added to the IRA's cost basis (since IRAs don't track cost basis the same way). The loss is effectively gone forever.
I have $40,000 in losses but only $10,000 in gains. Should I harvest all of it?
Maybe not all at once. You can offset the $10,000 gain plus $3,000 of ordinary income this year. The remaining $27,000 carries forward, but it just sits there until you have gains to offset. If you're holding positions you believe will recover, you might want to keep some losses 'in reserve' for future years when you have bigger gains—like when you exercise stock options or sell a rental property.
My stock is down $5,000 but I think it's going to bounce back. Should I still harvest?
If you like the stock long-term, sell it, take the $5,000 loss, wait 31 days, and buy it back. You get the tax deduction now and the same upside later. The catch: if it rises during those 31 days, you'll buy back at a higher price and lose some of that gain. Many investors solve this by immediately buying a similar (not identical) ETF to stay invested during the waiting period.
Does this tool check if I've violated the wash-sale rule?
No. This tool calculates tax savings assuming all losses are valid. You need to verify your actual trade dates across all your accounts—including IRAs, 401(k)s, and spouse accounts. Your brokerage's 1099-B will flag wash sales they detect within that account, but they can't see your other accounts.
I'm in the 15% long-term capital gains bracket. Is harvesting still worth it?
Yes, but less valuable than for someone in a higher bracket. A $10,000 long-term loss saves you $1,500 at 15%. If you have short-term gains to offset instead, a short-term loss saves you at your ordinary income rate (22-37% for many people)—potentially double the savings. Prioritize short-term losses when you can.
I'm expecting a big gain next year from selling RSUs. Can I bank losses now?
Absolutely—that's smart planning. Any net capital loss you can't use this year carries forward indefinitely. If you harvest $30,000 in losses this year but only have $5,000 in gains, you'll use $5,000 against gains and $3,000 against ordinary income, with $22,000 carrying forward. Next year when you sell RSUs worth $50,000 in gains, you'll have that $22,000 ready to offset.
Tax-Loss Harvesting Calculator: Offset Gains