VVested
US Investing··18 min read·Reviewed June 2026

Tax-loss harvesting and the wash-sale rule: the complete playbook

Offset capital gains, take $3,000 of ordinary income, carry losses forward, and avoid the wash-sale traps that quietly disallow your harvest — for US investors.

Share:XLinkedInWhatsApp

You finally decide to trim the concentrated pile of company stock that has crept up to a third of your net worth, you brace for the capital gains tax — and then you notice that two of your diversified index funds are sitting below what you paid for them. Those paper losses are not just a sad number on a statement; handled correctly they are a tax asset that can cancel the gain you are about to realize, shave $3,000 off your ordinary income, and keep working for years. The catch is a single rule — the wash-sale rule — that can quietly disallow the whole harvest if an RSU vest, an ESPP purchase, or a dividend reinvestment lands in the wrong 61-day window.

The 30-second answer: Tax-loss harvesting means selling a holding at a loss to offset realized capital gains, then up to $3,000 of ordinary income per year ($1,500 if married filing separately), with any remainder carried forward indefinitely. Losses offset same-character gains first — short-term against short-term, long-term against long-term — then net across. The wash-sale rule disallows a loss if you buy a substantially identical security within 30 days before or after the sale, a 61-day window; the disallowed loss is deferred into the replacement shares, not destroyed, and the rule reaches your IRA and your spouse's accounts. An RSU vest, ESPP buy, or DRIP in the same stock can trip it. The fix is to replace the sold fund with a similar-but-not-identical one.

This guide is a spoke off the tax-saving playbook: it takes one tool from that menu — tax-loss harvesting — and works it through in full, including the wash-sale traps that are unusually easy to trip when part of your wealth arrives as vesting equity. It assumes you are a US resident filing a US return, with RSU proceeds sitting inside a diversified portfolio. We will build the mechanics from the ground up, run the math on a single-year offset and a multi-year carryforward, and then walk slowly through the vest-date trap that costs equity-comp holders their harvest every spring.

What tax-loss harvesting actually does

Tax-loss harvesting is the act of selling a holding that is worth less than you paid for it, so that the realized loss becomes a number on your tax return that offsets gains you have realized elsewhere. The economic position barely changes if you do it right — you sell the losing fund and immediately buy a near-identical one, so your market exposure continues — but the tax position changes a great deal, because you have converted an unrealized loss into a realized one you can use.

The reason this matters for an RSU holder is that diversifying out of concentrated company stock means realizing gains, and gains are taxed. A harvested loss offsets those gains dollar for dollar before any tax is calculated. If you realize a $40,000 gain trimming employer stock and you also harvest $12,000 of losses from index funds that drifted below cost, you are taxed on $28,000, not $40,000. The loss did not cost you anything economically — you still own equivalent market exposure through the replacement fund — but it absorbed $12,000 of taxable gain.

The order in which losses are applied is set by statute, and getting it right is the whole craft. Short-term losses first offset short-term gains, long-term losses first offset long-term gains, and only then do you net the two together. If a net loss remains after all gains are absorbed, up to $3,000 of it offsets ordinary income each year ($1,500 married filing separately), and anything still left carries forward indefinitely to future years, keeping its short-term or long-term character. Nothing is wasted; a loss too large to use this year simply waits.

Bottom line: Tax-loss harvesting converts a paper loss into a realized one that offsets capital gains first by character, then up to $3,000 of ordinary income per year, with the remainder carried forward forever — and because you rebuy a similar fund, your market exposure stays intact while the loss does its work.

Worked example. Offsetting a $40,000 gain

Suppose you trim your employer stock this year and realize a $40,000 long-term capital gain. You are a high earner, so your long-term rate is 15% plus the 3.8% Net Investment Income Tax — 18.8% all in. Separately, two broad index funds you bought near a market peak are now below cost, and you can harvest $12,000 of long-term losses by selling them and rotating into a different issuer's fund that tracks a different index.

LineWithout harvestingWith harvesting
Long-term gain from trimming employer stock$40,000$40,000
Harvested long-term losses$0−$12,000
Net taxable long-term gain$40,000$28,000
Tax at 18.8%$7,520$5,264
Tax saved this year$2,256

The $12,000 of losses cancels $12,000 of gain, and the tax on that slice — $2,256 — never comes due this year. You diversified the same amount out of your employer stock either way, but the harvest meant you kept $2,256 that would otherwise have gone to tax. The honest framing is that this is a deferral as much as a saving: you rebought a similar fund, so your basis in the new fund is lower, and the gain may resurface when you eventually sell it. But deferral has real value — you keep the money compounding in the meantime, and you may sell the replacement in a lower-rate year, gift it, or step its basis up at death.

Bottom line: A $12,000 harvest against a $40,000 gain at 18.8% saves $2,256 of tax this year and keeps your market exposure unchanged through the replacement fund — treat it as a valuable deferral rather than a permanent erasure, because the lower basis on the replacement can surface the gain later.

The wash-sale rule, in full

This is the rule that turns a clean harvest into a disallowed one, and it is worth reading slowly because the traps are not obvious. The wash-sale rule says: if you sell a security at a loss and buy a substantially identical security within 30 days before or 30 days after the sale, the loss is disallowed. That is a 61-day window — 30 days on each side plus the sale day itself — and the "before" half surprises people, because a purchase you made three weeks before the sale can disallow it just as surely as one made afterward.

Crucially, the disallowed loss is not destroyed — it is deferred. The amount disallowed is added to the cost basis of the replacement shares, and the holding period of the sold shares tacks onto them. So you recover the loss when you eventually sell the replacement shares; you have simply postponed the benefit rather than lost it. This softens the blow, but a deferred loss is worth less than one you can use now, and it complicates your basis records.

The rule's reach is wider than one account. It applies across all your accounts, including your IRA — and a wash sale triggered by an IRA purchase is genuinely lost, because there is no taxable basis in an IRA to adjust, so the deferral mechanism does not bail you out. Per IRS guidance, it also reaches your spouse's accounts. One more asymmetry to commit to memory: the wash-sale rule applies to losses only, never to gains. Selling at a gain and rebuying immediately is always fine, which is why tax-gain harvesting — realizing gains in a low-rate year to step up basis — is never blocked by this rule.

QuestionWash-sale answer
What triggers it?Buying a substantially identical security within 30 days before or after a loss sale
How long is the window?61 days total (30 before, sale day, 30 after)
Is the loss lost?No — disallowed amount is added to the replacement shares' basis (deferred)
Which accounts count?All yours, including your IRA, plus your spouse's accounts
Does it apply to gains?No — losses only
What counts as a "buy"?Any acquisition: a normal purchase, a DRIP, an ESPP purchase, or an RSU vest

Bottom line: The wash-sale rule disallows a loss when you acquire a substantially identical security within the 61-day window, defers that loss into the basis of the replacement shares rather than destroying it, and reaches across your IRA and your spouse's accounts — but it never touches gains, and any acquisition, including a DRIP or RSU vest, counts as the triggering buy.

How to replace a holding without tripping the rule

The whole point of harvesting is to book the loss without going to cash and missing the market's next move. The way to do that safely is to replace the sold fund with one that is similar but not substantially identical, so your exposure barely changes while the loss stays allowed.

In practice this means switching the index, the issuer, or both. Sell a total US market index fund and buy a different provider's S&P 500 fund; or sell one S&P 500 ETF and buy a fund tracking a different large-cap index from a different issuer. Funds that track different indexes from different issuers are generally treated as not substantially identical, even when their returns move almost in lockstep. That correlation is exactly what you want — your portfolio behaves the same — while the legal distinction keeps the loss alive. The IRS has never published a bright-line test of "substantially identical" for funds, so the conservative practice is to make the replacement genuinely different in index and issuer rather than, say, swapping two S&P 500 funds from the same provider.

What you must not do is sell a fund and rebuy the same fund inside the window, or buy back the identical fund in your IRA or your spouse's account, or leave dividend reinvestment switched on in the security you are harvesting so that a small automatic DRIP buy lands in the window. After 31 days you are free to switch back to your original fund if you prefer it, having booked the loss in the meantime — though many investors simply keep the replacement to avoid a second round of trading and a fresh wash-sale window.

Bottom line: Replace the sold fund with a different-index, different-issuer fund so your exposure continues while the loss stays allowed, never rebuy the identical fund anywhere within the 61-day window including your IRA and your spouse's accounts, and turn off dividend reinvestment in the harvested security so an automatic DRIP does not quietly disallow the loss.

Why short-term losses are usually the more valuable harvest

Not all harvested losses are worth the same, and the difference traces back to the ordering rules and the rates behind each character. Short-term losses offset short-term gains first; long-term losses offset long-term gains first. Short-term gains are taxed at your ordinary rate, which for high earners reaches 37%, while long-term gains top out at 20% plus the 3.8% NIIT, or 23.8%. A loss that knocks out a short-term gain is therefore sheltering income at a far higher rate than one that cancels a long-term gain.

This has a practical consequence when you hold several purchase lots of the same fund — some bought less than a year ago, some longer. Selling the short-term lots at a loss generally produces the more valuable harvest, because that short-term loss can wipe out short-term gains taxed at up to 37%. It also matters for the carryforward: a short-term loss carried into next year stays short-term and retains that high-rate offsetting power, so short-term capacity is the scarcer, more valuable kind.

The caveat is the usual one. Do not let the tax character drag you into a worse portfolio decision — for instance, forfeiting a holding period that is about to qualify for long-term treatment on shares you actually want to keep. Let the portfolio decision lead and use tax character as the tiebreaker when you genuinely have a choice of which lots to sell.

Bottom line: Short-term losses offset short-term gains taxed at up to 37%, while long-term losses offset gains capped at 23.8%, so when you can choose which lots to sell, the short-term loss is usually the more valuable harvest and carries that high-rate power forward — but never let tax character override the right portfolio decision.

Worked example. A $60,000 loss carried forward over several years

Carryforwards are where harvesting compounds quietly across years, so it helps to see one run its course. Suppose a sharp market drop lets you harvest a $60,000 long-term loss in a single year — you sell deeply underwater funds and rotate into different-index replacements, so your exposure continues. In that same year you have no capital gains to offset. Here is how the $60,000 gets used, assuming modest realized gains in later years and the $3,000 annual ordinary-income deduction each year.

YearLoss available at startGains offsetOrdinary income offsetLoss carried to next year
1$60,000$0$3,000$57,000
2$57,000$20,000$3,000$34,000
3$34,000$10,000$3,000$21,000
4$21,000$15,000$3,000$3,000
5$3,000$0$3,000$0

Over five years the single $60,000 harvest offsets $45,000 of capital gains and $15,000 of ordinary income ($3,000 in each of five years), and is then fully used. The capital gains it absorbed — say at 18.8% — were worth about $8,460 in tax, and the ordinary-income deduction at, say, a 32% marginal rate added roughly $4,800 more, for a combined benefit in the neighborhood of $13,000 spread across the five years. The number depends entirely on your actual gains and rates in each year, but the shape is the lesson: a loss too large to use at once is not wasted — it becomes a multi-year shelter that grinds down your tax bill $3,000 of ordinary income at a time, plus whatever gains you happen to realize, until it is gone.

Bottom line: A $60,000 harvest that cannot be used in one year carries forward indefinitely, sheltering future capital gains in full and chipping $3,000 a year off ordinary income, so a single bad-market harvest can deliver roughly $13,000 of tax benefit spread across five years — the carryforward never expires, so a large loss is a durable asset, not a one-shot deduction.

The RSU vest-date trap

This is the section equity-comp holders most need and most often skip. The wash-sale rule counts any acquisition of a substantially identical security as a purchase — and for someone with company stock, acquisitions happen automatically on a schedule you did not pick. An RSU vest delivers shares of your employer. An ESPP purchase buys shares on the offering's purchase date. Dividend reinvestment buys fractional shares every quarter. Each of these is a "buy" for wash-sale purposes, and any of them landing inside the 61-day window around a loss sale in that same stock will disallow part or all of your harvest.

The trap is that these dates are easy to forget precisely because they are automatic. You harvest a loss on company stock you bought through an old ESPP, feeling clever, and ten days later a long-scheduled RSU tranche vests in the same ticker — and the IRS treats those vested shares as replacement shares, disallowing your loss up to the number of shares that overlap. The disallowed amount is added to the vested shares' basis, so it is deferred rather than destroyed, but you have lost the use of it now and complicated your records. The defenses are simple once you know to look: check your vest, ESPP, and DRIP calendar before harvesting any position in your employer's stock, push the loss sale outside the 61-day window if a vest sits inside it, and switch off dividend reinvestment in any security you intend to harvest.

Worked example. A $10,000 harvest half-disallowed by a vest

Suppose you harvest a $10,000 loss on 1,000 shares of company stock — you sell them at $40 having bought at $50, so the loss is $10 per share. Ten days later, a scheduled RSU tranche vests delivering 500 shares of the same company. Those 500 vested shares are treated as replacement shares, so the loss on 500 of your sold shares is disallowed; the loss on the other 500 stands.

ItemSharesPer-share lossLoss status
Sold shares matched by the vest500$10Disallowed — deferred into vest basis
Sold shares with no replacement500$10Allowed — $5,000 usable now
Total1,000$5,000 allowed, $5,000 deferred

So $5,000 of your intended $10,000 harvest is usable this year, and the other $5,000 is disallowed. That disallowed $5,000 is added to the basis of the 500 vested shares — their cost basis rises by $10 each — and their holding period tacks on the sold shares' period, so you recover the benefit when you eventually sell those vested shares. You did not lose the deduction permanently, but you lost the use of half of it this year, and all of it could have been avoided by selling 11 days later, outside the window. That is the entire lesson of the trap: the calendar, not the math, is what costs you.

Bottom line: An RSU vest, ESPP purchase, or DRIP in your employer's stock counts as a wash-sale buy, so a vest inside the 61-day window disallows the harvest up to the overlapping shares — the loss is deferred into the vest basis, not destroyed, but you lose its current use, which a quick check of your vest and reinvestment calendar before harvesting would have prevented.

Common mistakes

  • Forgetting the "before" half of the window. A purchase made up to 30 days before the sale disallows the loss just as a later one does; the window is centered on the sale, not in front of it.
  • Leaving dividend reinvestment on. A small automatic DRIP buy in the harvested security inside the window triggers a partial wash sale on the whole lot — switch reinvestment off before you harvest.
  • Rebuying the identical fund in an IRA. A wash sale caused by an IRA purchase is genuinely lost, because an IRA has no taxable basis to absorb the deferred loss — never rebuy the same security in your IRA inside the window.
  • Ignoring a spouse's account. The rule reaches your spouse's accounts per IRS guidance, so a buy on their side can disallow a loss you harvested on yours.
  • Swapping two near-identical funds from the same issuer. To stay clearly on the safe side, change both index and issuer rather than buying an almost-twin of the fund you sold.
  • Harvesting tiny losses and ignoring transaction friction. On a small loss, bid-ask spreads, the bookkeeping, and the lower basis you create can outweigh the modest tax benefit — harvest where the numbers are worth it.
  • Treating the saving as permanent. Rebuying a similar fund lowers your basis, so part of the benefit is deferral; model the resurfacing gain rather than assuming the tax simply vanished.

The closing read

Tax-loss harvesting is one of the few moves in personal finance that lowers your tax bill without changing your investment posture: you book a loss you already hold, rotate into a similar fund, and let that loss offset the gains you realize as you diversify out of concentrated equity — then up to $3,000 of ordinary income, then forward forever. The discipline it demands is small but unforgiving, and it lives almost entirely in the wash-sale rule. Keep the 61-day window in view, replace with a different-index, different-issuer fund, switch off reinvestment in the security you are harvesting, and above all check your vest, ESPP, and DRIP calendar before you sell company stock at a loss, because the one acquisition you forgot is the one that disallows the harvest. Get those details right and harvesting is close to free money for the organized; get them wrong and you have deferred a deduction you thought you had banked. Let the portfolio decision lead, treat the tax as the tiebreaker, and let the calendar — not the math — be the thing you double-check.

Cross-references

Critical disclaimer: this article reflects US federal tax rules as of June 2026 and is general information, not personalised advice. The $3,000 ordinary-income limit, the wash-sale window, NIIT thresholds, capital gains rates, and the treatment of substantially identical securities can change and depend on your specific facts, state of residence, lot basis, and account structure. The wash-sale treatment of RSU vests, ESPP purchases, and a spouse's accounts is fact-specific. This does not substitute for advice from a licensed CPA or CFP, and nothing here is a recommendation to buy or sell any specific security.

Run your own numbers

Try the calculators that match this post

Found this useful? Share it.

Help another Indian working with US RSUs or LRS not get blindsided by this stuff.

Share:XLinkedInWhatsApp

About the author

Shivang Badaya
Shivang Badaya

Co-Founder & Chief Executive Officer, Rovia

CFA charterholder with 10+ years across hedge funds and NRI fintech. Covers RSU taxation, equity comp, and cross-border investing for Indian residents. Ex-JP Morgan, Makrana Capital, Zolve.

More about Shivang

Get more like this in your inbox

One practical post a week on US investing & RSU strategy.