What it means
The rule is easy to state. If you sell a security at a loss and buy substantially identical shares within 30 days before or after the sale, the loss is disallowed for now.
The full period covered is 61 days, made up of the 30 days before the sale, the day of the sale and the 30 days after it. The disallowed loss is not lost forever.
It is added to the cost basis (the amount treated as the original price paid) of the replacement shares, and the holding period of the old shares carries over. This means the tax benefit is deferred until the replacement shares are finally sold outside the window.
The rule exists because without it an investor could sell a losing holding on the last day of the year, claim the loss against other gains, and immediately buy the same holding back. That would produce a tax saving with no real economic change.
Tax authorities treat that as an artificial loss. What counts as substantially identical is a matter of judgement.
Buying back the same company's shares clearly counts, and options or contracts to acquire the same shares can count as well. Swapping into a different company in the same industry usually does not, which is a common planning approach when investors want to stay invested in a sector.
The rule can catch people by surprise through automatic reinvestment, purchases in a spouse's account or purchases in a retirement account. Anyone using tax loss harvesting (selling losers deliberately to offset gains) needs to track the full 61-day window across all accounts.
Other countries have their own anti-avoidance rules, with different time periods and conditions.
In practice
Real-world examples.
Example
An investor with a $15,000 gain on one stock sells a second stock at a $6,000 loss in December to reduce the tax bill. Two weeks later, they buy the same second stock back because they still like the company. The $6,000 loss is disallowed for that year and added to the cost of the new shares.
Example
A fund manager sells units of an energy fund at a loss and immediately buys units of a different energy fund tracking a different index. Because the two funds are not substantially identical, the loss is allowed. The manager keeps exposure to the sector and still obtains the tax benefit.
Example
A retail investor sells shares at a loss in a taxable brokerage account. The next week their automatic dividend reinvestment plan buys a small number of the same shares. The purchase falls within the 30-day window, so part of the loss is disallowed.
Formula
Calculation
Disallowed loss = Purchase cost of sold shares - Sale proceeds
New cost basis of replacement shares = Price paid for replacement shares + Disallowed loss
Suppose an investor buys 100 shares at $50, costing $5,000, and sells them at $40, receiving $4,000. The loss is 5,000 - 4,000 = $1,000. Within 30 days the investor buys 100 identical shares at $42, paying $4,200. Because this is a wash sale, the $1,000 loss is disallowed and the new cost basis becomes 4,200 + 1,000 = $5,200. If those shares are later sold for $5,500, the taxable gain is 5,500 - 5,200 = $300, not $1,300.Case study
Seen in the real world.
Marlowe Ridge Capital is an illustrative, fictional advisory firm whose client, a dentist, held $80,000 of shares in a single technology company that had fallen by 25%. Late in December the adviser sold the shares to realise a $20,000 loss to offset gains from the sale of a rental property.
The dentist, worried about missing a rebound, bought the same shares back two weeks later. The firm's tax reviewer spotted the purchase while preparing the return and warned that the loss would be disallowed under the wash sale rule.
In this illustrative story the loss was added to the cost of the new shares, so the tax benefit was only postponed. The adviser changed the process so that any replacement purchase would be a similar but different holding, or the client would wait out the 31 days after the sale.
Watch out
Common mistakes.
- Believing the loss is gone for good, when it is added to the cost basis of the replacement shares and relieved later when those shares are sold.
- Counting only the 30 days after the sale, when the rule also looks at purchases made in the 30 days before it.
- Forgetting other accounts, such as a spouse's account, a retirement account or an automatic reinvestment plan, which can trigger the rule.
Questions
People also ask.
Does the wash sale rule apply to gains?
No, it only restricts the deduction of losses, and a sale at a gain is taxed normally whether or not you rebuy.
What counts as substantially identical?
The same company's shares clearly do, and so can options on them, but a different company or a fund tracking a different index is generally treated as not identical.
How long should I wait before buying back?
To stay outside the rule, wait at least 31 days after the sale and make sure you made no purchase in the 30 days before it.
From the founder's library

Take it further with the book.
Build your financial confidence beyond this definition. Shihan's full-length guide, Accounting Fundamentals, takes the same plain-English approach and turns it into a complete, practical playbook for non-finance managers, business owners and students - with chapter-end quiz answers and presentation slides included.
25% off with code MMHQ25, applied at checkout. Priced in USD - checkout may show the equivalent in your local currency.
View the book and save 25%Related
