Wash Sale Rule: What It Means for Tax-Loss Harvesting
Tax-loss harvesting is a well-known strategy that allows investors to sell securities at a loss to offset capital gains and reduce taxable income. Many investors rely on this technique in down markets to lower their tax bill while staying invested for the long term. However, the IRS has a critical regulation that can instantly negate the tax benefit of this strategy: the wash sale rule. If you trigger a wash sale, your claimed capital loss will be disallowed at the most inconvenient time. Understanding how the wash sale rule operates and how to work around it is essential for anyone who uses tax-loss harvesting.
The wash sale rule was designed to prevent taxpayers from gaming the system by selling a depreciated asset solely to book a loss while immediately repurchasing the same investment. Without this rule, an investor could artificially realize a loss for tax purposes without meaningfully changing their economic position. The IRS enforces the rule strictly, and even automated actions such as dividend reinvestment can cause an unintentional wash sale. This article explains exactly how the rule functions, its immediate and long-term tax effects, and the most practical ways to avoid it when executing a tax-loss harvesting strategy.
For active traders, portfolio managers, and DIY investors alike, a single wash sale can lead to unexpected tax complications and may even push the disallowed loss into a subsequent tax year. The consequences are especially severe when the repurchase happens inside an IRA. By the time you finish reading, you will have a clear action plan to harvest losses confidently while staying well within IRS boundaries.
Quick Answer
![]()
The wash sale rule is an IRS regulation that disallows a capital loss deduction if you buy a substantially identical security within 30 days before or after the sale. When triggered, the loss is deferred and added to the cost basis of the replacement shares. To avoid the wash sale rule while tax-loss harvesting, wait at least 31 days before repurchasing the same asset, replace it with a similar but not substantially identical investment, or use ETFs that track different indexes.
What Is the Wash Sale Rule?
![]()
The wash sale rule is defined in Section 1091 of the Internal Revenue Code. It states that a taxpayer cannot deduct a loss from the sale or disposition of stock or securities if they acquire substantially identical stock or securities within a 61-day period. That period begins 30 days before the sale date and ends 30 days after the sale date. The rule applies to stocks, bonds, mutual funds, exchange-traded funds, options, and certain other securities.
The rule was enacted to prevent investors from selling securities at a loss purely for the tax deduction while immediately buying them back, thereby retaining the same investment exposure. Without the wash sale rule, an investor could continuously realize losses to offset gains while keeping their portfolio unchanged. The IRS views this as an artificial loss that does not reflect a genuine change in economic position.
When the wash sale rule applies, the disallowed loss is not permanently erased. Instead, the amount of the disallowed loss is added to the cost basis of the newly acquired substantially identical securities. This basis adjustment effectively defers the loss until the replacement shares are eventually sold in a taxable transaction that is not itself a wash sale. The holding period of the new shares also includes the holding period of the old shares, which can affect whether a future gain or loss is short-term or long-term.
How the Wash Sale Rule Works in Practice
![]()
The mechanics of a wash sale are precise but can be easy to overlook. The window of 61 days includes the day of the sale, the 30 calendar days before, and the 30 calendar days after. You cannot circumvent the rule by selling on December 31 and buying back on January 1, because the 30-day periods on either side still cover that sequence. The rule also applies across all your accounts and, in some interpretations, across your spouse’s accounts if you file jointly.
Consider a simple example. You bought 100 shares of Company XYZ at $50 per share. The stock falls to $30, and you sell all 100 shares, incurring a $2,000 capital loss. Ten days later, believing the stock has bottomed, you buy 100 shares of Company XYZ again at $30. The wash sale rule is triggered. Your $2,000 loss is disallowed for the current tax year. Instead, your new 100 shares will have an adjusted cost basis of $5,000: the $3,000 purchase price plus the $2,000 disallowed loss. If you later sell those shares for $6,000, your taxable gain will be $1,000 instead of $3,000, effectively giving you the benefit of the original loss at that time.
Even a partial repurchase triggers a partial wash sale. If you sold 100 shares and only bought back 50 shares within the window, only 50% of the loss would be disallowed. The rule also applies if you acquire a contract or option to buy substantially identical securities. Deep in-the-money call options can be treated as substantially identical to the underlying stock, so using options as a workaround requires caution.
Tax Effects of the Wash Sale Rule
![]()
The immediate tax effect of a wash sale is the deferral of a capital loss. You cannot use that loss to offset capital gains or up to $3,000 of ordinary income in the year of the sale if the wash sale rule applies. This can increase your current-year tax liability and reduce the intended benefit of tax-loss harvesting.
The deferred loss becomes embedded in the cost basis of the replacement shares. While this eventually reduces future gains or increases future losses, the timing mismatch can be costly. You might need the loss now to offset a large realized gain this year, and deferring it to a future year could mean paying more tax today. Additionally, if the replacement security is sold in a year when tax rates are lower or when you have fewer gains to offset, the economic value of the deferral may be diminished.
Another important tax effect involves the holding period. The holding period of the old shares is tacked onto the holding period of the new shares. This can convert a short-term holding into a long-term holding more quickly, but it can also turn a short-term loss into a long-term loss, which is less valuable because short-term losses offset ordinary income up to $3,000 more favorably than long-term losses do. If you had a short-term loss and a wash sale occurs, the replacement shares take on the old holding period, which may be mostly long-term by the time you sell, altering the character of the loss.
Why the Wash Sale Rule Matters for Tax-Loss Harvesting
![]()
Tax-loss harvesting is built on the ability to realize a capital loss and use it to offset realized capital gains. If a wash sale disallows that loss, the entire harvesting effort fails for that transaction. For investors who harvest losses frequently—sometimes weekly—understanding and avoiding the wash sale rule is the single most important operational detail.
The rule forces you to either truly give up the investment for at least 31 days or find a close substitute that does not trigger the “substantially identical” test. Many investors mistakenly think they can sell a stock fund and immediately buy a very similar fund without consequence. While some similar funds pass the test, others fail. The difference between a successful harvest and a wash sale often comes down to subtle details of the replacement security’s composition.
Moreover, tax-loss harvesting is often automated by robo-advisors and wealth management platforms. These services must be programmed to avoid wash sales across thousands of accounts, and some of them occasionally make errors. Even if you use an automated service, understanding the wash sale rule helps you monitor your own transactions and prevent unintended consequences.
Strategies to Avoid the Wash Sale Rule When Tax-Loss Harvesting
![]()
Successful tax-loss harvesting without triggering the wash sale rule depends on careful planning. Below are the most reliable techniques that investors can use to capture losses while respecting the 61-day window and the substantially identical standard.
Wait at Least 31 Days Before Repurchasing
The simplest way to avoid a wash sale is to sell the security, realize the loss, and then wait 31 calendar days before buying the same security again. This means you cannot place a buy order on day 31 after the sale; the earliest safe repurchase date is day 32. For many long-term investors, a month out of the market is acceptable, but it carries reinvestment risk. The market could rise during that window, erasing more value than the tax savings were worth.
Replace with a Similar but Not Substantially Identical Asset
You can immediately reinvest the sale proceeds into a different security that maintains similar market exposure but is not substantially identical to the one you sold. For example, if you sell shares of one large-cap value stock, you can buy shares of a different large-cap value stock in the same sector. The two companies are not substantially identical because their stock certificates represent ownership in different legal entities with different risks.
Use ETFs Tracking Different Indexes
Exchange-traded funds that track different underlying indexes are almost never considered substantially identical, even if their performance is highly correlated. Selling an S&P 500 ETF at a loss and immediately buying a total U.S. stock market ETF is a classic tax-loss harvesting pair. The indexes differ in composition, and the funds use different methodologies. Similarly, selling a technology sector ETF and buying a broader communication services or consumer discretionary ETF provides comparable growth exposure while clearly avoiding a wash sale.
Harvest Losses Around Year-End Carefully
December is a busy month for tax-loss harvesting. If you sell a security in late December, the 30-day post-sale window extends into January. Do not repurchase the same security in the first few weeks of the new year, as that falls within the 61-day window. Some investors temporarily hold the sale proceeds in cash or a money market fund, then repurchase 31 days later. Others swap into a partner ETF permanently or for the required period.
Monitor Dividend Reinvestment and Automatic Purchases
A frequent cause of unintentional wash sales is dividend reinvestment. If you sell a security at a loss on March 1 and your broker automatically reinvests dividends on March 15 into the same security, you have triggered a wash sale. The same can happen with automatic periodic investments, such as monthly contributions to a mutual fund. Before harvesting a loss, turn off dividend reinvestment for that security and pause any automatic purchase plans for at least 31 days.
Coordinate Across All Accounts
The wash sale rule applies across all your taxable and tax-advantaged accounts, including IRAs. Selling a security in your brokerage account at a loss and buying the same security in your IRA within 30 days creates a wash sale. In the case of an IRA purchase, the disallowed loss is added to the basis of the shares inside the IRA, but because IRA basis does not provide a tax benefit in the same way, the loss is effectively lost forever. Spousal accounts and even accounts held by a trust or corporation you control can also trigger the rule. For joint filers, your spouse’s transactions are treated as your own.
Use Options but Only with Care
Some traders consider buying a call option after selling the underlying stock at a loss as a way to maintain upside exposure. This is dangerous. The IRS can treat a deep in-the-money call option as substantially identical to the stock, triggering a wash sale. The standard is not perfectly clear, but options that are highly leveraged and closely track the stock price are risky. If you want to use options, consult a tax professional and consider out-of-the-money positions, though even those could be challenged if paired with an intent to reacquire the same economic position.
What Counts as a Substantially Identical Security?
![]()
The IRS has not issued a definitive, all-encompassing list of what makes two securities substantially identical. Instead, courts and IRS guidance have established some principles. Common stock of one corporation is not substantially identical to common stock of a different corporation, even if they are in the same industry. However, preferred stock and common stock of the same issuing company can be substantially identical if the preferred is convertible into the common at a ratio that gives it very similar economics.
Bonds from the same issuer with different maturities or coupon rates are generally not considered substantially identical, but bonds that are very similar might be, especially if they are from the same issuer and have minor differences in terms. Two mutual funds or ETFs tracking the same index are very likely to be considered substantially identical if they hold substantially the same portfolio in the same weights. Funds tracking different indexes, even if those indexes are highly correlated, are generally safe.
When in doubt, conservative practice suggests avoiding any two securities that are designed to replicate the same benchmark. If you sell a Vanguard S&P 500 fund and buy a competing S&P 500 fund from another provider, many tax professionals consider that a wash sale because both funds hold the same 500 stocks in nearly identical proportions.
Common Mistakes That Trigger the Wash Sale Rule
![]()
Even experienced investors make wash sale errors. The most frequent mistakes include repurchasing the same security in an IRA after selling at a loss in a taxable account, forgetting about dividend reinvestment, and treating options as a safe workaround without understanding the substantial-identity test. Another common error is looking only at the 30-day post-sale window while forgetting the 30-day pre-sale window. If you bought additional shares of a stock less than 30 days before selling some shares at a loss, the sale will be partially a wash sale even if you never buy the stock again.
Multiple brokerage accounts create another blind spot. You might sell a position in one account and repurchase the same security in another account within the window, triggering a wash sale that neither broker will report because they cannot see each other’s records. You are responsible for reporting the wash sale on your tax return. Failing to do so can lead to an IRS notice, interest, and penalties.
The Wash Sale Rule and Retirement Accounts
![]()
The application of the wash sale rule to IRAs is one of the most discussed and dangerous aspects of tax-loss harvesting. In a 2008 revenue ruling, the IRS clarified that buying a substantially identical security inside an individual retirement account within the 61-day window triggers a wash sale. The disallowed loss is added to the basis of the shares inside the IRA, but because IRA contributions are generally not taxed on withdrawal if they were nondeductible contributions, this basis adjustment provides little or no current tax benefit. Effectively, the loss is permanently disallowed rather than deferred.
This rule also applies to Roth IRAs and even to Health Savings Accounts in some professional interpretations, though the HSA treatment is less settled. It is crucial to avoid buying the same stock or fund in any retirement account around the time of a tax-loss harvesting sale. Many advisors recommend implementing a trading blackout period for all retirement accounts or, better yet, using completely different funds in retirement accounts than those held in taxable brokerage accounts.
Recordkeeping and Reporting Considerations
![]()
Brokers are required to report wash sales that occur within the same account on Form 1099-B. The wash sale adjustment will appear on the form, and the broker will increase the basis of the replacement shares automatically. However, if the wash sale spans multiple accounts or involves an IRA, the broker will not report it. You must manually adjust your cost basis and report the disallowed loss on Form 8949 and Schedule D.
Keeping good records is essential. Note the date of each sale, the amount of loss, the date and number of shares repurchased, and the adjusted basis. If you use tax software, you may need to make manual adjustments to the basis and indicate the wash sale. Failing to report a wash sale that your broker did not flag is not a valid excuse, and the IRS may later disallow the loss and assess additional tax.
Advanced Considerations for Active Traders
![]()
Active traders who make dozens of trades per day can easily trigger wash sales without realizing it. Pattern day traders and algorithmic trading systems must account for the wash sale rule across every execution. Some trading platforms include wash sale tools that flag potential problems in real time, but these tools typically only work within the same account. Active traders should consider consolidating all taxable trading into one account and using clearly differentiated products in retirement accounts.
Wash sale rules also interact with the mark-to-market election under Section 475. Traders who elect mark-to-market accounting treat all positions as if sold at year-end, and wash sale rules do not apply because all gains and losses are ordinary. However, this election requires strict timing and eligibility rules, and it is generally not available for investors managing a purely passive portfolio.
Conclusion
![]()
The wash sale rule remains one of the most important guardrails in the tax code for anyone engaged in tax-loss harvesting. A small oversight—such as an automatic dividend reinvestment or a mistaken ETF swap—can disallow a loss and complicate your tax return. By understanding the 61-day window, the meaning of substantially identical securities, and the special dangers of IRA purchases, you can preserve the full tax benefit of your harvesting strategy. The wash sale rule does not prevent tax-loss harvesting; it simply requires investors to be thoughtful about timing and security selection. With proper planning, you can lock in losses, remain invested, and keep your tax savings intact.
FAQ
![]()
Does the wash sale rule apply to cryptocurrency?
As of the current tax law, the wash sale rule generally does not apply to cryptocurrency because the IRS classifies digital assets as property rather than securities. However, proposed legislation and future regulatory changes could extend the rule to crypto. Investors should monitor updates and consult a tax professional before relying on crypto wash sales.
Can I sell a stock at a loss and immediately buy an option on the same stock?
Buying a call option on the same stock can trigger a wash sale if the option is deep in-the-money and considered substantially identical to the stock. The IRS evaluates the specific terms of the option. Many tax professionals recommend avoiding options on the same underlying security within the 61-day window unless you have received specific professional guidance.
What happens if I trigger a wash sale in December and the replacement shares are sold in January of the next year?
The disallowed loss is added to the basis of the replacement shares. If you sell those replacement shares in January, the deferred loss will be recognized in the new tax year. The holding period of the original shares is tacked on, which may affect whether the eventual gain or loss is short-term or long-term.
Do wash sale rules apply to 401(k) accounts?
The IRS ruling specifically addressed IRAs, but whether 401(k) plans are subject to the wash sale rule is less clear. Many tax professionals take the conservative position that buying a substantially identical security inside a 401(k) within 30 days of selling at a loss in a taxable account could trigger a wash sale. It is safer to avoid the transaction or use different funds.
If my broker does not flag a wash sale, am I still responsible?
Yes. Brokers are required to report wash sales only within the same taxable account. If a wash sale occurs across different accounts or involves an IRA, it is your obligation to report it correctly on your tax return. Failing to do so can result in the IRS adjusting your return and assessing additional tax, interest, and penalties.