Wash sale rule: how it works and how to avoid a disallowed loss

The wash sale rule blocks a capital loss when you, your spouse or your IRA buy substantially identical shares within 30 days before or after the sale; the loss is usually added to the new shares' basis, but an IRA purchase erases it.

By Sonic Wallet Editorial Team· Updated · 10 min read

Key takeaways

  • A wash sale happens when you sell shares at a loss and, within 30 days before or after the sale, buy substantially identical shares or an option to buy them, whether in your own account, your IRA or your spouse's account. The loss is disallowed for now and added to the replacement shares' basis, so it is deferred, not erased, unless an IRA made the purchase.
  • The window spans 61 days: the sale date plus 30 calendar days on each side. For a loss sale on November 16, 2026, purchases from October 17 through December 16 count, and December 17 is the first safe day to buy back.
  • A purchase in a traditional or Roth IRA triggers the rule, and under Revenue Ruling 2008-5 the IRA's basis is not increased, so that loss is gone for good. The ruling does not address 401(k) plans.
  • Shares of the same company, and funds tracking the same index, carry the highest risk of being substantially identical. The IRS has issued no definitive position on similar ETFs, so a fund that tracks a different index is the common lower-risk replacement.
  • Brokers must flag wash sales only for identical securities bought and sold in the same account, in box 1g of Form 1099-B. Purchases anywhere else are yours to find and report on Form 8949 with code W.

The wash sale rule stops you from deducting a loss on shares you sell if you buy the same shares, or substantially identical ones, within 30 days before or after the sale. It does not block the trade, and in most cases it does not destroy the loss either: the deduction is postponed by adding it to the cost of the replacement shares. This guide covers how the 61-day window is counted, what substantially identical means and where funds fall into a gray area, why IRA and spouse purchases count, how the basis adjustment works, worked examples of disallowed losses, and what your broker will and won't catch. Tax rules change and the IRS judges unclear cases on their facts, so check close calls with a tax professional. The rest of our investing tax coverage starts from the stocks and investing hub.

What is the wash sale rule?

The wash sale rule, section 1091 of the tax code, disallows a loss on a sale of stock or securities if you buy substantially identical ones within 30 days.

IRS Publication 550 lists four ways to trigger it within 30 days before or after the sale: buying substantially identical stock or securities, acquiring them in a fully taxable trade, acquiring a contract or option to buy them, or acquiring them for your traditional or Roth IRA. A purchase by your spouse or by a corporation you control counts as your own. The rule reaches shares, ETFs, mutual funds, bonds, warrants and options, and it applies whether the repurchase is deliberate or automatic. Publication 550 even gives the example of an employee who sells company shares at a loss and receives another stock award within 30 days.

Its target is a sale made to book a loss while the investment stays in place. It never touches gains: sell at a profit and buy back the next morning, and the gain is simply taxable. Publication 550 says the rule does not apply to losses on commodity futures contracts or foreign currencies, and IRS Topic 429 notes that traders who have made a section 475(f) mark-to-market election are not subject to it. Coins held directly generally fall outside it under current law, because it is written for stock and securities; in Congress, H.R. 9172 and H.R. 10357 would apply the wash-sale rule to digital assets; neither had passed the House as of November 1, 2026. The crypto hub and the guide to crypto tax-loss harvesting cover digital assets.

How does the 61-day wash sale window work?

The window covers 30 days before or after the sale (a 61-day window), counted in calendar days from the trade date of the loss sale.

Weekends and holidays count, and settlement dates play no part. A purchase on the 31st day after the sale falls outside the window, and so does one made 31 or more days before it. Purchases before the sale are the half people forget: buying more shares of a falling stock and then selling the original, higher-cost lot at a loss within 30 days is a wash sale.

Loss sale (trade date)Window opensWindow closesFirst safe day to buy back
Monday, March 2, 2026January 31, 2026April 1, 2026April 2, 2026
Monday, November 16, 2026October 17, 2026December 16, 2026December 17, 2026
Tuesday, December 15, 2026November 15, 2026January 14, 2027January 15, 2027

The last row is the year-end trap. A loss realized on December 15 belongs on the 2026 return, but the window runs into January, so a repurchase on January 5, 2027 still disallows it, and the deduction moves into the basis of shares you will sell in some later year.

What counts as substantially identical?

Shares of the same company are substantially identical; shares of different companies ordinarily are not, and for everything in between the IRS looks at all the facts and circumstances.

Publication 550 gives a few markers. A company's bonds or preferred stock are not ordinarily substantially identical to its common stock, but convertible bonds or preferred can be, depending on relative values and price movements; preferred stock that converts freely, votes like the common, faces the same dividend limits and trades close to its conversion value is treated as identical. In a reorganization, shares of the old and new company may be substantially identical. Selling common stock at a loss while buying warrants on the same company is also a wash sale.

Funds are the real gray area. The IRS has not published a test for exchange-traded or mutual funds, and BlackRock's guidance for its iShares funds says the IRS has released no definitive opinion on how the rule applies to ETFs. Tax practitioners generally weigh two things: how much the holdings overlap and how similar the expected returns are. The table applies the risk levels from BlackRock's framework, which are judgments rather than IRS rules.

Replacement for a position sold at a lossTypical overlapWash sale risk
The same stock or fund, or a call option on itCompleteA wash sale
A fund tracking the same index, or another share class of the same fundNear totalHigher
An index fund tracking a different indexPartial to significantModerate
An actively managed fund replacing an index fund, or the reverseFew holdings in commonLower
A diversified fund, such as a sector fund, replacing a single stockSmallLower

S&P 500 funds from different sponsors, compared in SPY vs VOO vs IVV, hold essentially the same companies in the same weights, which puts them in the higher-risk row. An S&P 500 fund and a Nasdaq-100 fund follow different indexes but share many of their largest holdings, which is why a different index lowers the risk without removing it.

Do purchases in an IRA or a spouse's account trigger a wash sale?

Yes: Publication 550 counts purchases for your traditional or Roth IRA, and purchases by your spouse, as if you had made them yourself.

The IRA version is the harsh one. In Revenue Ruling 2008-5, the IRS held that when you sell stock at a loss and your IRA or Roth IRA buys substantially identical stock within the window, the loss is disallowed and your basis in the IRA is not increased. With no basis increase anywhere, the deduction never comes back. The ruling covers IRAs and Roth IRAs only. It does not address 401(k)s or other workplace plans, so whether a plan purchase counts is unsettled and worth raising with a tax adviser if your plan buys the fund you sold.

It usually happens by accident: an IRA that reinvests dividends from the same fund, a scheduled monthly IRA purchase, or a target allocation that buys in one account what you just sold in another. For a married couple, the practical approach is to treat both spouses' accounts as one pool when checking the window. How the two IRA types differ in other respects is covered in Roth vs traditional IRA.

What happens to the disallowed loss?

The disallowed loss is added to the cost basis of the replacement shares, and their holding period absorbs the time you owned the shares you sold.

Section 1091(d) sets the new shares' basis at the basis of the shares sold, adjusted by the difference between the sale and repurchase prices, which comes to the new purchase price plus the disallowed loss. In Publication 550's own example, shares bought for $1,000 and sold for $750, then rebought for $800 within the window, give a $250 disallowed loss and a $1,050 basis in the new shares. The benefit returns when you finally sell the replacement shares without another wash sale, as a smaller gain or a larger loss.

If you buy back fewer shares than you sold, only the loss on that many shares is disallowed and the rest is deductible now; shares bought beyond the number sold simply take their purchase price as basis. When several purchases fall inside the window, Publication 550 matches them to the shares sold in the order you bought them. Because the holding period carries over, replacement shares can qualify for long-term treatment sooner than their purchase date suggests, which changes the rate when you sell them, as explained in capital gains tax on stocks.

How much of a loss does a wash sale disallow?

A wash sale disallows the loss on as many shares as you replace inside the window, and no more.

Worked example: Seven outcomes for one $1,500 loss

You bought 100 shares of a fund at $55 ($5,500) in March 2026 and sold all 100 at $40 ($4,000) on November 16, 2026, a $1,500 loss. The window runs from October 17 to December 16.

What happensDisallowedDeductible for 2026Basis of the new shares
Buy 100 shares at $42 on December 1$1,500$0$4,200 + $1,500 = $5,700
Buy 40 shares at $41 on November 30$600$900$1,640 + $600 = $2,240
You had bought 100 more at $44 on October 28, then sold the March lot$1,500$0October lot: $4,400 + $1,500 = $5,900
Your IRA buys 100 shares at $42 on November 20$1,500$0IRA basis unchanged, so the loss is lost
Reinvested dividends buy 3 shares at $41 on December 5$45$1,455$123 + $45 = $168
Buy a fund tracking a different index the same day$0, if not substantially identical$1,500Its purchase price
Buy 100 shares at $43 on December 17, day 31$0$1,500$4,300
  • Partial repurchase: 40 of the 100 shares were replaced, so 40% of $1,500, or $600, is deferred and $900 is deductible now
  • Reinvestment: 3 of 100 shares were replaced, so 3% of the loss, $45, is deferred
  • Later sale: if the replacement shares in the first row are sold at $45 in 2027 with no new purchase, the loss is $4,500 − $5,700 = $1,200, which is the deferred $1,500 net of the $300 the new shares gained

Who tracks wash sales: your broker or you?

Your broker checks only part of the rule, so applying it across all your accounts is your job.

Under the Form 1099-B instructions, brokers must report a wash sale only when the same security, identified by its CUSIP number, is bought and sold in the same account, and only for covered securities. They may report others, but they need not look at activity outside the account. Any disallowed amount appears in box 1g. Publication 550 states the consequence plainly: you cannot deduct a loss from a wash sale even if it is not reported on Form 1099-B.

The usual blind spots are purchases at another firm, in an IRA or workplace plan, by a spouse, of a different but substantially identical security, and through dividend reinvestment in another account. You report a wash sale the broker missed on Form 8949, with code W in column (f) and the disallowed loss as a positive number in column (g). If box 1g is wrong, the Form 8949 instructions explain how to correct it and attach a statement showing the adjustment.

How can you avoid a wash sale?

You can wait 31 days to buy back, buy a replacement that isn't substantially identical, or double up at least 31 days before selling the original lot.

Before you sell at a loss

  • Write down the trade date and the date 30 days later, when the window closes
  • Check every account you and your spouse own, including IRAs and workplace plans, for purchases of the same security in the past 30 days
  • Turn off dividend reinvestment for that security in every account until the window closes
  • Pause automatic investments into the same or a substantially identical fund
  • Avoid buying call options on the security during the window
  • Keep your own record of any purchase your broker cannot see, for Form 8949

Each approach has a cost. Waiting in cash, or in a money market fund, leaves you out of the market for a month, and a rebound in that time can cost more than the tax saved. Doubling up, which means buying the same number of shares and selling the original lot after 31 days, leaves you holding twice the position, and twice the risk, for a month. Switching to a fund that tracks a different index keeps you invested at moderate risk under the framework above; tax loss harvesting walks through that method and what it can save.

What are the risks of getting the wash sale rule wrong?

The main risks are a smaller deduction than planned, a loss erased by an IRA purchase and a return that understates your tax.

  • Automatic purchases. Reinvested dividends, monthly investment plans, workplace contributions and employer stock awards add shares without any decision on your part, and each can disallow part of a loss.
  • The IRA trap. A matching purchase in a traditional or Roth IRA erases the loss rather than deferring it.
  • Gray-area swaps. A replacement fund with nearly the same holdings can be challenged, and no IRS list of acceptable pairs exists.
  • Year-end timing. A December loss followed by a January repurchase still fails, so the deduction you counted on for this year moves to a later one.
  • Copying the 1099-B. Brokers miss cross-account wash sales, so a return that simply copies the form can overstate losses and lead to extra tax and interest later.
  • Rules change. Congress has considered extending the rule, including to digital assets, and IRS guidance evolves. This page explains the rules as of November 2026 and is not tax advice; a tax professional can review close calls before you trade.

Frequently asked questions

Does the wash sale rule apply to gains?+

No. It only disallows losses. If you sell at a gain and buy the same shares back the next day, the gain is taxable as usual and the new shares simply start with their own purchase price as basis.

Can I sell a stock at a loss and buy it back after 30 days?+

Yes. A repurchase on the 31st day after the sale or later does not affect the loss, provided you made no substantially identical purchase in the 30 days before the sale either. The price may have moved in the meantime.

Do wash sale rules apply to crypto?+

Not to coins held directly under current law, because IRS Publication 550 applies the rule to stock and securities. Bills in Congress would extend it to digital assets, and whether it reaches spot crypto ETF shares is unsettled.

Does a wash sale change my holding period?+

Yes. The replacement shares inherit the holding period of the shares you sold, so a position held for 11 months before the loss sale becomes long-term about a month after you buy the replacement.

What if a dividend reinvestment buys shares right after I sell at a loss?+

The reinvested shares count as a purchase, so the loss on the same number of shares is disallowed and added to their basis. Turning off reinvestment in every account that holds the security before you sell avoids it.

Sources

  1. 26 U.S. Code 1091, Loss from wash sales of stock or securities, Legal Information Institute, Cornell Law School
  2. Publication 550, Investment Income and Expenses, IRS
  3. Revenue Ruling 2008-5, IRS
  4. Instructions for Form 8949, Sales and Other Dispositions of Capital Assets, IRS
  5. Instructions for Form 1099-B, IRS
  6. Topic no. 429, Traders in securities, IRS
  7. Wash Sales (glossary), SEC (Investor.gov)
  8. Tax loss harvesting at a glance: wash sale rule considerations, BlackRock (iShares)
  9. H.R.10357: Digital Asset Tax Certainty Act, all actions, Congress.gov

Related guides