S&P 500 7,457.69 ↓ 1.01%Dow Jones 52,146.42 ↓ 0.77%Nasdaq 25,520.24 ↓ 1.4%BTC $63,700 ↓ 1.2%ETH $1,855 ↓ 2.9%EUR/USD 1.1435Inflation 3.5% YoYLive market dataS&P 500 7,457.69 ↓ 1.01%Dow Jones 52,146.42 ↓ 0.77%Nasdaq 25,520.24 ↓ 1.4%BTC $63,700 ↓ 1.2%ETH $1,855 ↓ 2.9%EUR/USD 1.1435Inflation 3.5% YoYLive market data

The Wash Sale Rule Explained: Avoid a Costly Mistake

You sold a stock at a loss to save on taxes, then bought it right back. The IRS may quietly erase that write-off. Here is how the wash sale rule really works.
The Wash Sale Rule Explained: Avoid a Costly Mistake

Key takeaways

  • A wash sale happens when you sell a security at a loss and buy the same or a substantially identical security within 30 days before or after the sale, a 61-day window in total.
  • The disallowed loss is not gone forever. It gets added to the cost basis of your replacement shares, and the old holding period carries over.
  • Automatic dividend reinvestment is the most common accidental trigger, because it buys shares for you without you thinking about it.
  • Selling at a loss in a taxable account and rebuying in your IRA permanently kills the loss, with no basis adjustment to recover it later.
  • The rule currently applies to stocks, bonds, options, and warrants, but crypto is generally not treated as a security today. That could change.
  • The clean fixes are simple. Wait 31 days before rebuying, or buy a similar but not identical fund to stay invested.

Picture this. It is late December, one of your stocks is down a few thousand dollars, and you read somewhere that you can sell losers to shrink your tax bill. So you sell. You feel clever. Then, a week later, the stock looks cheap and you buy it right back. You still hold the investment you liked, and you booked a nice loss for your taxes. Free money, right?

Not quite. The IRS saw this move coming almost a hundred years ago and built a rule to stop it. It is called the wash sale rule, and if you trip over it, that loss you were counting on can quietly vanish from your tax return. The good news is that the rule is very learnable. Once you understand the 61-day window and a couple of common traps, you can harvest losses on purpose without ever getting burned.

This guide walks through exactly what the rule is, why it exists, what actually happens to a disallowed loss, and the everyday mistakes that catch honest investors. We will do real math so you can see the mechanics, not just the theory.

What the wash sale rule actually says

Here is the plain version. You cannot deduct a loss on the sale of a security if you buy the same or a substantially identical security within 30 days before or 30 days after that sale. Count the day of the sale in the middle, add 30 days on each side, and you get a 61-day danger zone.

People forget the backward-looking half all the time. It is not just 30 days after you sell. It is also 30 days before. So if you bought more shares two weeks ago and then sell at a loss today, that earlier purchase can trigger a wash sale on the shares you just sold. The rule does not care about your intentions. It only cares about the timing and the securities involved.

One more thing to lock in early. The rule only applies to losses. If you sell for a gain, none of this matters. You simply have a taxable gain, and you can buy the security back the same afternoon if you want.

It also helps to know where this lives. The wash sale rule sits in Section 1091 of the Internal Revenue Code, and the IRS explains it in plain language in Publication 550. When people say a loss was disallowed, they are pointing at this section. The word wash refers to the idea that your position comes out in the wash, meaning it looks the same before and after the trade. The tax code does not want to reward a trade that changed nothing.

How to count the 61 days correctly

The single most common source of confusion is the counting. People hear thirty days and assume they only have to think about the future. In reality you count calendar days, not trading days, and you count in both directions.

Start with the day you sell. That is day zero, the center of the window. Now count 30 calendar days forward. Weekends and holidays are included, so a sale on the first of the month opens a window that runs through roughly the last day of that month. Then count 30 calendar days backward from the sale. Add the sale day itself, and the total is 61 days of exposure.

Here is the practical takeaway. If you want to sell at a loss and be completely safe, look 30 days into the past to make sure you did not recently buy the same security, and then stay out for 31 days after the sale before buying again. That 31st day is your first clean day. Waiting the full 31 removes any argument about whether day 30 counts.

Why this rule exists in the first place

The wash sale rule is not there to punish you. It is there to stop a specific trick. Without it, an investor could sell any losing position on December 31, claim the full loss against their income, and rebuy the identical shares on January 2. Their portfolio would look exactly the same, but they would have manufactured a tax deduction out of thin air. Congress decided that a loss should only count if you genuinely give up your position, at least for a while.

So the deal is fair. If you truly change your investment, meaning you sell and stay out or move to something different, you keep the deduction. If you sell and immediately reclaim the same economic position, the tax benefit gets deferred. You are not being robbed. You are being asked to wait.

What "substantially identical" really means

This phrase does a lot of heavy lifting, and the IRS has never published a clean checklist. Here is how it plays out in practice.

The same stock is identical. Selling 100 shares of a company and buying 100 shares of the same company is the textbook case. No ambiguity.

Different companies are not identical. Two banks, two automakers, two chip designers. Even if they move together, stock in one company is not substantially identical to stock in another. So you can sell one and buy a competitor without a wash sale.

Options and warrants count. This surprises people. If you sell stock at a loss and then buy a call option on that same stock inside the window, the IRS treats the option as substantially identical to the stock. Warrants work the same way. The rule follows the economics, not just the ticker symbol.

Bonds are usually judged on their terms. Two bonds with meaningfully different issuers, coupons, or maturities are generally not identical. Small differences in terms can be enough to separate them.

Index funds are the gray area. This is where investors get nervous, and rightly so. Two funds that track the exact same index, say two different S&P 500 funds from two different companies, are close enough that many advisors treat them as substantially identical and avoid the swap. But a total stock market fund and an S&P 500 fund hold different baskets and are generally treated as different enough. The safest similar-but-not-identical swaps pair funds that track genuinely different indexes.

What happens to the disallowed loss

Here is the part that saves people from panic. When a wash sale disallows your loss, that loss is almost never destroyed. In a normal taxable account, two things happen automatically.

First, the disallowed loss is added to the cost basis of your replacement shares. Your new shares now have a higher basis, which means a bigger loss or a smaller gain when you eventually sell them for real. The deduction is not gone. It is parked inside the new shares, waiting.

Second, the holding period carries over. The time you held the original shares gets added to the holding period of the replacement shares. This matters because long-term capital gains get better tax treatment than short-term ones, and you do not lose that clock just because a wash sale happened.

Let us make that concrete with numbers.

Say you bought 100 shares at $50, for a $5,000 cost. The price drops and you sell all 100 at $40, for $4,000. That is a $1,000 loss on paper. But three days later you rebuy 100 shares at $42, spending $4,200. Because you repurchased inside the window, the $1,000 loss is disallowed for now.

Instead of vanishing, that $1,000 gets added to your new basis. Your replacement shares cost you $4,200, but for tax purposes your basis becomes $4,200 plus $1,000, which is $5,200. If you later sell those shares at $5,300, your taxable gain is only $100, not $1,100. You recovered the full benefit of the loss. It just showed up later.

Now let us walk through a partial wash sale, because that is where the math gets tricky and where a lot of people misjudge the damage. Suppose you bought 200 shares at $50, spending $10,000. The price falls and you sell all 200 at $40, collecting $8,000. That is a $2,000 loss on paper. Within the window you rebuy only 50 shares at $41, spending $2,050. Because you replaced only a quarter of what you sold, only a quarter of the loss gets disallowed.

Here is the arithmetic. You sold 200 shares and rebought 50, so 50 divided by 200 is one quarter. One quarter of the $2,000 loss is $500. That $500 is disallowed and rides along on your 50 replacement shares, lifting their basis from $2,050 to $2,550. The other $1,500 of loss is fully deductible right now. So a partial rebuy does not poison the whole loss. It only touches the fraction you replaced. Understanding this can turn a scary looking 1099-B into something you actually follow.

Notice what did not happen in either example. The loss was never destroyed in these taxable-account cases. It was deferred and preserved inside the new shares. That distinction between deferred and destroyed is the heart of the whole rule, and it is why a wash sale in a normal brokerage account is usually an annoyance rather than a disaster.

The traps that catch good investors

Most wash sales are accidents, not schemes. These are the ways smart people trip.

Automatic dividend reinvestment

This is the number one culprit. If you have dividend reinvestment turned on, your fund or stock quietly buys new shares every time it pays a dividend. Sell a fund at a loss on the 10th, and if that same fund pays a dividend on the 20th and reinvests it, you just bought shares inside the window. Even a tiny reinvestment of a few dollars can trigger a wash sale on part of your loss. Before you harvest a loss, turn off automatic reinvestment on that holding.

Selling in taxable, buying in your IRA

This one is genuinely harsh, so read it twice. If you sell a security at a loss in your regular taxable account and buy the same or substantially identical security in your IRA or Roth IRA within the window, the loss is disallowed and it is gone for good. There is no basis adjustment inside the IRA to recover it, because IRA basis does not work that way for these purposes. Unlike a normal wash sale, this one does not defer the loss. It deletes it. Keep your loss harvesting and your retirement buys clearly separated.

Your spouse and your business

The rule reaches beyond your own account. A purchase by your spouse of substantially identical securities can trigger a wash sale against your loss, because the IRS looks at the household. The same goes for a corporation you control. You cannot dodge the rule by having a related party do the buying.

Across your own accounts

Selling at a loss in one brokerage and rebuying in another brokerage still counts. The wash sale rule follows you, the taxpayer, across every account you own. Your brokers will not see each other, so they will not warn you.

Year-end timing and the January problem

December is prime loss-harvesting season, and it is also when the calendar bites hardest. Remember that the 30-day window runs forward past the end of the year. If you sell at a loss on December 20 to lock in a deduction for this tax year, and then rebuy the same security on January 5, you are still inside the 61-day window. The loss you were counting on for this year gets disallowed and deferred, even though the two trades landed in different tax years. The IRS does not reset the clock on January 1.

Buying more before you sell the rest

This is the backward-looking trap in action. Say you own a stock and, feeling optimistic, you buy an extra block of shares. Two weeks later you change your mind and sell your original shares at a loss. That recent purchase you made before the sale can trigger a wash sale on the shares you just sold, because it falls inside the 30 days before window. People almost never see this one coming, because they assume only future purchases matter.

How this connects to tax-loss harvesting

Tax-loss harvesting is the intentional, legal version of what the wash sale rule is designed to police. The idea is simple and useful. You sell an investment that is down, book the loss to offset gains or up to $3,000 of ordinary income per year, and stay invested in the market. The wash sale rule is the guardrail that tells you how to do it without erasing your own work.

There are two clean approaches, and both are widely used.

Wait 31 days. Sell the loser, sit in cash or a clearly different holding for 31 calendar days, then buy your original security back. The window closes and the loss is fully yours. The only cost is that you are out of that specific position for a month, which carries some market risk.

Buy a similar but not identical replacement. Sell your losing fund and immediately buy a different fund that tracks a different index but gives you similar market exposure. You stay invested the whole time and never trip the rule, as long as the replacement is not substantially identical. After 31 days you can switch back if you like, or just keep the new fund.

Why bother at all? Because a booked loss has real cash value. Say you harvest $3,000 of losses in a year and you cannot use them against any capital gains. You can still deduct that $3,000 against your ordinary income. If you sit in a 24 percent federal bracket, that deduction is worth about $720 in reduced tax. If your losses run larger than your gains plus that $3,000 limit, the extra does not disappear either. It carries forward to future years, offsetting future gains and another $3,000 of income each year until it is used up. The wash sale rule simply insists that you earn this benefit by genuinely stepping away from the position, not by pretending to.

A quick word on transaction costs. In 2026 most major brokers charge zero commission on stock and ETF trades, so the mechanical cost of harvesting is usually just the bid-ask spread and any small price drift while you are out of the market. That is worth weighing against the tax benefit. For a modest loss on a low-cost fund, the tax savings almost always win. For a tiny position, sometimes it is not worth the effort.

Does the wash sale rule apply to crypto?

As of 2026, here is the honest answer. The IRS generally treats cryptocurrency as property, not as a security, and the wash sale rule as written applies to securities. That means selling Bitcoin at a loss and rebuying it minutes later does not clearly trigger a wash sale today. Some active investors have used this to harvest crypto losses aggressively.

Two big cautions. First, lawmakers have proposed closing this gap several times, and the treatment could change with new legislation, possibly with little warning. Second, tokens that are structured more like securities, or crypto held through certain securities-like products, may be treated differently. This is a description of current general treatment, not tax advice. If you are harvesting crypto losses in size, confirm your situation with a tax professional before you rely on it.

How brokers report wash sales on your 1099-B

When tax season arrives, your broker sends you a Form 1099-B that lists your sales. If a wash sale happened inside that single account for an identical security, the broker adjusts it for you and reports the disallowed amount, usually in a column labeled something like wash sale loss disallowed. That figure flows onto Form 8949 and then Schedule D when you file.

Do not assume the 1099-B catches everything. Brokers are only required to track wash sales within their own walls for identical securities. They do not see your other brokerage, your spouse's account, or your IRA. They also generally do not flag substantially identical funds that are not literally the same security. So the numbers on your 1099-B are a starting point, and the cross-account and cross-fund gaps are yours to watch.

A simple way to stay clean

You do not need to memorize the tax code to avoid a costly wash sale. A short mental checklist does the job. Before you harvest any loss, ask yourself these questions.

Did I buy this same security anywhere in the last 30 days, including through automatic reinvestment? Will I be tempted to rebuy it in the next 30 days? Is my dividend reinvestment turned off on this holding? Am I keeping this trade out of my IRA? Is my replacement fund genuinely different, or just a clone of the one I sold?

If you can answer those cleanly, you are almost certainly fine. Harvesting losses is one of the few tax moves ordinary investors can use to keep more of their own money, and the wash sale rule is not there to stop you. It is there to make sure you actually change something before you claim the reward. Wait the 31 days, or pick a different fund, and the loss is yours to keep.

None of this is personal tax advice, and your own situation may have wrinkles this guide does not cover. When real dollars are on the line, a quick conversation with a tax professional is cheap insurance.

Earnings power first

Your best investment may still be a better-fit career.

Compounding is powerful. So is raising the income that feeds the portfolio. Real World Careers finds careers that match how your brain works, then Job Radar helps you hunt them.

Real World Careers · Advanced Learning Academy · Same family as DollarFlourish
$29.95Job Radar — self-directed job search (USAJobs, Jooble, CareerJet, Adzuna). No assessment required.Start Job Radar
$99–$199Full cognitive assessment, 6 brain regions, career matches, employer credential. Pro adds salary intelligence.See pricing

Questions people ask

Does the wash sale rule apply to gains?

No. The rule only touches losses. If you sell for a gain, you owe tax on that gain and there is no wash sale issue at all. The rule exists to stop people from claiming a paper loss while keeping the same investment position, so it simply does not apply when you made money.

How long do I have to wait to buy the stock back?

You need to stay out for the full 30 days after the sale. To be safe, most people wait 31 calendar days before repurchasing. The window also looks 30 days backward, so a purchase you made shortly before the sale can trigger it too.

Is the disallowed loss lost forever?

Usually not. In an ordinary taxable account, the disallowed loss is added to the cost basis of the shares you bought, so you recover the benefit when you eventually sell those. The one big exception is buying the replacement shares inside an IRA or Roth IRA, where the loss is permanently gone.

Does the wash sale rule apply to cryptocurrency?

As of 2026, the IRS generally treats crypto as property rather than a security, so the wash sale rule does not clearly apply to a coin like Bitcoin or Ethereum. Lawmakers have repeatedly proposed closing this gap, so the treatment could change. This is a description of current rules, not tax advice, and a tax professional can confirm your situation.

Will my broker warn me about a wash sale?

Your broker tracks wash sales within a single account for identical securities and reports disallowed amounts on your Form 1099-B, usually in a box or column labeled wash sale loss disallowed. But brokers do not track across different accounts, across a spouse's account, or across substantially identical but not identical funds. Those gaps are your responsibility.

What counts as substantially identical?

The same stock is clearly identical. Stock in two different companies is not, even in the same industry. Options and warrants to buy a stock count as substantially identical to the stock itself. Two index funds that track the exact same index are a gray area that many advisors treat cautiously, while a total market fund and an S&P 500 fund are generally considered different enough.

Just so you know: DollarFlourish is an educational publisher, not a financial, tax, or investment advisor. Numbers and rates change. Verify anything important with a licensed professional before acting on it. Some links on this site may earn us a commission at no cost to you. See how we review.
DollarFlourish Editorial
Editorial Desk

DollarFlourish Editorial produces plain-spoken money guides under the site's accuracy standards. Material claims are sourced, reviewed, and updated when the underlying data changes.

Reviewed for accuracy by Timothy E. Parker · Updated 2026-07-18 · Editorial & corrections policy

The Flourish Letter

One useful money idea every Friday, with the interactive chart so you can check the math. Free. Welcome path: free printable toolkit (calendar, debt sheet, raise script, and more).