Bought back 21 days later
Wash saleYou buy 100 shares back at $32 on 5 January 2027. The whole loss is disallowed and the new shares start at $52 a share, the $32 you paid plus $20 of carried-over loss.
A wash sale is when you sell a stock or fund at a loss and buy the same one, or one that's substantially identical, within 30 days before or after the sale. The IRS won't let you deduct that loss yet. It isn't lost: it moves into the cost basis of the new shares, and their holding period includes the time you held the ones you sold. You get the loss back when you sell the new shares for good.
The purchase in January still disallows a December loss: the window doesn't stop at the end of the tax year. Wait until 15 January to buy back and the full $2,000 counts on your 2026 return.
Enter the sale, every purchase of the same security in the 30 days after it, and any from the 30 days before that you still held when you sold. It works out how much of the loss is disallowed, which shares take it and their new basis.
The sale at a loss
Purchases of the same security · in any of your accounts
Include reinvested dividends, automatic investments and buys at other brokers. Leave out earlier purchases you had already sold before the loss sale. Cost and sale price are per share, after fees. Purchases are matched to the loss in date order, the earliest first, one share for one share. A purchase in your spouse's account counts too; this calculator doesn't place the adjustment on their shares.
Calendar days, not trading days, counted from the trade date of the sale. The sale day plus 30 days either side makes 61.
| Sold at a loss on | Opens | Closes | Buy back |
|---|---|---|---|
| Mon 2 Nov 2026 | Sat 3 Oct | Wed 2 Dec | Thu 3 Dec |
| Mon 16 Nov 2026 | Sat 17 Oct | Wed 16 Dec | Thu 17 Dec |
| Tue 1 Dec 2026 | Sun 1 Nov | Thu 31 Dec | Mon 4 Jan 2027 |
| Tue 15 Dec 2026 | Sun 15 Nov | Thu 14 Jan 2027 | Fri 15 Jan 2027 |
| Tue 22 Dec 2026 | Sun 22 Nov | Thu 21 Jan 2027 | Fri 22 Jan 2027 |
| Thu 31 Dec 2026 | Tue 1 Dec | Sat 30 Jan 2027 | Mon 1 Feb 2027 |
It runs backwards too. Shares you bought in the 30 days before the sale count, as long as you still hold them when you sell. Buy 100 more in late November, sell your original 100 at a loss in December, and that's a wash sale.
It crosses the new year. A loss sold on 31 December 2026 is caught by a purchase as late as 30 January 2027, and it's the 2026 return that loses the deduction.
Trade dates, not settlement. Both the sale and the purchase are dated by the day the trade was made. On day 31 you're clear, even if it's a Sunday; the table shows the first day markets are open.
Some investors double up: they buy the new shares more than 30 days before selling the old ones, so they're never out of the market. For a sale on the last trading day of 2026, the extra shares have to be bought by Monday 30 November. Buy them on 1 December or later and the 31 December sale is a wash sale.
The same 100 shares bought at $50 on 3 March 2026 and sold at $30 on 15 December, a $2,000 loss. Only the purchase around the sale changes.
You buy 100 shares back at $32 on 5 January 2027. The whole loss is disallowed and the new shares start at $52 a share, the $32 you paid plus $20 of carried-over loss.
You buy 100 more at $34 on 25 November, then sell the original 100 on 15 December. The purchase was 20 days before the sale, so it counts. The newer shares' basis becomes $54 a share.
You buy back only 40 shares at $31 on 22 December. Shares are matched one for one, so the loss on 40 of the 100 is disallowed. Those 40 start at $51 a share, and the loss on the other 60 counts.
Your IRA buys 100 shares at $31 on 28 December. It's still a wash sale, but the IRA shares don't take the loss into their basis. The $2,000 is gone for good.
You buy 100 shares back at $33 on 15 January 2027, day 31. The window closed on the 14th, so the whole $2,000 loss goes on your 2026 return. The price rose $3 a share while you waited.
You sell at one broker and buy 100 back at $32 at another on 5 January 2027. The result is the same as the first example, but your 1099-Bs usually won't show it: the adjustment and the $52 basis are yours to make.
The first example, followed to the end: you sell the replacement shares at $35 on 15 June 2027.
Sold for $3,000 against a $5,000 cost. The $2,000 loss is reported with code W and an adjustment that brings it to zero.
$0 deducted100 shares bought for $3,200 on 5 January 2027, plus the $2,000 from the sale. Their holding period includes the 287 days you held the old shares.
$5,200 basisSold for $3,500: $3,500 − $5,200 is a $1,700 loss, the $2,000 that waited less the $300 the new shares gained. Sold after 24 March 2027, so with the carried-over days it's a long-term loss.
−$1,700 deductedYou held the first shares from 3 March to 15 December 2026, 287 days. The new shares are treated as if you'd held them those 287 days already, so they count as bought on 24 March 2026 and are long-term from 25 March 2027, not from January 2028.
That matters when you sell: a long-term loss nets against long-term gains first, which are taxed at 0%, 15% or 20%, rather than against short-term gains taxed as income.
In a taxable account the wash sale rule only postpones the loss until you sell the replacement shares, whether that's later the same year or years later. You still get it, and in the meantime you keep the market exposure you wanted.
The exception is an IRA or Roth IRA. If the replacement shares are bought there, the loss is disallowed and nothing is added to the IRA's basis, so it never comes back. The IRS set this out in Revenue Ruling 2008-5.
The law doesn't list what's substantially identical. The IRS looks at the facts of each case; these are the common ones.
Most accidental wash sales come from a purchase you didn't think of as one.
Sell at a loss at one broker and buy at another, and your 1099-Bs usually won't show it. Brokers only have to report a wash sale when both trades are in the same account and the same security.
A regular contribution that buys the same fund in your IRA inside the window turns a postponed loss into a lost one.
A quarterly dividend reinvested a week after you sell buys a few shares. Only those shares' share of the loss is disallowed, but it still needs an adjustment. Turn reinvestment off before you sell.
If your spouse buys the stock you just sold at a loss, it's a wash sale even if you file separately.
Buy 50 more shares, then sell the older 100 at a loss two weeks later, and the new 50 are inside the window. Half the loss is disallowed.
Selling shares at a loss and buying calls on the same company within the window is a wash sale. So is closing options at a loss and reopening the same contract.
The sale goes on the form with the loss shown, then an adjustment cancels the disallowed part. The first example looks like this.
| (a) Description | (b) Acquired | (c) Sold | (d) Proceeds | (e) Cost or basis | (f) Code | (g) Adjustment | (h) Gain or loss |
|---|---|---|---|---|---|---|---|
| 100 sh XYZ | 03/03/2026 | 12/15/2026 | 3,000 | 5,000 | W | 2,000 | 0 |
The disallowed loss goes in as a positive number, so (d) − (e) + (g) gives the loss you can actually take: here, zero.
When the sale and the purchase were in the same account, the broker shows the disallowed amount in box 1g. You copy it with code W.
When the buy was at another broker or by your spouse, the 1099-B usually shows the full loss, so the adjustment and the higher basis on the new shares are yours to add. After a buy in an IRA you still add the adjustment, but the IRA shares' basis stays as it was.
Your brokers each see their own account. AllInvestView puts them in one place, so a sale at one and a purchase at another meet.
AllInvestView matches every loss sale against purchases in all the accounts in your US tax report, at any broker, and moves the disallowed loss into the replacement shares' basis. Replacements bought in an IRA or Roth IRA are treated as lost for good. The Form 8949 rows carry code W and the adjustment, and the tax-loss harvesting planner shows the wash sale before you sell. A Smart Alert can watch your US stock losses and tell you when a purchase lands inside an open window.
See the wash sale tracker
AllInvestView
Other tax systems have their own version, with different windows and different results.
| Country | Window | Who counts | What happens to the loss |
|---|---|---|---|
| United States | 30 days before and after the sale | You, your spouse, a company you control, your IRA | Added to the new shares' basis; lost for good if bought in an IRA |
| Canada | 30 days before and after, still held on day 30 after | You and affiliated persons, including your spouse | A superficial loss, added to the adjusted cost base of the new shares |
| United Kingdom | 30 days after the sale only | You; a buy in an ISA or by a spouse isn't matched | The sale is matched with the new shares' cost, so a quick buy-back doesn't produce the loss. See the UK share CGT calculator |
| Australia | No fixed number of days | Judged on the purpose of the trades | The ATO can cancel a loss from a sale and buy-back done mainly for the tax benefit. See the Australian CGT calculator |
If you sell a stock or fund at a loss and buy the same one, or one that's substantially identical, within 30 days before or after the sale, you can't deduct the loss yet. Instead it moves into the cost basis of the replacement shares, and you get it back when you sell them. The rule is section 1091 of the US tax code.
Until day 31 after the sale. Sell at a loss on 15 December 2026 and the first day you can buy the same security back is 15 January 2027. You also can't have bought it in the 30 days before the sale, unless you sold those shares before the loss sale.
Not in a taxable account. The disallowed loss is added to the basis of the replacement shares, and their holding period includes the time you held the shares you sold, so the loss comes back when you sell them. It is lost for good when the replacement shares are bought in an IRA or Roth IRA.
Yes. The rule applies to you as a taxpayer, not to one account, so a purchase in your IRA, at a second broker or by your spouse counts. Brokers only have to report wash sales on the 1099-B when the sale and the purchase are in the same account, so the others are usually yours to find and adjust.
The IRS hasn't said. Both track the S&P 500 but come from different issuers, and many investors treat them as different securities. It's the swap most open to challenge, though. Switching to a fund on a different index, such as the total US market, is the safer choice.
Not under the current law. Section 1091 is written for stock and securities, while the IRS treats cryptocurrency as property, so selling bitcoin at a loss and buying it straight back isn't a wash sale. That differs for crypto held through a fund or ETF, which is a security.
No, only to losses. You can sell at a gain and buy the same shares back the same day. The gain is taxed in that year and the new shares start at the price you paid for them.
Connect your brokers or import your history, and your US tax report matches losses and purchases across all of them.
Checked on 29 October 2026.
The examples use made-up round numbers so the arithmetic is easy to follow. The calculator follows the matching in our US tax report: purchases in date order, share for share. It doesn't cover short sales, options on the loss side or a spouse's basis. None of this is tax advice.