education

Wash Sale Rule Explained: What Every Investor Needs to Know

The IRS wash sale rule can silently disallow your tax losses. Here's exactly how the 61-day window works, what 'substantially identical' means, and how to harvest losses legally.

Stock Alarm Pro Team
Market Analysis
June 10, 2026
15 min read
#wash-sale-rule#tax-loss-harvesting#taxes#investing-basics#IRS

You sell a losing stock to lock in a tax deduction. A few weeks later, you buy it back because the thesis still holds. Clean and simple — except the IRS has a rule specifically designed to prevent this, and it can silently erase the tax benefit you thought you had.

The wash sale rule is one of the most misunderstood tax rules in investing. Most investors learn about it only after their 1099-B arrives in January and they notice a "disallowed loss" adjustment they didn't expect. By then, it's too late to fix for that tax year.

This guide explains exactly how the rule works, what triggers it, how the disallowed loss affects your cost basis, common mistakes investors make, and how to harvest tax losses without running afoul of it.

Note: This is educational content, not tax advice. Consult a qualified tax professional for guidance on your specific situation.


What Is the Wash Sale Rule?

The wash sale rule is an IRS regulation (codified in Section 1091 of the Internal Revenue Code) that disallows a tax loss on the sale of a security if you purchase a "substantially identical" security within a 61-day window — 30 days before the sale, the day of the sale, or 30 days after the sale.

The rule exists to prevent investors from engineering artificial tax losses. Without it, you could sell a stock that has declined, claim the loss on your taxes, then immediately repurchase the same stock as if nothing happened. The IRS treats this as a transaction with no economic substance — you never truly gave up your exposure to the security.

The rule in plain terms: If you sell a stock at a loss and buy the same stock back within 30 days on either side of the sale, the loss does not count for tax purposes in that year.

The 61-Day Window

The window is often described as "30 days," but the actual rule creates a 61-day span:

code-highlight
30 days BEFORE sale → Sale date → 30 days AFTER sale
         ←─────────────────────────────────────────→
                    61-day wash sale window

This means the rule can reach backward as well as forward. If you bought a stock on November 1st and then sold shares of the same stock at a loss on November 15th, the November 1st purchase falls within the lookback window and can trigger a wash sale — even though the purchase happened before the sale.

Many investors know to wait 30 days before repurchasing. Fewer remember to check whether they already purchased the same security in the 30 days before the sale.


A Concrete Example: How the Numbers Work

Suppose you buy 100 shares of XYZ at $50 per share. The stock falls to $40, and you decide to sell in December to capture the loss for your tax return.

Sale details:

  • Purchase price: $50/share × 100 shares = $5,000 cost basis
  • Sale price: $40/share × 100 shares = $4,000 proceeds
  • Realized loss: $1,000

If this loss is allowed, it reduces your taxable capital gains by $1,000. At a 24% marginal rate, that saves you $240 in taxes.

Now suppose you miss the stock and buy 100 shares back 15 days after the sale at $41 per share.

Wash sale triggered. The $1,000 loss is disallowed. You cannot deduct it on your tax return.

But — and this is important — the loss is not gone. The disallowed $1,000 loss is added to the cost basis of the replacement shares you just purchased.

Adjusted cost basis of new shares:

  • Price paid for replacement shares: $41/share × 100 shares = $4,100
  • Disallowed loss added to basis: +$1,000
  • Adjusted cost basis: $5,100

When you eventually sell those replacement shares, your gain or loss will be calculated from the $5,100 adjusted basis, not the $4,100 price you paid. The tax benefit isn't gone — it's deferred until you sell the replacement shares outside a wash sale window.

Cost Basis Adjustment Table

TransactionPriceSharesAmount
Original purchase$50.00100$5,000 (cost basis)
Sale (loss realized)$40.00100$4,000 (proceeds)
Realized loss-$1,000 (disallowed)
Replacement purchase$41.00100$4,100 (paid)
Disallowed loss added to basis+$1,000
Adjusted cost basis100$5,100

If you later sell those replacement shares at $48, your taxable loss is $5,100 − $4,800 = $300. The original $1,000 loss was preserved, just realized at a different time.


What Does "Substantially Identical" Mean?

This is where the wash sale rule becomes complicated. The IRS has never published a bright-line definition of "substantially identical," which creates both uncertainty and opportunity.

What Clearly Triggers a Wash Sale

  • Same stock: Sell Apple at a loss, buy Apple within the wash sale window. Obvious.
  • Options on the same stock: Selling Apple shares at a loss and buying Apple call options within the window is a wash sale. The option gives you the right to purchase the same stock you just sold.
  • Bonds convertible into the same stock: Selling shares and buying convertible bonds on the same company is substantially identical.

What Generally Does NOT Trigger a Wash Sale

  • Different companies in the same sector: Sell one semiconductor stock, buy a different semiconductor company. These are separate businesses. The IRS has never ruled two different companies' stocks to be substantially identical.
  • Individual stock vs. sector ETF: Selling an individual company's stock and buying a sector ETF (like XLK for technology) is generally not a wash sale, because the ETF holds dozens of companies. However, if the stock you sold is a large holding in the ETF you buy, consult a tax professional.
  • Different funds tracking different indexes: Selling a total stock market fund and buying an S&P 500 fund from the same provider. These track different indexes.

The Gray Zones

Two areas remain genuinely uncertain:

Different providers, same index: Selling Vanguard's S&P 500 ETF (VOO) and buying iShares' S&P 500 ETF (IVV). Some tax professionals argue these are substantially identical because they track the same index with near-identical holdings. Others argue they are distinct products from different issuers. The IRS has not issued definitive guidance. Tax professionals are split. If you're in this situation, get professional advice.

Crypto: As of 2026, the wash sale rule officially applies to stocks and securities but not to cryptocurrency (crypto is classified as property, not a security). This means crypto investors can sell Bitcoin at a loss and immediately repurchase it without triggering a wash sale. Congress has repeatedly proposed extending the rule to crypto, and this could change — check current law before relying on this.


The Wash Sale Trap Most Investors Miss: IRAs

This is the most costly wash sale mistake and the one most likely to cause a permanent loss of tax benefit.

The IRA trap: If you sell a stock at a loss in your taxable brokerage account and then purchase the same stock in your IRA (traditional or Roth) within the wash sale window, the wash sale rule is triggered — but with a devastating twist.

When a wash sale is triggered by a purchase in an IRA, the disallowed loss cannot be added to the IRA's cost basis. The IRS does not allow basis adjustments inside retirement accounts. The result: the disallowed loss is permanently lost. You cannot recover it in a future tax year. It is gone.

How this happens unintentionally:

  • You sell Company A at a loss in your taxable account in early December.
  • Company A pays a quarterly dividend in mid-December.
  • You have dividend reinvestment (DRIP) enabled in your IRA for Company A.
  • The automatic reinvestment buys new shares of Company A in your IRA within 30 days of your sale.
  • Wash sale triggered. Loss permanently gone.

This happens without any conscious decision on your part. If you own the same securities in a taxable account and an IRA with DRIP enabled, you are at risk.

Fix: Before selling any position at a loss for tax purposes, turn off DRIP in all accounts for that security, across all accounts including your spouse's accounts if you file jointly. Wait 31 days after the sale before re-enabling DRIP.


How Wash Sales Appear on Your Tax Forms

Your broker reports wash sales on Form 1099-B, which you receive in January for the prior tax year. Box 1g on the 1099-B shows "disallowed wash sale loss" — the amount the broker has identified as disallowed under the wash sale rule.

Critical limitation: Your broker only reports wash sales for transactions within that single account. If you triggered a wash sale across multiple accounts — selling in your taxable account and buying in your IRA, or buying at a different broker — your 1099-B will not reflect it. Cross-account wash sales are your responsibility to identify and report.

When you file your taxes, Schedule D and Form 8949 are where wash sale adjustments are reported. Column (g) of Form 8949 ("Adjustments to gain or loss") captures the disallowed amount. The cost basis of the replacement shares is adjusted on a separate Form 8949 line.

Most tax software handles this automatically from your 1099-B data, but only for single-account wash sales. You need to manually enter cross-account wash sales.


Tax-Loss Harvesting Strategies That Avoid the Wash Sale Rule

The wash sale rule doesn't prevent you from harvesting losses — it just requires you to do it correctly.

Strategy 1: Wait 31 Days

The most conservative approach: after selling at a loss, wait 31 calendar days before repurchasing the same security. The window closes after 30 days, so day 31 is safe.

Downside: You are out of the position for at least a month. If the stock recovers quickly, you miss the rebound. Many investors set a calendar reminder or, better, a price alert at the original entry level so they can repurchase at approximately the same price.

Strategy 2: Buy a Similar But Not Identical Replacement

Immediately after selling at a loss, buy a different stock or ETF that provides similar exposure. This keeps you fully invested while you wait out the wash sale window.

Example alternatives by sector:

Original HoldingPossible Replacement (Not Substantially Identical)
Individual large-cap tech stockTechnology sector ETF (XLK) or a different large-cap tech company
Individual bank stockFinancial sector ETF (XLF) or a different major bank
S&P 500 index fundExtended market index fund or total world stock fund
Individual healthcare stockHealthcare sector ETF (XLV) or a different pharma company

After 31 days, you can sell the replacement and repurchase the original if you want to — the wash sale clock on the original has expired.

Strategy 3: Tax-Lot Specific Identification

If you hold multiple lots of the same stock at different cost bases, you can sell only the highest-cost lot to maximize your loss without completely exiting the position — as long as you do not buy additional shares of the same security within the wash sale window.

This requires your broker to support specific lot identification (most do), and you must designate which lot you are selling at the time of the sale, not after. Check your broker's platform for "specific lot" or "tax lot" selection at order entry.


Timing Your Tax-Loss Harvesting

Most investors think about tax-loss harvesting as a December activity. That's a mistake.

Year-round harvesting has three advantages:

  1. More opportunities: Stocks decline throughout the year, not just in November and December. Waiting until year-end means you miss harvest opportunities earlier in the year.

  2. Less crowding: Many investors sell losing positions in December for tax purposes, which can temporarily depress prices. Selling earlier means you avoid selling into this crowding effect.

  3. More time to redeploy: If you harvest in September, you have all of Q4 to deploy capital into the replacement position and potentially capture gains before year-end.

Setting price alerts for harvesting triggers:

Rather than manually reviewing your portfolio for harvest opportunities, set price alerts on your holdings at levels where tax-loss harvesting becomes meaningful. For example:

  • Alert when a position is down 10% from your cost basis — time to evaluate whether to harvest
  • Alert when a position breaks below a key technical support level — potential harvesting trigger combined with a changed thesis
  • Alert when you're approaching the 31-day window after a prior sale — time to consider repurchasing

Stock Alarm Pro's real-time alerts let you set cost-basis-relative percentage alerts directly, so you never miss a harvesting opportunity because you weren't watching. The dashboard shows your full position list with real-time prices, making it easy to see which holdings are candidates for harvesting.


Common Wash Sale Mistakes

Mistake 1: Forgetting the Lookback Window

You remember not to buy back within 30 days after the sale. You forget that purchases made 30 days before the sale also count. Always check your purchase history for the prior 30 days before selling at a loss.

Mistake 2: DRIP in an IRA (covered above — but worth repeating)

Automatic dividend reinvestment in any account — IRA, Roth IRA, taxable — can trigger a wash sale. The cost is permanent if the triggering purchase is in a retirement account. Turn off DRIP before harvesting.

Mistake 3: Partial Repurchase Still Triggers a Partial Wash Sale

If you sell 100 shares at a loss and buy back 40 shares within the window, 40% of your loss is disallowed. You do not escape the wash sale rule by buying back fewer shares.

Mistake 4: Assuming Your Broker Catches Everything

Your 1099-B only reflects wash sales within that single account. Cross-broker and cross-account wash sales are invisible to your broker's reporting system. You are responsible for identifying and reporting them.

Mistake 5: Selling in a Taxable Account and Forgetting About Your Employer 401(k)

If you participate in a company stock purchase plan or hold company stock in your 401(k) or ESOP, automatic purchases of that stock within the wash sale window triggered by payroll contributions can disallow a loss you harvested in your taxable account.


When the Wash Sale Rule Doesn't Apply

Two situations worth knowing:

At the end of the tax year: If you sell shares at a loss and your account enters the next calendar year, any purchase of the same security in January can still trigger a wash sale (it falls within the 30-day post-sale window). But the wash sale adjustment will appear on the following year's 1099-B, not the current year's. You do not get the current year's loss — it carries into next year.

On the final sale: The wash sale rule defers your loss — it doesn't eliminate it. When you sell the replacement shares and do not repurchase the same security within the wash sale window, you realize the accumulated (adjusted) loss in full. The deferred loss is not gone; it just waits.


Setting Up Alerts to Time the 31-Day Repurchase Window

The mechanics of the wash sale rule create a specific timing challenge: after selling for a loss, you have 31 days before you can repurchase the same security. During that period, the stock may move significantly.

Using alerts to manage the repurchase:

Set two alerts when you execute a tax-loss harvest sale:

  1. Calendar reminder at day 31 — when you are legally clear to repurchase
  2. Price alert at your target repurchase level — so you know if the stock has moved back toward your original entry while you wait

If the stock runs up significantly during the 31-day window, you can decide whether to repurchase at the higher price or stay in the replacement position. If it continues to fall, you may want to harvest the replacement position as well (careful — check whether the replacement can trigger its own wash sale).

Stock Alarm Pro's alerts can fire on specific price levels, percentage moves from any reference price, or technical conditions like moving average crossovers. Setting a price alert at your intended repurchase level means you don't have to watch the stock daily for 31 days — the alert tells you when action is warranted.


Ready to time your tax-loss harvesting with precision? Try StockAlarm Pro free for 7 days — real-time alerts across 10,000+ stocks, crypto, forex, and futures. No credit card required.


Want alerts like these? Get started free.

Join 295,000+ traders using Stock Alarm to stay ahead of the market.

See it work — free

Track markets, screen stocks, and set price alerts with Stock Alarm Pro. Explore the live markets free — no account needed. Trusted by 295,000+ investors.

S&P 500 Screener

Filter by metrics, fundamentals

Price Alerts

Never miss a move

35+ Global Markets

Stocks, crypto, futures

AI Analysis

Ask questions, get answers

Explore the markets free
Data is provided for informational purposes only and does not constitute investment advice. Past performance is not indicative of future results.