Enter your loss sale and any replacement purchase to see how much of your capital loss the IRS disallows under Section 1091 โ and how the disallowed amount is added to the cost basis of the shares you bought back inside the 30-day window.
Tax-loss harvesting โ selling a losing position to lock in a deductible capital loss โ is one of the most effective ways to reduce your tax bill. But the IRS closes the loophole of selling at a loss and immediately buying the same security back with Section 1091 of the Internal Revenue Code. If you buy a substantially identical security within 30 days before or after the loss sale, the IRS treats the round trip as if you never really exited the position: the loss on the sale is disallowed for the current tax year.
The rule applies to stocks, bonds, options, ETFs, and mutual funds โ not just the shares you sell from a brokerage account. The wash sale rule does not apply to tax-exempt bond funds, but it does apply to taxable funds and nearly every other security. Crucially, the disallowed loss is not lost forever: it is added to the cost basis of the replacement shares, so the tax benefit is simply deferred until you eventually sell those replacement shares outside another wash-sale window.
For example, selling 100 shares that fell from $50 to $30 creates a loss of $20 per share โ a $2,000 total loss. If you buy 100 replacement shares within the window, all $2,000 is disallowed this year and is instead folded into the basis of your new shares, lowering the taxable gain (or increasing the loss) when you sell them later.
The wash sale rule is built around a 61-day window: the 30 calendar days before the sale, the day of the sale itself, and the 30 calendar days after the sale. Any purchase of a substantially identical security inside that window can disallow (or partially disallow) the loss. That means the classic mistake โ selling on Monday and buying back on Friday โ is fully covered, but so is the subtler version where you bought additional shares a few weeks before selling the rest at a loss. The IRS does not care which trade came first; it only cares that both sides of the transaction happened within 61 days of each other.
The safe path is simple: wait at least 31 days after the loss sale before buying the security back (and make sure you did not buy any within the 30 days before the sale). Day 31 falls outside the window, so the loss stays deductible and you can restore your position with only a month out of the market. In this calculator, enter 31โ60 in the "Days Between" field to confirm that a later buy-back is treated as fully deductible. Note that the rule is checked against calendar days, not trading days, and the direction of the gap (before or after the sale) does not matter.
A wash sale can only occur when the sale is at a loss. Selling at a gain and repurchasing triggers no restriction โ the gain is simply realized and taxed normally. Likewise, if the replacement purchase happens on day 31 or later, no loss is disallowed even though you are back in the same stock.
"Substantially identical" is deliberately broader than "the exact same ticker." The IRS looks at whether the replacement is the same security or so close to it that you have kept your economic position intact:
Because Section 1091 reaches options, convertible instruments, and funds, a wash sale can occur even when the replacement trade does not involve the exact same stock you sold. If you are unsure whether two positions are substantially identical, treat them as if they are โ the cost of waiting 31 days is usually far smaller than the cost of a surprise disallowed loss.
The most reported wash sale triggers are accidental, which is exactly why the rule catches so many investors. A dividend reinvestment plan (DRIP) is the classic trap: you sell shares of a fund at a loss for tax purposes, and a few days later the fund's dividend is automatically reinvested into new shares of the same fund โ inside the 61-day window. Even though you never "chose" to buy, the reinvested shares are a replacement purchase and a proportional part of your loss is disallowed. If you plan to harvest a loss from a position that pays dividends, turn off automatic reinvestment at least 31 days before the sale.
Retirement accounts create a harsher version of the same problem. The wash sale rule applies across taxable and tax-advantaged accounts: if you sell a stock at a loss in your taxable brokerage account and buy the same stock inside your IRA within the window, the taxable loss is disallowed. But because IRAs do not track cost basis for tax purposes, the disallowed loss is never added to the basis of the IRA shares โ the tax benefit is permanently lost rather than deferred. Buying replacement shares in an IRA is one of the few ways to turn a deferral into a true forfeiture, so review your whole portfolio, including automatic 401(k) contributions and IRA purchases, before harvesting a loss.
Finally, the IRS aggregates wash sales across all of your accounts and even across brokers โ your brokerage only reports disallowed losses it can see on your own Form 1099-B, so a repurchase at a different firm will still trigger the rule even if no broker flags it. If you trade the same security in more than one account, treat your entire portfolio as one position when planning loss sales.
Wait at least 31 days after a loss sale before repurchasing, and do not buy within the 30 days before the sale. Day 31 sits safely outside the 61-day window.
Disable dividend reinvestment on any position you plan to sell at a loss โ automatic reinvestment inside the window creates an unintended partial wash sale.
Never use an IRA to buy the replacement shares. The loss is disallowed in your taxable account but no basis adjustment is made in the IRA, so the deduction vanishes.
Check every account and every broker. Spouse accounts and accounts in your name are aggregated by the IRS, even when no single broker can see the full picture.
Once a loss is allowable, it first offsets your capital gains for the year โ short-term losses (positions held less than one year) offset short-term gains first, then long-term gains โ and any remaining net loss can offset up to $3,000 of ordinary income per year ($1,500 if married filing separately). Excess losses carry forward indefinitely to future years, which is why building up harvested losses in down years can pay dividends for years to come.
The value of an allowable loss depends on the tax rate it offsets. For long-term capital gains in 2026, the federal rate structure remains 0%, 15%, and 20% depending on your taxable income bracket, and high-income taxpayers add the 3.8% Net Investment Income Tax (NIIT) on top of their investment income. Offsetting a 20%-bracket gain with a $2,000 harvested loss saves $400 in federal tax (plus NIIT where applicable); offsetting ordinary income with the $3,000 cap can save roughly $750โ$1,110 depending on your marginal income tax bracket. Because of the wash sale rule, a disallowed loss produces none of these benefits in the current year โ the saving is pushed into whatever year you finally sell the replacement shares.
| Scenario โ sell 100 sh at a $15/share loss ($1,500 total) | Loss usable this year? | What happens to the $1,500 |
|---|---|---|
| Sell at a loss, no repurchase | โ Yes โ $1,500 deductible | Offsets capital gains, then up to $3,000 of ordinary income |
| Sell at a loss, buy back 100 sh within 30 days | โ No โ fully disallowed | Added to the cost basis of the 100 replacement shares |
| Sell at a loss, buy back only 40 sh within 30 days | โ ๏ธ Partially โ $900 deductible | $600 disallowed attaches to the 40 replacement shares |
| Sell at a loss, buy back 100 sh on day 31+ | โ Yes โ $1,500 deductible | Loss used now; position restored outside the 61-day window |
Tax savings shown assume the loss offsets income or gains that would otherwise be taxed; your actual result depends on your filing status, bracket, and the NIIT thresholds that apply to you.
You bought 100 shares of XYZ at $50 and sold them at $35 โ a loss of $15 per share. Twelve days later you buy 100 replacement shares at $38.
Total loss: $15 ร 100 = $1,500 (fully disallowed)
Adjusted basis of replacements: (100 ร $38) + $1,500 = $5,300 โ that is $53 per share, your original $50 cost plus the $3-per-share discount you captured on the sale.
When you later sell these shares, your gain is $15 per share smaller than it would have been without the adjustment โ the deduction is deferred, not destroyed.
Same sale, but you only buy back 40 shares at $38 within the window. Only 40 of your 100 sold shares are "matched," so the disallowed ratio is 40 รท 100 = 40%.
Disallowed loss: $1,500 ร 0.40 = $600 | Allowable loss: $1,500 โ $600 = $900
Adjusted basis of the 40 shares: (40 ร $38) + $600 = $2,120 โ still $53 per share, because each matched replacement share inherits the full $15 deferred loss.
You deduct $900 this year and keep the remaining $600 attached to the shares you actually re-bought.
The same $1,500 loss sale, but you wait 32 days to buy back. The repurchase lands outside the 61-day window.
Disallowed loss: $0 | Allowable loss: $1,500, deductible this year
Adjusted basis of the new shares: 100 ร $38 = $3,800 โ no adjustment, because no loss was disallowed.
You get the full deduction now and a clean $38-per-share basis. The only cost is staying out of the position for a month.
The window runs 30 calendar days before the loss sale, the day of the sale itself, and 30 days after โ 61 calendar days in total. If you acquire a substantially identical security anywhere inside that span, the related loss is disallowed or partially disallowed, regardless of whether the purchase came before or after the sale.
The IRS has never published a definitive rule for index-tracking funds from different providers, so the answer is a gray area. Many tax professionals treat different funds as not substantially identical because they are separate securities with different holdings, but the conservative approach is to wait 31 days or switch to a fund tracking a different index before harvesting the loss.
Yes. If your DRIP automatically buys new shares of the same fund or stock within 30 days before or after you sell at a loss, those reinvested shares count as a replacement purchase and a proportional part of the loss is disallowed โ even though the buy was automatic. Pause dividend reinvestment for the position well before you sell, ideally at least 31 days earlier.
The wash sale rule still applies across accounts: a substantially identical purchase inside your IRA within the window disallows the loss in your taxable account. The difference is that an IRA has no cost-basis tracking, so the disallowed loss is never added to the IRA shares โ the deduction is permanently lost instead of deferred. Never use a retirement account to re-buy a position you sold at a loss.
No โ in a taxable account the disallowed loss is added to the cost basis of the replacement shares. When you eventually sell those shares outside another wash-sale window, your gain is reduced (or your loss increased) by exactly the deferred amount, so the tax benefit is postponed rather than eliminated.
โ ๏ธ Important Disclaimer: This Wash Sale Calculator is for informational and educational purposes only. It models the simplified single-lot version of the IRS wash sale rule under Section 1091 and does not account for multiple tax lots, options, short sales, or the special matching rules brokers and the IRS apply in complex cases. It does not constitute tax, legal, or financial advice. Verify any planned transaction with a qualified tax professional before acting.