Investment losses can sting, especially when a stock or ETF drops and you decide to sell. Many investors expect that loss to offset gains at tax time. But the wash-sale rule can block that deduction if you buy the same or a substantially identical investment too soon after selling it. Understanding the wash-sale rule explained: when an investment loss cannot be deducted can help you avoid an unpleasant surprise on your tax return.

This rule matters to everyday investors, not just traders. It applies to taxable brokerage accounts, and it can affect stocks, ETFs, mutual funds, and even some options transactions. If you invest regularly, reinvest dividends, or use tax-loss harvesting, knowing how the wash-sale rule works is essential.

What Is the Wash-Sale Rule?

Infographic explaining the wash-sale rule and how repurchasing too soon can make investment losses non-deductible

The wash-sale rule is an IRS tax rule that disallows a capital loss if you sell a security at a loss and then buy the same or a substantially identical security within a specific time window.

In simple terms:

  • You sell an investment for less than what you paid.
  • You buy back the same or a nearly identical investment too soon.
  • The IRS says you cannot claim that loss right away.

Instead of losing the deduction forever, the disallowed loss is usually added to the cost basis of the replacement shares. That means you may be able to benefit from the loss later, when you eventually sell the new shares.

Why the Rule Exists

The wash-sale rule prevents investors from creating artificial losses for tax purposes while keeping the same investment position. Without it, someone could sell a stock at a loss on December 30, buy it back on December 31, and still claim the tax deduction.

How the 30-Day Window Works

The wash-sale rule looks at a 61-day period centered around the sale date:

  • 30 days before the sale
  • The day of the sale
  • 30 days after the sale

If you buy the same or substantially identical security during that window, the loss is generally disallowed.

Example of the Timeline

Suppose you sell 100 shares of Company A on June 15 at a loss.

If you:

  • bought Company A shares on May 20, or
  • buy Company A shares again on June 20,

the loss may be treated as a wash sale.

The key point is that the rule is not limited to after the sale. A purchase before the sale can also trigger it if it falls within the 30-day lookback period.

What Counts as “Substantially Identical”?

This phrase is one of the trickiest parts of the rule. The IRS has not given a detailed universal checklist, so the answer often depends on the facts and circumstances.

Generally Clear Cases

These are usually considered the same or very close:

  • Selling a stock and repurchasing the same stock
  • Selling mutual fund shares and buying the same mutual fund
  • Selling an ETF and buying the same ETF

Less Clear Cases

These require more judgment:

  • Different share classes of the same fund
  • ETFs and mutual funds that track the same index
  • Options tied closely to the same security
  • Bonds or preferred shares from the same issuer in some cases

Because the standard is not perfectly defined, investors should be careful when trying to “swap” into something that seems similar but may still be considered substantially identical.

A Practical Example

If you sell an S&P 500 ETF at a loss and immediately buy another S&P 500 ETF from a different provider, that may or may not be a wash sale depending on the specifics. Many investors treat similar index funds cautiously because the IRS could view them as substantially identical in certain situations.

How the Wash-Sale Rule Affects Your Taxes

When a wash sale occurs, you cannot deduct the loss on the current year’s tax return for that transaction.

Instead:

  • the loss is disallowed for now,
  • the disallowed amount is added to the basis of the new shares,
  • and your holding period may be adjusted to include the period you held the old shares.

This basis adjustment matters because it affects the gain or loss when you eventually sell the replacement shares.

Simple Basis Example

Imagine this sequence:

  1. You buy 100 shares for $5,000.
  2. You sell them for $4,000, creating a $1,000 loss.
  3. Within 30 days, you buy 100 replacement shares for $4,100.

If the transaction is a wash sale, the $1,000 loss is disallowed right now. Instead, your new shares may have an adjusted basis of $5,100 rather than $4,100.

That means the tax benefit is postponed, not erased.

Common Situations That Trigger Wash Sales

Wash sales happen more often than many investors realize. Some common triggers include the following.

1. Rebuying the Same Stock Too Soon

This is the classic case. You sell shares to harvest a tax loss, then decide to “get back in” quickly because the stock still looks attractive.

2. Automatic Dividend Reinvestment

If you sell a mutual fund or stock at a loss and your dividend reinvestment plan automatically buys more shares during the wash-sale window, that can trigger the rule.

3. Purchases in Multiple Accounts

You may sell at a loss in one taxable account and buy the same security in another taxable account. The IRS can still treat that as a wash sale.

This is especially important if you:

  • manage multiple brokerage accounts,
  • invest for a spouse,
  • or trade in both individual and joint accounts.

4. Tax-Loss Harvesting Without a Replacement Plan

Tax-loss harvesting is a popular strategy, but it requires discipline. If you sell an investment at a loss and don’t wait long enough before buying it back, the tax benefit disappears for now.

Accounts Where the Rule Applies

The wash-sale rule applies to taxable brokerage accounts. It does not generally apply in the same way inside tax-advantaged retirement accounts, but buying the same security in an IRA can still create complications.

Important Caution About IRAs

If you sell a security at a loss in a taxable account and buy it in an IRA within the wash-sale window, the loss may be permanently lost rather than added to basis in a taxable account. That can create a worse outcome than many investors expect.

Because IRA transactions can have special tax consequences, it is wise to review these moves carefully before acting.

Strategies to Avoid Wash Sales

You can still manage taxes effectively without accidentally triggering the rule. The key is planning.

Use a Similar but Not Substantially Identical Investment

One common approach is to sell one investment and buy a different one that gives you similar market exposure.

For example:

  • Sell one broad market ETF and buy a different broad market ETF with a different index
  • Sell one large-cap fund and buy a total market fund
  • Sell a stock and use a sector ETF temporarily if your strategy allows

The goal is to stay invested while avoiding a prohibited replacement.

Wait at Least 31 Days

If you want to buy the same security again, wait outside the 30-day window before or after the sale.

A simple rule of thumb:

  • Sell today
  • Wait 31 days before repurchasing

This is one of the easiest ways to reduce wash-sale risk.

Infographic explaining the wash-sale rule and how quick repurchases can make investment losses nondeductible

Watch Dividend Reinvestment Settings

If you are harvesting losses, review automatic reinvestment settings before the sale. A small dividend reinvestment can trigger a wash sale if it occurs during the restricted period.

Coordinate Across All Accounts

Check all taxable accounts before selling at a loss. A repurchase in another account can still create a wash sale.

Keep Good Records

Track:

  • purchase dates
  • sale dates
  • sale price
  • replacement purchases
  • adjusted cost basis

Your broker may report wash sales, but it is still smart to keep your own records, especially if you trade across multiple accounts.

Wash Sale Rule Explained for Investors Who Use Tax-Loss Harvesting

Tax-loss harvesting is the practice of selling investments at a loss to offset taxable gains. It can be useful, but only if you avoid wash sales.

A Basic Tax-Loss Harvesting Process

  1. Identify an investment with an unrealized loss.
  2. Sell it in a taxable account.
  3. Buy a similar but not substantially identical investment.
  4. Wait at least 31 days before repurchasing the original investment if you want to return to it.

Example

You sell a technology ETF at a loss. Instead of buying the same ETF back immediately, you buy a different technology or broad-market fund that gives you similar exposure. After 31 days, you can decide whether to switch back.

This allows you to stay in the market while preserving the loss for tax purposes.

Reporting Wash Sales on Your Tax Return

Wash sales are often reported on Form 1099-B by your broker, but the responsibility for correct tax reporting still rests with you.

If your broker reports a wash sale:

  • verify the dates and shares involved,
  • confirm the disallowed loss amount,
  • and make sure your cost basis records are correct.

If you trade in multiple accounts or use more than one broker, the reporting may not automatically capture every wash sale. That is why careful tracking matters.

When to Be Especially Careful

The wash-sale rule deserves extra attention in these situations:

  • year-end tax-loss harvesting
  • frequent trading
  • dividend reinvestment plans
  • multiple brokerage accounts
  • trading around volatile markets
  • buying index funds with overlapping holdings
  • IRA and taxable account transactions involving the same security

If your strategy involves several moving parts, a small timing mistake can cancel the loss deduction.

Practical Scenarios

Scenario 1: The Quick Rebuy

You sell shares of a company at a loss on Monday because you want to capture the tax benefit. On Thursday, the stock drops further, and you buy it back.

That is likely a wash sale, because you repurchased within 30 days.

Scenario 2: The Dividend Surprise

You sell a mutual fund at a loss on July 10. On July 25, an automatic dividend reinvestment buys additional shares of the same fund.

Even if you did not manually place the order, the purchase could trigger the wash-sale rule.

Scenario 3: The Replacement Fund

You sell one total-market ETF at a loss and buy a different total-market ETF with a distinct index strategy.

This may avoid a wash sale, but you should compare the funds carefully. If they are too similar, the IRS could challenge the position.

Key Takeaways

The wash-sale rule can prevent you from deducting an investment loss when you repurchase the same or a substantially identical security within 30 days before or after the sale. It is most often a problem for active investors, tax-loss harvesters, and people with automatic reinvestment settings.

To reduce risk:

  • wait 31 days before buying back the same security,
  • use a similar but different replacement investment,
  • review all taxable accounts,
  • and watch for automatic purchases.

A little planning can protect the tax value of your losses without forcing you out of the market longer than necessary.

Frequently Asked Questions

1. What is the wash-sale rule in simple terms?

The wash-sale rule says you cannot claim a tax loss if you sell an investment and buy the same or a substantially identical one within 30 days before or after the sale. The IRS treats the loss as disallowed for now, although it may be added to the cost basis of the new shares.

2. Does the wash-sale rule apply to stocks, ETFs, and mutual funds?

Yes. It can apply to stocks, ETFs, mutual funds, and certain other securities. The rule is most obvious when you sell and repurchase the exact same security, but similar funds can also raise concerns if they are substantially identical.

3. Can a wash sale happen across different brokerage accounts?

Yes. A sale in one taxable account and a purchase in another taxable account can still create a wash sale. The IRS looks at your overall trading activity, not just one account in isolation.

4. What happens if I accidentally trigger a wash sale?

If you trigger a wash sale, the loss is usually disallowed for the current tax year and added to the basis of the replacement shares. You may still recover the tax benefit later when you sell those replacement shares, but the timing changes.

5. How can I avoid a wash sale when tax-loss harvesting?

The safest approach is to sell the investment at a loss and buy a different, not substantially identical investment for at least 31 days. Also check dividend reinvestment settings and all of your taxable accounts before making the trade.

Official Resources

Conclusion

The wash-sale rule can be frustrating, but it is manageable once you understand how it works. At its core, the rule is designed to stop investors from claiming a tax loss while keeping essentially the same position. That means timing matters. A repurchase too soon, an automatic dividend reinvestment, or a purchase in another account can all turn a deductible loss into a disallowed one for the moment.

For investors who use tax-loss harvesting, the wash-sale rule is especially important. It does not mean you should avoid selling losing investments. Instead, it means you should sell with a clear plan. Choose a replacement investment carefully, track your dates, and coordinate across all of your accounts. With a little discipline, you can preserve the tax value of your losses and avoid costly mistakes.

If you want to make smarter tax decisions, start by reviewing your brokerage activity before year-end and checking whether any planned trades could fall inside the 30-day window.

Sarah Mitchell

Mary S, CFP®, is a Certified Financial Planner with over 12 years of experience in personal finance, retirement planning, and wealth management. She writes educational content that helps readers understand financial concepts and make informed decisions based on reliable information.