Tax Loss Harvesting Explained: Rules, Examples, Wash Sale Trap
Selling an investment at a loss on purpose sounds backwards. Most people spend their whole investing life trying to avoid exactly that. But the tax code treats a realized loss as something genuinely useful, and knowing how to use it correctly is one of the few tax moves fully within your own control.
The catch is a rule that trips up far more people than the obvious mistake it seems designed to prevent. This article covers how the savings actually work, the wash sale traps that catch people through IRAs and employer stock, and a reverse strategy almost nothing else covers.
1. What Tax Loss Harvesting Actually Means
Tax loss harvesting means selling an investment that's worth less than you paid for it, on purpose, so you can use that loss to lower your tax bill.
It sounds counterintuitive. Why would selling at a loss ever be a good move? Because the IRS lets you use realized losses to offset realized gains elsewhere in your portfolio. IRS Topic No. 409, Capital Gains and Losses_LINK confirms the mechanic directly: losses first offset gains of the same type, and any leftover loss can knock up to $3,000 a year off your ordinary income.
The tax loss harvesting rules that matter most come down to one catch most people learn about the hard way: the wash sale rule. Everything here assumes a taxable brokerage account; our stocks vs bonds guide covers how these two asset types are taxed differently in the first place.
Buy back the same or a "substantially identical" investment too soon, and the IRS erases the tax benefit you were counting on.
2. How the Tax Savings Actually Work
Capital losses don't just subtract from your total gain in some vague sense. The IRS uses a specific netting order, and it matters.
Short-term losses (on anything held one year or less) offset short-term gains first. Long-term losses offset long-term gains first. Only after that does any leftover loss cross over to offset the other type.
These tax harvesting rules on ordering matter because short-term gains are taxed as ordinary income, up to 37%, while long-term gains get the preferential 0%, 15%, or 20% rates. A dollar of short-term loss is often worth more in tax savings than a dollar of long-term loss, simply because it's more likely offsetting a more heavily taxed gain.
The tax loss harvesting limit against ordinary income kicks in if your losses exceed your gains for the year: up to $3,000 of the excess ($1,500 if you're married filing separately) can offset your ordinary income, like your salary. Anything beyond that $3,000 doesn't disappear; it carries forward, indefinitely, to future tax years.
3. The Wash Sale Rule: What Actually Triggers It in Tax Loss Harvesting
Under IRC Section 1091, a wash sale happens when three things are all true at once: you sell a security at a loss, you buy the same or a "substantially identical" security, and that purchase happens within 30 days before or after the sale.
Count that carefully. It's not a 30-day window, it's 61 calendar days: 30 days before the sale, the sale date itself, and 30 days after. Weekends and holidays count. Most people only think about the "after" side and get caught by a purchase they made a few weeks before they decided to harvest.
When a wash sale is triggered, the loss isn't destroyed. It gets added to the cost basis of the replacement shares, and the original holding period carries over too. You'll eventually recognize that loss, just later, when you sell the replacement position, and only if you don't trigger another wash sale doing it.
Partial repurchases create partial wash sales. Sell 100 shares at a loss and buy back 40 within the window, and 40% of your loss gets disallowed; the other 60% is still deductible this year.
4. Work Out What Harvesting a Loss Would Actually Save You
Enter a realized gain, a loss you're considering harvesting, and your tax rates, and this shows exactly how much the harvest would save, including anything that spills over to offset ordinary income.
Enter a gain you've realized this year, a loss you're considering harvesting, and your tax rates.
Illustrative only, not tax advice. Assumes the harvested loss is long-term and does not trigger a wash sale. State taxes not included. Sources read 19 August 2026.
5. Three Tax Loss Harvesting Traps That Catch People Off Guard
The obvious version of the wash sale rule, don't immediately rebuy what you just sold, is easy to avoid. These three versions are not, because they don't feel like buying anything.
- The IRA trap. This is the costliest version of loss harvesting taxes wrong. Sell a stock at a loss in a taxable account, then buy the same stock in your IRA within 30 days, even automatically, and the wash sale still applies. Worse, the loss doesn't defer into a new cost basis the way capital loss harvesting normally works; it's gone permanently, since IRA basis doesn't work that way. The same applies to your spouse's IRA and taxable accounts too.
- The RSU trap. If you hold employer stock, vesting counts as a purchase for wash sale purposes. Sell shares of your employer's stock at a loss, and if a scheduled RSU vest lands inside the 61-day window, it can wash out some or all of that loss, even though you didn't place any trade yourself.
- The dividend reinvestment trap. If DRIP is turned on, a small automatic dividend purchase during the window is still a purchase. It typically washes out a small, proportional slice of your loss, easy to miss since it wasn't a decision you made.
6. Tax Loss Harvesting: What Counts as "Substantially Identical"
The IRS has never published a precise definition, which is exactly why this trips people up. Some cases are clear. Selling and rebuying the exact same stock or fund is always a wash sale. Buying a different company in the same industry, selling Ford and buying General Motors, is not.
The genuinely gray area is funds. Two S&P 500 index funds from different providers track nearly identical holdings, and most tax professionals treat swapping between them as risky. A fund tracking a meaningfully different index, an S&P 500 fund replaced with a total market fund, is generally considered safe, though there's no IRS ruling that guarantees it.
The practical approach: if you want to stay invested in roughly the same part of the market while harvesting a loss, switch to a fund tracking a different index rather than a different provider's version of the same one.
7. Crypto Tax Loss Harvesting Currently Skips the Wash Sale Rule
This is one of the more significant, current asymmetries in the tax code. IRC Section 1091 applies specifically to "stock or securities." IRS Notice 2014-21, on the tax treatment of virtual currency_LINK classifies cryptocurrency as property, not a security.
The practical result: you can sell Bitcoin at a loss on Monday and buy it back Tuesday, and the loss still counts. A stock investor doing the identical thing would have the loss disallowed.
This has been true for years, and Congress has repeatedly proposed closing it, most notably in a provision of the 2021 Build Back Better Act that was dropped before passage. More bills followed in 2024 and 2025, none enacted as of this writing.
The crypto tax loss harvesting exemption is real and current, but it is not guaranteed to stay that way, and crypto brokers are now required to report transactions on Form 1099-DA, a sign of closer IRS attention even without a rule change yet.
8. The Reverse Strategy: Tax Gain Harvesting
Almost every guide to this topic stops at losses. The mirror-image strategy gets far less attention, and for some investors it's worth just as much.
For 2026, a single filer with taxable income up to $49,450 (or $98,900 married filing jointly) pays a 0% federal rate on long-term capital gains, confirmed by IRS Revenue Procedure 2025-32. If your income lands inside that bracket, you can sell an appreciated position, realize the gain, and owe nothing on it federally.
Immediately buying the position back afterward is completely fine. Unlike the wash sale rule, there is no restriction on repurchasing after a gain; that rule only ever applies to losses. The benefit here isn't tax savings today, it's a reset. Your cost basis moves up to what you just paid, which shrinks the taxable gain if you sell later in a year when your income, and your rate, are higher.
This works best for retirees, anyone with a gap year in income, or younger investors still in a low bracket, and it's a genuinely underused move specifically because most tax-loss content never mentions it exists. It pairs naturally with a long-term, buy-and-hold approach like dollar-cost averaging, where you already own a position long enough to qualify for the lower long-term rate.
9. Tax Loss Harvesting: How to Report It on Your Return
Every sale that involves a wash sale gets reported on Form 8949, which feeds into Schedule D. Investor.gov's (SEC) glossary entry on tax loss harvesting_LINK confirms the same basic mechanic described throughout this guide, straight from the regulator's own glossary.
Your broker flags wash sales with code "W" on Form 1099-B, in box 1f. That code only covers activity inside that one brokerage account, though. If you triggered a wash sale by trading the same security across two different brokers, or in your spouse's account, neither broker will catch it. You're responsible for finding and reporting it yourself.
| Form 8949 column | What goes there |
|---|---|
| (a) Description | The security, with "(W)" noted if a wash sale applies |
| (f) Code | "W" for a wash sale adjustment |
| (g) Adjustment | The disallowed loss amount, entered as a positive number |
| (h) Gain or loss | Reduced or zeroed out by the amount in column (g) |
One more thing worth checking before you count on the federal savings: your state. Most states follow the federal rules, but a handful, including New Jersey and Pennsylvania, don't allow capital losses to offset ordinary income the way the federal return does. If you live in one of those states, your actual savings will be lower than the federal-only number this article's calculator shows.
10. A Real Tax Loss Harvesting Example: Same Losses, Different Outcomes
Maria and David each hold a stock down $6,000 from where they bought it, and both decide to harvest the loss in December.
| Maria | David | |
|---|---|---|
| Sells at a loss | $6,000 | $6,000 |
| Replacement purchase | A different index, day of sale | Same fund, 12 days later |
| Wash sale? | No | Yes, fully |
| Loss usable this year | $6,000 | $0 |
| What happens to the loss | Offsets gains or income now | Added to new shares' cost basis, deferred |
Both investors did the same thing on paper, sold a loser and stayed invested. Maria's 12-day head start on David cost him the entire deduction for the year, not because he made a mistake exactly, but because he rebought too soon without realizing the clock was already running.
11. Frequently Asked Questions
12. Final Thoughts
As a tax loss harvesting strategy, this is one of the few tax moves an investor can make entirely within their own control, no legislation required, no special account, just the timing of a sale. The wash sale rule is the one real constraint, and it catches far more people through IRAs, RSU vesting, and dividend reinvestment than through the obvious mistake of buying back too soon on purpose.
Keep the 61-day window in mind, check every account you and your spouse control before harvesting, and remember the strategy has a mirror image: if your income is low enough this year, realizing gains on purpose can be just as valuable as realizing losses. And if all this harvesting pushes your filing past April, our tax extension guide covers what buys you more time and what still doesn't.
This article is for general information only and is not tax or financial advice. Rules and figures described here reflect IRS Publication 550, IRS Topic No. 409, and IRS Revenue Procedure 2025-32, read 19 August 2026. Tax rates and thresholds change yearly and vary by your specific situation; confirm current figures and how they apply to you with a qualified tax professional before acting. Whether a specific fund swap avoids the wash sale rule depends on facts the IRS has not published definitive guidance on. Figures in examples are illustrative, not guarantees of any specific outcome.Disclaimer.