You sold a losing stock in December to bank a tax benefit, then your broker's form marked it as disallowed. That sting has a name, and it catches careful investors every year.
The good news is the rule is simple once you see how the timing works.
This guide walks through what the rule is, the timing window that trips people up, what counts as substantially identical, where your loss actually goes, and how to harvest losses without losing the deduction.
The wash sale rule is a tax provision in Section 1091 of the Internal Revenue Code. The wash sale rule prevents you from claiming a loss when you sell a security at a loss and buy a near-identical one too close to that sale.
Here is the core of it. The wash-sale rule states that if you sell a security at a loss, and within 30 days before or 30 days after that sale you acquire substantially identical stock or securities, the loss on the sale is disallowed. The statute frames it as any sale or other disposition where, within that span, you buy or even enter a contract or option to buy the same position. That before-and-after span is the part people miss. It is not a 30-day clock running forward from the sale. It runs 30 days before or 30 days after, which is a span of 61 days when you count the sale date in the middle. A repurchase anywhere within the 61-day period counts. The mechanics are spelled out in IRS Publication 550, and that IRS rule covers you whether you trip it on purpose or by accident.
Once you picture the calendar, the wash sale rule works the way a tripwire does. Count 30 days before the sale, the sale day itself, and 30 days after the sale, and you have the full window where a repurchase causes trouble.
The count uses calendar days, not trading days, so weekends and holidays are included. Because the math is exact, a repurchase on day 30 still triggers the rule, while a purchase on day 31 is clean. Say you are selling a stock at a loss on July 1. Buy it back any time within a 61-day period, from June 1 through July 31, and the loss is gone for now. Wait until August 1, the 31st day after the sale, and you are fine. The same trap works in reverse: a recent buy that creates a loss within 30 days before the sale counts too, so a purchase you made weeks earlier, falling within the wash sale window, can disallow a loss you take today. The simplest fix is to keep the position clean of any matching buy for the entire window, then handle the sale to repurchase gap deliberately.
This is the murkiest piece, because the phrase is not defined in the statute. The agency decides whether two positions are identical enough based on the facts, so a little judgment is involved.
Some cases are settled. The same company's common stock is always a match, so selling and rebuying the same stock is the textbook wash sale. Stock in a different company generally is not a match, even in the same industry. Funds are trickier. Selling one mutual fund and buying the exact same one is clearly a wash, but selling an S&P 500 fund and buying a different provider's S&P 500 fund sits in a gray zone that most tax professionals treat as not identical because the funds have different management and structure. For purposes of the wash sale, the rule also reaches a contract or option to acquire the security, so buying a call on a stock you just sold at a loss can trigger the wash sale rule. The sneakiest trigger is a dividend reinvestment, where a reinvested payout quietly buys new shares inside your window. Even a few of those automatic shares count as buying substantially identical securities, so the purchase is considered a wash sale. When the IRS determines if your transactions crossed the line, these automatic buys are exactly what it looks at.
Here is the part that softens the blow, and it is the detail most people get wrong. When the loss is denied, it is not destroyed. You get the loss back later, just not yet.
The disallowed loss gets added to the cost basis of the replacement shares you bought. So if you sold 100 shares at a 2,000 dollar loss and rebought 100 shares inside the window, the deduction is denied for the tax year, but your new shares carry a basis 2,000 dollars higher. You recover the benefit when you eventually sell those replacement shares in a clean trade. There is a second gift hiding in here. The holding period of the original shares is added to the new shares, so the holding period of the original position carries forward. That can turn what looks like a short-term result into a long-term capital gain, which is taxed at the lower capital gains tax rate. The adjustment is reported on Form 8949 and flows to your federal tax return with a wash sale code, so the loss is disallowed for tax this year, and the loss for the tax year is tracked and carried forward.
The wash sale rule is not confined to one account, and that is where investors get burned. The wash sale rule applies across all your accounts, not only the one where you sold.
The worst version involves a retirement account. If you sell at a loss in your brokerage account and buy the matching security in your IRA or Roth IRA within the window, the loss is denied and it does not get added to your IRA basis. That loss is gone for good, the one case where a wash sale is permanent rather than deferred. The rule applies to family and entities too. If your spouse or a corporation you control buys the same position inside the window, you still trigger a wash sale. Buying in a different brokerage account does not save you either, since the rule looks at you, not the account number. Brokers report wash sales only within a single account, so it is easy to violate the wash sale rule across accounts and never see it flagged until a letter from the IRS shows up.
None of this means you have to give up tax-loss harvesting. Selling an investment at a loss to offset capital gains is a legitimate move, and you can avoid the wash sale rule with a little timing.
The cleanest path is patience: sell the position, then wait at least 31 days before you buy it back. If you cannot stand to be out of the market that long, swap into something similar but not identical, like selling one total-market fund and buying a different index fund, which keeps your exposure while you avoid a wash sale. A third option is the double-up: buy the same number of shares first, wait 31 days, then sell the original lot for the loss. Whatever you choose, track wash sales carefully and turn off automatic dividend reinvestment before you sell. Done right, the harvested loss lets you offset your capital gains, net your gains and losses, and reduce your taxable income, which is the whole point of tax loss harvesting and a staple of year-end tax planning. Spreading the work across the year, rather than only in December, makes it far easier to avoid triggering a wash sale.
Two limits are worth knowing, because they create real opportunities. First, the rule only touches losses, never gains.
If you sell an investment at a profit, there is no wash sale to worry about, since selling at a gain is always taxable at your ordinary income tax rate and you can rebuy immediately. The rule exists only to stop an artificial loss, so a gain is never subject to the wash sale and is never disallowed for tax purposes. Second, and more useful right now, the rule does not apply to cryptocurrency for the current tax year. Section 1091 covers stock and securities, and the agency has not reclassified ordinary crypto tokens as securities, so you can sell a token at a loss and rebuy it the same day. Proposals to change this have come up in Congress without passing, so watch for updates, since IRS regulations and the law can shift. One narrow carve-out already exists for tokenized securities sold and rebought in the same account.
For a single investor, this is a calendar problem. For a CPA firm running dozens of client portfolios, it is a tracking problem that a higher tax bill punishes quietly.
Cross-account purchases, spousal trades, and reinvested dividends slip past broker reporting, and reconstructing them at filing time is slow, detailed work. That is where Madras Accountancy supports US accounting firms, handling the tax preparation and reconciliation that catches wash sales before they hit a return, and the planning support that turns loss harvesting into a deliberate strategy rather than a year-end scramble. The goal is simple: clean records that result in a lower tax outcome for the client, done right the first time. If your firm wants that capacity, talk to our team. For the source rules, the IRS guidance in Publication 550 is the place to start. This article is general information and does not provide legal or tax advice, so check with your tax advisor, or an attorney or tax professional, for your situation.
1. What is the wash sale rule? The wash sale rule is an IRS rule under Section 1091 that disallows a loss when you sell a losing position and buy a substantially identical security within 30 days of the sale. The loss is not deductible in the current tax year, though in most cases it is deferred rather than erased.
2. How long do I have to wait to avoid a wash sale? Wait at least 31 days after the sale before you repurchase the same or a matching security. The window covers 30 days before the sale and 30 days after, so a buy on day 30 still triggers the rule while a buy on day 31 is safe. Watch the 30 days before the sale too.
3. What does "substantially identical" mean? The agency has never defined it precisely, so it judges the facts. The same company's stock is always substantially identical, while a different company's stock usually is not. Two funds tracking the same index from different providers generally fall outside the rule, but there is no guaranteed safe harbor.
4. Does the rule apply to ETFs and mutual funds? Yes. The rule covers stocks, bonds, options, ETFs, and mutual funds. Selling one fund at a loss and buying the exact same fund triggers a wash sale. Buying a similar fund that tracks a different index is the common way investors stay invested without violating the rule.
5. What happens to my denied loss? For most accounts it is added to the basis of your replacement shares, so you recover the benefit when you sell those shares later in a clean trade. The original holding period also carries over. The exception is a purchase inside an IRA, where the loss is lost permanently.
6. Does the rule apply to IRAs? Yes, and it is the harshest version. If you sell at a loss in a taxable account and buy the substantially identical security in your IRA or Roth IRA within the window, the loss is lost and not added to your IRA basis. That deduction disappears for good rather than deferring.
7. Does the rule apply to cryptocurrency? Not for the current tax year. Section 1091 applies to stocks and securities, and the law treats most crypto as property, so selling a token at a loss and rebuying it right away does not trigger the rule. Congress has proposed changing this, so the answer could shift in a future year.
8. How do I report a wash sale? A wash sale is reported on Form 8949 with code "W" in the adjustment column and the disallowed amount entered alongside it, then carried to Schedule D. Your broker flags wash sales within one account on Form 1099-B, but you are responsible for catching them across accounts.

Single-entry vs double-entry bookkeeping made simple: how each accounting system works, the key differences, and which one your small business needs.
%2075-100%20(12).png)
CPA vs EA (enrolled agent) vs tax attorney: how each tax professional differs, who can represent you to the IRS, and which fits your tax needs.
%2075-100%20(9).png)
Learn how tax professionals should respond to a data breach, report theft to the IRS and states, notify clients, meet FTC rules, and prevent future attacks.