Editorial process
Money walkthrough

The Wash-Sale Rule and Tax-Loss Harvesting

This explainer covers tax-loss harvesting and the wash-sale rule: the 30-day window that disallows a loss, and why similar funds still trip people up.

Short answer: Tax-loss harvesting means selling an investment at a loss to use that loss for tax purposes. The wash-sale rule disallows that loss if you buy the same or a substantially identical security within 30 days before or after the sale, a combined window of about 61 days. A disallowed loss is not gone; it generally gets added to the replacement shares' cost basis instead. The hardest part is "substantially identical," which has no exhaustive official list and trips people up most often with similar index-tracking funds.

A calculator beside two uneven stacks of coins and a closed envelope on a desk, lit by soft window light
What's in this walkthrough
  1. What tax-loss harvesting is trying to do
  2. The wash-sale rule in one sentence
  3. The 30-day window, both directions
  4. What counts as a replacement purchase
  5. Why “substantially identical” is the hard part
  6. Similar-but-not-identical funds: why they still trip people up
  7. What actually happens to a disallowed loss
  8. Illustrative example of the basis adjustment
  9. Illustrative tax effect of a wash sale versus a clean harvest
  10. Illustrative split of one harvested loss, disallowed versus allowed
  11. Retirement accounts and the wash-sale rule
  12. Harvesting across a married couple’s accounts
  13. Dividend reinvestment: the accidental wash sale
  14. How brokerages report, and do not report, wash sales
  15. A deliberate strategy: harvesting without a 30-day gap
  16. Common mistakes with tax-loss harvesting
  17. A worked example: one investor’s harvested loss
  18. Using a tax-loss harvesting calculator
  19. How this fits into a broader tax plan
  20. Who should probably talk to a tax professional first
  21. Short sales and options: the rule’s less obvious reach
  22. Why the rule only mentions losses, not gains
  23. Year-end timing and why the window matters most in December
  24. The bottom line

Short answer: Tax-loss harvesting means selling an investment at a loss to use that loss for tax purposes. The wash-sale rule disallows that loss if you buy the same or a substantially identical security within 30 days before or after the sale, a combined window of about 61 days. A disallowed loss is not gone; it generally gets added to the replacement shares' cost basis instead. The hardest part is "substantially identical," which has no exhaustive official list and trips people up most often with similar index-tracking funds.

Tax-loss harvesting is a simple idea with a genuinely tricky rule sitting right in the middle of it. The idea: realize a loss on an investment that has fallen in value, and use that loss to offset gains or a limited amount of ordinary income on your tax return. The rule: the wash-sale rule, which disallows exactly this maneuver if you turn around and buy back essentially the same position too soon, because without that rule an investor could sell and immediately rebuy the identical shares, claiming a loss on paper while never actually changing their investment exposure for more than an instant.

This explainer covers the wash-sale mechanism from end to end: the 30-day window in both directions, what counts as a substantially identical security and why that question is harder than it looks, what actually happens to a disallowed loss, the cross-account wrinkle involving retirement accounts, and the accidental triggers, like dividend reinvestment, that catch people who were not even trying to game the rule. Our separate coverage of long-term versus short-term capital gains tax explains the gains side of this picture; this explainer is figurelab’s own dedicated treatment of the loss side and the rule that governs it. Every dollar figure here is illustrative. Model your own harvested loss with the calculator as you read.

Key takeaways

  • The wash-sale rule disallows a tax loss if you buy the same or a substantially identical security within 30 days before or after the loss sale, a combined window of about 61 days.
  • "Substantially identical" has no exhaustive official list; two similar index funds are the hardest case and genuinely depend on the specific funds involved.
  • A disallowed loss is not lost forever; it generally gets added to the replacement shares' cost basis, deferring rather than eliminating the tax benefit.
  • Buying a substantially identical security inside an IRA or 401(k) after harvesting a loss in a taxable account can still trigger a wash sale, and in that case the disallowed loss generally cannot be added to the IRA's basis at all.
  • Automatic dividend reinvestment is one of the most common accidental triggers, since it can land inside the window without any deliberate repurchase decision.

What tax-loss harvesting is trying to do

At its core, tax-loss harvesting is about timing: realizing a loss deliberately, often near year end but potentially any time, so that loss can be used on your tax return to offset capital gains realized elsewhere in your portfolio, and, up to a limited amount, to offset ordinary income as well, with any excess loss generally available to carry forward to future tax years. The investment itself does not have to be abandoned forever; the strategy is specifically about capturing the tax value of a decline without necessarily walking away from the underlying asset class or strategy for good.

That last point is exactly where the wash-sale rule enters the picture. If an investor could sell a losing position and immediately buy back the identical shares, they would capture the tax loss while keeping their investment exposure essentially unchanged for the entire holding period that mattered, which would turn tax-loss harvesting into a nearly costless, repeatable maneuver with little economic substance behind it. The wash-sale rule exists specifically to prevent that.

The wash-sale rule in one sentence

Stated as plainly as the mechanism allows: if you sell a security at a loss and buy the same or a substantially identical security within 30 days before or after that sale, the loss is disallowed for current tax purposes. Every important detail of tax-loss harvesting flows from unpacking that one sentence carefully, which is what the rest of this explainer does.

A phone and a laptop both showing a choice between Option 1 and Option 2 on an account screen
Choosing a replacement security during the wash-sale window is exactly this kind of decision: Option 1, a substantially identical fund that disallows the loss, or Option 2, a meaningfully different one that does not.

The 30-day window, both directions

The window is frequently described only as a forward-looking rule, something to watch out for after a sale, but the mechanism actually runs in both directions: 30 days before the sale and 30 days after it, for a combined span that generally works out to about 61 days once the sale date itself is included. This means a purchase of a substantially identical security made before you even decide to sell your losing position, perhaps as part of an ordinary, unrelated rebalancing trade, can disallow the loss on a sale that comes afterward, even though at the time of the purchase you had not yet harvested anything.

This backward-looking piece is the part that catches the most people off guard, because it requires looking at trades you made before the harvesting decision, not just trades you make after it. Anyone planning a harvest should check both directions around the intended sale date, not just the weeks that follow it.

What counts as a replacement purchase

A replacement purchase, for wash-sale purposes, generally includes any way the same or a substantially identical security re-enters your position within the window, not only a deliberate, manually placed buy order. This includes shares acquired through automatic dividend reinvestment, shares acquired through an employer stock purchase or retirement plan contribution, and shares acquired in an account you do not think of as connected to the one where you harvested the loss, including certain accounts belonging to a spouse. The rule looks at the economic substance of re-establishing the position, not the specific mechanism or account through which it happens.

This broad scope is precisely why accidental wash sales are so common. An investor can harvest a loss deliberately and carefully in one account, only to have an automatic dividend reinvestment in a completely different account quietly trigger a wash sale without any conscious repurchase decision at all.

Why “substantially identical” is the hard part

The rule’s text turns on whether a replacement security is the same or “substantially identical” to the one sold, and that second phrase is where genuine ambiguity lives. Buying back the literal same stock, or the literal same mutual fund or ETF, is clearly substantially identical and clearly triggers the rule. Buying a completely different company in a different industry, or a fund tracking a meaningfully different asset class, is clearly not substantially identical and clearly does not trigger it.

The hard cases sit in between, and there is no exhaustive, official list that resolves every one of them. Two different index funds tracking the same underlying index using very similar methodology are the classic hard case: are they substantially identical because they track the same index, or not substantially identical because they are legally distinct funds from different providers with potentially different holdings weightings or structures. Reasonable, informed people and even professionals can and do disagree on specific pairs of funds, which is why this explainer is not going to assert a confident answer for any particular fund comparison; that determination is genuinely fact-specific and worth confirming with a tax professional for your actual intended trade.

Similar-but-not-identical funds: why they still trip people up

Because “substantially identical” is ambiguous rather than clearly defined, many investors who harvest losses deliberately choose a replacement security they believe sits safely on the not-substantially-identical side of the line, often a fund tracking a related but distinct index or a fund from a different provider with different underlying holdings, specifically to maintain similar market exposure during the 30-day window without triggering the rule. This approach is widely used and widely discussed, but it still carries some genuine uncertainty, since the specific comparison between any two funds has not necessarily been definitively resolved by the kind of clear official guidance that would remove all doubt.

The practical lesson is not that this approach is wrong, but that it carries real, if generally modest, residual uncertainty that a confident-sounding explainer should not paper over. Investors uncomfortable with that residual uncertainty sometimes choose instead to simply wait out the full window before returning to their original position, accepting a period of different market exposure in exchange for more certainty about the tax outcome.

A close-up of a hand turning a round dial set into a wood panel
Choosing a replacement security during the window is a dial, not a switch: how similar it is to the original position is a matter of degree, and the wash-sale line sits somewhere along that dial rather than at a clearly marked point.

What actually happens to a disallowed loss

It is a common misconception that a wash sale simply erases the loss, as though the transaction had never generated one at all. The more accurate mechanism is that the disallowed loss is generally added to the cost basis of the replacement shares that triggered the disallowance, and the holding period of the original shares can also carry over to the replacement shares in some circumstances. This means the economic benefit of the loss is not destroyed, it is deferred: when you eventually sell the replacement shares in a transaction that is not itself caught by another wash sale, the increased basis will generally reduce your taxable gain or increase your deductible loss at that later point.

This deferral mechanic is exactly why a wash sale is usually described as a timing problem rather than a permanent loss of value. The real cost of an unintended wash sale is typically not losing the tax benefit altogether, it is losing the ability to use that benefit in the specific tax year you intended to use it, which can matter if you were counting on the loss to offset a specific gain realized that same year.

Illustrative example of the basis adjustment

Picture an illustrative purchase of shares for $10,000 that later falls to $7,000 in value. An investor sells at that $7,000 price, realizing an illustrative $3,000 loss, and then, inside the 30-day window, buys back a substantially identical security for $7,200. The wash-sale rule disallows the $3,000 loss for current tax purposes, and that $3,000 is generally added to the $7,200 purchase price, giving the replacement shares an adjusted basis of about $10,200 rather than their literal $7,200 purchase price.

If those replacement shares are later sold for, say, $11,000 outside of any further wash-sale window, the taxable gain is calculated against the adjusted $10,200 basis, producing an $800 gain rather than the $3,800 gain that the unadjusted $7,200 basis would have produced. The originally disallowed $3,000 loss effectively showed up later, reducing a future gain by the same amount. Every figure in this illustration is a teaching number, not a forecast of any actual security’s performance.

Illustrative tax effect of a wash sale versus a clean harvest

To see the timing cost concretely, picture an illustrative $3,000 loss in two scenarios: one where it is harvested cleanly, with no replacement purchase inside the window, and one where it is caught by a wash sale and deferred into a higher basis instead.

Illustrative tax value of a $3,000 loss, clean harvest versus wash sale

Illustrative figures at an assumed 24 percent rate. Not a prediction of any actual tax outcome.

Clean harvest, usable this year~$720 tax value now
Wash sale, deferred to a later sale$0 tax value this year
Wash sale, value recovered eventually~$720 tax value later

A wash sale generally does not destroy the $720 of illustrative tax value, it postpones it to whenever the replacement shares are eventually sold cleanly. Figures are illustrative and depend on your actual rate and timing.

The middle bar is the point worth sitting with: in the year the wash sale happens, the tax value of the loss is genuinely zero, even though it is not permanently zero. If you needed that value in the current tax year specifically, the deferral is a real cost regardless of what happens later.

Illustrative split of one harvested loss, disallowed versus allowed

Harvesting is not always all-or-nothing; a wash sale can disallow only the portion of a loss that corresponds to replacement shares actually repurchased within the window, while a remaining uncovered portion, if you sold more shares than you repurchased, can still be allowed. Picture an illustrative investor who sold a larger position at a loss but only repurchased part of it within the window.

An illustrative harvested loss, partly disallowed by a partial repurchase

Illustrative figures. Shares sum to 100 percent of the original loss.

Disallowed, matched to repurchased shares: 40% Allowed this year, unmatched shares: 60%
Disallowed portion, added to replacement basis instead Allowed portion, usable on this year's return

Only the portion of a loss matched to shares actually repurchased within the window is disallowed; a partial repurchase disallows only a partial share of the loss. Figures are illustrative and depend on your actual share counts.

This partial mechanic is a useful thing to know if you are intentionally rebuilding only part of a position during the window rather than all of it, since the wash-sale consequence scales with the overlap, not with the whole original sale.

Retirement accounts and the wash-sale rule

Trades made entirely inside a 401(k) or an IRA do not themselves generate a current taxable loss, since those accounts are not taxed transaction by transaction, so the core wash-sale mechanism has nothing to disallow in that context on its own. The wrinkle that does matter is a cross-account one: if you harvest a loss in a taxable brokerage account and then buy the same or a substantially identical security inside an IRA or 401(k) within the window, guidance addressing this scenario has generally treated that as still triggering a wash sale on the taxable-account loss.

What makes this cross-account version worse than an ordinary wash sale is that there is generally no mechanism to add the disallowed loss to the basis of shares held inside an IRA, since IRA basis does not work the same way taxable-account basis does. The practical result can be that the loss is not merely deferred, as in an ordinary wash sale, but effectively lost for good. This is a strong reason to treat your taxable and retirement accounts as one combined picture when planning a harvest, rather than assuming a purchase inside a retirement account is automatically outside the rule’s reach.

Harvesting across a married couple’s accounts

The same household-level thinking generally applies to a spouse’s accounts. For married couples, a purchase of a substantially identical security by one spouse within the window around the other spouse’s loss sale has generally been treated, in relevant guidance and case law addressing similar arrangements, as reachable under the wash-sale rule, on the reasoning that the couple’s combined economic position did not meaningfully change. Using a spouse’s account as a way to maintain the position while technically avoiding a same-person repurchase is not a reliable workaround.

The safer approach for a couple intending to harvest a loss is to treat every account either spouse controls, across both taxable and retirement accounts, as a single combined universe when checking for a wash sale, exactly as this explainer suggests individual investors do with their own retirement accounts.

Dividend reinvestment: the accidental wash sale

Perhaps the single most common unintentional trigger is automatic dividend reinvestment. An investor harvests a loss deliberately and carefully, checking for any manual repurchases in the window, only to have a routine, automatic dividend reinvestment in the same or a different account quietly buy more shares of the same or a substantially identical security a few days later, disallowing part or all of the loss without any conscious decision involved at all.

Anyone planning a deliberate harvest should check whether dividend reinvestment is active on the position being sold, or on any substantially identical position held elsewhere, and consider temporarily turning off automatic reinvestment on a holding before harvesting a loss in it, turning it back on again once the window has safely passed.

How brokerages report, and do not report, wash sales

Brokerages are generally required to track and report certain wash sales on tax documents, but that reporting is typically limited to identical securities within the same account at the same brokerage, and it generally does not catch substantially identical securities across different accounts, different brokerages, or a spouse’s holdings. This means the tax document you receive may understate your actual wash-sale exposure if any part of the triggering repurchase happened outside the specific account and brokerage that generated the loss.

The practical implication is that you, not your brokerage’s year-end tax form, are ultimately responsible for checking across your full picture, including other accounts and a spouse’s accounts, rather than assuming a clean 1099 from one brokerage means no wash sale occurred anywhere in your broader financial life.

A hand writing in a spiral notebook beside a calculator and a mug of coffee
Checking for a wash sale across every account, not just the one where the loss was realized, is the kind of cross-referencing a brokerage's own tax form generally will not do for you. A simple habit that helps is keeping a running, dated list of every purchase and sale across all of your household's taxable and retirement accounts, updated at the time each trade happens rather than reconstructed later from memory, so that checking the 61-day window around any future harvest is a quick lookup instead of a stressful reconstruction project under a year-end deadline.

A deliberate strategy: harvesting without a 30-day gap

Investors who want to maintain continuous market exposure during the window, rather than sitting out of the market or accepting a residual uncertainty about a similar-fund replacement, sometimes use a double-up strategy: buying additional shares of the position well before any intention to harvest, then waiting at least 31 days after that purchase before selling the original, older shares at a loss. Done correctly, the position is never actually out of the market and the replacement shares were not purchased within the window relative to the loss sale, since they were bought more than 30 days before it.

This approach requires careful tracking of purchase dates and generally requires choosing specifically which tax lots to sell, since a broker may default to a different lot-identification method unless instructed otherwise. It is a more precise, deliberate way to avoid the rule compared to hoping a similar-but-different fund clears the substantially-identical bar, though it requires having the cash and the willingness to temporarily hold a larger position before paring back.

Common mistakes with tax-loss harvesting

A short list of recurring errors is worth naming plainly. The first is checking only the 30 days after a sale and missing a purchase made in the 30 days before it. The second is assuming a fund that merely tracks a similar index is automatically safe, when the actual determination is more fact-specific and uncertain than that. The third is forgetting about automatic dividend reinvestment running quietly in the background. The fourth is assuming a retirement account purchase is automatically exempt from any interaction with a taxable-account loss. The fifth is using a spouse’s account as an intentional workaround rather than treating household accounts as one combined picture.

A worked example: one investor’s harvested loss

Make it concrete with an illustrative investor. Priya holds a fund that has fallen from an illustrative $20,000 purchase price to $16,000. Wanting to harvest the $4,000 loss before year end, she first checks her entire household’s accounts, including her spouse’s IRA, for any purchase of the same or a substantially identical fund in the preceding 30 days, and finds none. She sells the position, realizing the $4,000 loss, and immediately buys a different fund tracking a related but distinct index to maintain similar market exposure during the window, rather than the identical fund.

Thirty-one days later, having confirmed no dividend reinvestment triggered an accidental repurchase of the original fund anywhere in her household’s accounts, Priya is free to either keep the replacement fund or rotate back into her original position without disturbing the loss she already harvested. The $4,000 loss is fully usable on her return for the year, since no wash sale occurred. Priya also checks her own notes from earlier in the year and confirms she made no purchases of the original fund in the 30 days before the sale either, closing off the backward-looking half of the window that is so easy to forget. Every figure and fund description in this example is illustrative.

Using a tax-loss harvesting calculator

A calculator cannot tell you whether a specific pair of funds counts as substantially identical, and it should not pretend to, since that determination depends on genuine facts about the funds involved that only a tax professional reviewing your specific situation can weigh properly. What it can usefully do is take your own illustrative inputs, your purchase price, your current value, and your marginal tax rate, and show you the illustrative tax value of harvesting the loss, along with how a wash sale would defer that value by adjusting a hypothetical replacement’s basis instead. The calculator on this page runs that comparison so you can see the shape of the timing effect with your own numbers.

Treat any output as illustrative, and remember that the calculator cannot check your other accounts, your spouse’s accounts, or your dividend reinvestment settings for you; that cross-checking is still entirely on you, no matter how precise the illustrative dollar figures it produces look on the screen. Our explainer on taxable accounts versus retirement accounts covers the broader account-placement decisions this strategy sits within.

How this fits into a broader tax plan

Tax-loss harvesting is generally one tool among several in a broader tax-aware investing approach, and it works best when considered alongside your overall gain and loss picture for the year, not in isolation. A harvested loss is most valuable when it offsets a gain you would otherwise owe tax on this year, or when it is small enough relative to the annual limit on offsetting ordinary income that none of it is wasted by exceeding that limit and simply carrying forward. Our explainer on long-term versus short-term capital gains tax covers how the character of your gains interacts with the losses this explainer focuses on, since matching a harvested loss against the right kind of gain is part of using the strategy well.

Who should probably talk to a tax professional first

A handful of situations make this strategy worth a direct conversation with a tax professional rather than general reading alone, since the cost of an unintended disallowance is usually small for a modest harvest but can be meaningful for a larger one. Anyone considering a replacement security that merely tracks a similar index to the one sold should confirm that specific pairing with a professional rather than assume it clears the substantially-identical line. Anyone harvesting losses across multiple accounts, including a spouse’s accounts or retirement accounts, should have a professional check the combined picture rather than checking each account in isolation. And anyone relying on a harvested loss to offset a specific, meaningful gain in the current tax year should confirm the timing and mechanics well before year end, when there is still room to adjust if something was done incorrectly, rather than discovering a problem only after filing a return that already assumed the loss would be allowed in full.

Short sales and options: the rule’s less obvious reach

The wash-sale rule’s language is not limited to simple buy-low-sell-low stock and fund trades; it is generally written broadly enough to reach certain option contracts and short sales that effectively replicate the same economic position. Entering into an option to buy a substantially identical security within the window, for example, has generally been treated as capable of triggering the rule in the same way an outright share purchase would, because the practical effect, maintaining exposure to the same investment, is similar even though the mechanism looks different on paper.

This broader reach matters most for more active traders who use options or short positions as part of their regular strategy, since a hedge or a speculative position entered for reasons entirely unrelated to tax planning can still land inside a wash-sale window around an unrelated loss sale in the same underlying security. Investors whose activity includes these more complex instruments should treat them as part of the same combined picture described earlier for spouse and retirement accounts, rather than assuming only plain share purchases count. Because the line between an ordinary hedge and a wash-sale-triggering position can be genuinely subtle in options strategies, this is another area where a tax professional familiar with your specific trading pattern is worth more than a general rule of thumb.

Why the rule only mentions losses, not gains

It is worth pausing on an asymmetry that sometimes confuses people new to this topic: there is no equivalent “wash gain” rule that disallows or adjusts a gain if you sell at a profit and immediately buy back the same security. The wash-sale rule exists specifically to prevent taxpayers from manufacturing a tax-reducing loss without real economic change, so it only targets the loss side of that equation. Selling at a gain and buying back immediately is generally just an ordinary taxable event, fully recognized, with no special disallowance mechanism applied to it.

This asymmetry is sometimes used deliberately: an investor might realize a gain in a year when their tax rate is unusually low and immediately buy back the same position to reset its cost basis higher going forward, a maneuver sometimes called gain harvesting, which has no wash-sale equivalent to worry about since the rule simply does not apply to gains. That is a different strategy from the loss-harvesting focus of this explainer, but understanding why the wash-sale rule does not touch it helps clarify exactly what the rule is, and is not, designed to prevent.

Year-end timing and why the window matters most in December

Tax-loss harvesting activity tends to cluster around year end, since that is when an investor has the clearest picture of their total realized gains for the tax year and the strongest incentive to lock in an offsetting loss before the calendar turns. This clustering is also exactly why the wash-sale window matters most in the final weeks of December: a loss harvested too close to year end, followed by a replacement purchase that spills into the new year but still falls within 30 days, can disallow a loss the investor specifically wanted to use on the return for the year that just ended.

A harvest completed with meaningful room before year end, rather than in the final days, gives you a full 30-day runway to confirm no accidental repurchase occurs before the window closes, without bumping up against the calendar boundary itself. Investors who wait until the very last trading days of December to harvest losses are taking on exactly this avoidable timing risk, on top of the ordinary substantially-identical and cross-account questions already covered above. Our walkthrough on doing a mid-year financial checkup covers reviewing your gains and losses earlier in the year, which gives harvesting decisions more breathing room than a year-end scramble does.

The bottom line

Tax-loss harvesting realizes a loss to capture its tax value, and the wash-sale rule disallows that loss if you buy the same or a substantially identical security within 30 days before or after the sale, a combined window of about 61 days running in both directions. A disallowed loss is not destroyed, it is generally added to the replacement shares’ basis and deferred to a later sale, except in the cross-account retirement scenario, where it can effectively be lost for good. The hardest practical question, whether two similar funds are substantially identical, has no exhaustive official answer and deserves a direct conversation with a tax professional for your specific pairing. Dividend reinvestment and a spouse’s accounts are the most common accidental triggers. Model your own harvested loss with the calculator, and confirm any specific replacement security with a qualified tax professional before you trade.


This explainer is educational only and is not tax, legal, or investment advice. The wash-sale rule, including the exact scope of the 30-day window, what counts as a substantially identical security, the cross-account treatment involving IRAs and 401(k)s, and the treatment of a spouse’s accounts, is set by federal tax law and IRS guidance, interpreted in part through case law, and the application of “substantially identical” to any specific pair of securities is genuinely fact-specific and not always clearly settled. Every dollar figure in this piece, including the $10,000, $7,000, $3,000, and $4,000 figures used in the examples and charts, and the illustrative 24 percent tax rate, is a simplified teaching number, not a current rule or a prediction of any actual security’s performance. Before harvesting a loss, choosing a replacement security, or assuming a retirement account purchase is unaffected by a taxable-account sale, confirm the current rules and your specific situation with a qualified tax professional.

Frequently asked questions

What is the wash-sale rule in plain terms?

The wash-sale rule is a mechanism that disallows a tax loss when you sell a security at a loss and then buy the same or a substantially identical security within a window spanning 30 days before and 30 days after the sale. Instead of simply vanishing, the disallowed loss is generally added to the cost basis of the replacement shares, which can reduce a future taxable gain or increase a future deductible loss when those replacement shares are eventually sold outside any wash-sale window. The rule exists to stop a taxpayer from claiming a loss on paper while keeping essentially the same investment position the whole time.

Does the 30-day window only count the days after I sell?

No, and this is one of the most commonly misunderstood parts of the rule. The window generally runs both backward and forward from the sale date, covering 30 days before the sale and 30 days after it, for a combined span of about 61 days including the sale date itself. A purchase of a substantially identical security made before you even sell the original losing position can trigger the same disallowance as a purchase made afterward, which surprises people who only think to check the days following their sale.

What counts as a substantially identical security?

This is the genuinely hard part of the rule, and there is no exhaustive official list that resolves every case. Buying back the exact same stock or the exact same fund is clearly substantially identical. Two different mutual funds or ETFs that track the same underlying index using very similar methodology are the harder case, and whether they count as substantially identical is not always clearly settled, depending on the specific funds involved. Because this determination is genuinely fact-specific and the tax consequences of getting it wrong can be meaningful, confirm your specific replacement choice with a tax professional rather than assuming any general description resolves your case.

Does the wash-sale rule apply inside a 401(k) or IRA?

The core wash-sale disallowance is a rule about taxable transactions, and trades made entirely within a tax-advantaged retirement account generally do not themselves trigger it, since there is no taxable loss being claimed inside the account in the first place. The complication that does matter is cross-account: selling a security at a loss in a taxable account and then buying a substantially identical security inside an IRA or 401(k), including through an automatic dividend reinvestment or a regular contribution, can still trigger a wash sale under guidance addressing this scenario, and in that cross-account case the disallowed loss generally cannot be added to the IRA's basis at all, making it a worse outcome than an ordinary wash sale. Confirm this cross-account scenario with a tax professional before assuming retirement accounts are automatically exempt from any interaction with the rule.

Can my spouse buy the replacement security instead of me?

Generally not without risk. For married couples filing jointly, and in some interpretations for couples filing separately, a purchase by a spouse within the wash-sale window can be treated as if you made it yourself, defeating the purpose of routing the purchase through a different household member. Using a spouse's account, or any other account you still have effective control or shared benefit over, as a workaround is exactly the kind of step-around that tax authorities and courts have generally looked through in similar situations. Treat a spouse's account as part of the same household for wash-sale purposes rather than as a separate workaround.

Does dividend reinvestment count as a purchase that can trigger a wash sale?

Yes, mechanically, if the reinvestment happens to fall within the 30-day window around a loss sale of the same or a substantially identical security. Automatic dividend reinvestment plans do not pause themselves to avoid this, and a routine, otherwise unnoticed reinvestment can inadvertently trigger a wash sale on a harvested loss without the investor realizing it happened until tax documents arrive. This is one of the more common accidental triggers, since it requires no deliberate repurchase decision at all, just an automatic feature running on its normal schedule.

Is a disallowed loss gone forever?

No. A disallowed wash-sale loss is not permanently lost; it is generally added to the cost basis of the replacement shares you purchased, which means it can still reduce your taxable gain, or increase your deductible loss, whenever you eventually sell those replacement shares in a transaction that is not itself caught by the wash-sale rule. The practical effect is a deferral of the tax benefit rather than an elimination of it, though the deferral can matter a great deal if you intended to use the loss in the current tax year specifically.

How do I harvest a loss without worrying about the wash-sale rule at all?

The simplest way to sidestep the rule entirely is to not repurchase the same or a substantially identical security within the 30-day window on either side of the sale, either by waiting out the full window before buying back the original position, or by purchasing a meaningfully different investment that still fits your intended asset allocation during that window. Many investors who harvest losses regularly use the second approach, rotating into a similar but not substantially identical fund during the window and deciding afterward whether to rotate back. Confirm your specific replacement choice avoids the substantially-identical line with a tax professional if you are unsure.

Editorial team · Personal-finance explainers

SumLoft calculators and explainers are written by our editorial team, turning intimidating math into steps a reader can follow and check by hand. Figures are illustrative and labelled, and articles are edited by Hamza Hai, MBA. They are educational general information, not financial advice.

Hamza Hai, Editor
Edited by Hamza Hai, MBA · Editor

Hamza Hai is the editor of SumLoft. She holds an MBA and reviews the site's articles against our editorial standards, checking that every figure is labelled for what it is, that nothing is presented as verified fact without a source the reader can check, and that the writing stays useful to a non-specialist.

How we research, write and review · LinkedIn

Get a planning breakdown by email

Tell us what you are working toward and we will email you a breakdown of the numbers behind it: what the goal costs, and what it takes to get there. We are not an advisor or a broker, we do not manage money, and we will not pass your details to anyone.

We store your details to reply to you. See our privacy policy.