Sixty-one days, centered on the sale
Section 1091 of the Internal Revenue Code disallows a loss on a sale of stock or securities if, within 30 days before or 30 days after the sale, you acquire substantially identical stock or securities, or enter into a contract or option to acquire them. Count the day of the sale itself and the window is 61 days long.
To acquire, for this purpose, means to buy, or to receive in an exchange on which the whole gain or loss is recognized. Shares that reach you as a gift or an inheritance are neither, so they do not start the rule running.
The 30 days before the sale catch people out more often than the 30 after. Buying a second lot first and selling the original lot at a loss a week later is a wash sale just as much as selling and buying back. So is a sale on 20 December followed by a purchase on 10 January: the window ignores the change of tax year, and the loss is disallowed in the year of the sale.
The rule applies to losses only. A sale at a gain followed by an immediate repurchase is taxed normally, which is why selling and buying back to raise your basis works, as the tax-gain harvesting guide describes. Dealers in securities acting in the ordinary course of their business are outside the rule; investors are not.
The loss moves into the new shares
In an ordinary taxable account a washed loss is not destroyed. Section 1091(d) sets the basis of the replacement shares at the basis of the shares you sold, adjusted by the difference between the two prices. The practical version, which is how IRS Publication 550 puts it, is to add the disallowed loss to the cost of the new shares.
Take 200 shares bought for $10,000 and sold for $7,000, a $3,000 loss. Two weeks later you buy 200 shares back for $7,200. The loss is disallowed, and the new shares have a basis of $10,200: the $7,200 you paid plus the $3,000 that was not allowed. Sell them later for $9,000, outside any new window, and a $1,200 loss is deductible then.
The holding period travels with it. Section 1223(3) adds the time you held the old shares to the new ones, so a loss washed out of a position held for eleven months can come back a few weeks later as a long-term loss. That changes which gains it offsets when it is finally used.
Buying back fewer shares than you sold
The disallowance follows the shares, not the whole sale. Sell 300 shares at a loss and buy back 100 within the window, and the loss is disallowed on the 100 matched shares while the loss on the other 200 is allowed. Section 1091(b) leaves it to the regulations to decide which of the sold shares count as matched when your lots have different costs.
Small automatic purchases count too. A dividend reinvested into the same fund within 30 days of a loss sale is an acquisition like any other, and it washes the loss on the number of shares it buys. The amount is usually small, but it is a typical way for a wash sale to happen without anyone deciding to make one.
Purchases made by someone else
The rule looks past the account that placed the trade. IRS Publication 550 treats a purchase by your spouse, or by a corporation you control, as your own: sell at a loss while your spouse buys the same stock inside the window and the loss is disallowed.
Retirement accounts are the case that costs most. In Rev. Rul. 2008-5 the IRS held that selling stock at a loss and having your IRA or Roth IRA buy substantially identical stock within 30 days disallows the loss, and that the IRA does not receive the basis increase that section 1091(d) would otherwise give. The loss is not postponed into anything. It is gone.
The ruling's own facts are a sale on 20 December and an IRA purchase the next day: the year-end pattern of harvesting a loss in a taxable account while putting the year's contribution to work in the IRA. If both accounts hold the same fund, that is the combination to avoid.
What "substantially identical" covers
Section 1091 does not define the phrase, and that is where the real uncertainty sits. Shares of the same company are the clear case. Contracts and options to buy them are named in the statute itself, so a call option bought on a stock you have just sold at a loss can wash the loss as surely as the shares would.
Two funds from different managers that track the same index are the question people actually ask, and the statute does not answer it directly. Many investors hold a fund that follows a different index for the 31 days instead. That is a judgment about risk, not a rule the IRS has published.
Does it apply to crypto?
Not as written. Section 1091 covers stock and securities, and the IRS treats digital assets such as bitcoin as property (IRS, Digital assets). As of this page's last update no law has extended the rule to them, though Congress has considered it more than once, so check the current position before relying on a crypto loss you bought straight back. A token that is itself a security is a separate question.
Selling a loser without tripping it
The rule is mechanical, so the ways to stay outside it are too. Sell and wait 31 days before buying back, and the loss counts, at the price of being out of the position for a month. Buy the replacement first and sell the original lot more than 30 days later, and it also counts, though you hold twice the position while you wait.
Or buy something that is similar without being substantially identical, such as another company in the same sector, and stay invested throughout. Two housekeeping steps prevent the accidental kind: switch off dividend reinvestment on the position for the window, and check what your spouse's accounts and your IRA are buying.
How it shows up on your forms
A broker that detects a wash sale reports the disallowed amount on Form 1099-B, in box 1g. On your return the sale still goes on Form 8949 in full: you enter code W in column (f) and the disallowed loss as a positive adjustment in column (g), which cuts the loss you claim to what is allowed (Instructions for Form 8949).
If the broker's figure is wrong, for instance because the matching purchase was made in another account, the same instructions tell you to enter the correct amount instead. The adjustment is yours to get right, whatever the form says.
What it costs in the year of the sale
In an ordinary account a wash sale is a timing problem. The deduction moves from this year to the year you sell the replacement shares, and the cost is the tax the loss would have saved now. The examples below price that for one taxpayer with a gain elsewhere in the year, first with the loss allowed and then with it washed.
The deferred loss is worth whatever it saves in the year it finally counts. If that year has less income, or the loss returns as long-term and meets only long-term gains, it saves less than it would have now; in a higher-income year it can save more.
A loss that is allowed and larger than your gains follows the usual limit: up to $3,000 against other income, and the rest carried forward, as the carryover guide explains.
This calculator does not detect wash sales. It works with the gains and losses you give it, so enter only a loss that is allowed. If you still hold replacement shares, their basis already includes the disallowed amount, and that is the figure to use when you eventually sell them.
Worked example
Computed by the calculator's own engine when this page was built. Open the derivation for every rule and citation.
The loss allowed
A single filer with $85,000 of wages has a $10,000 long-term gain on one fund and sells another position at a short-term loss of $8,000. They wait 31 days before buying it back.
- Taxable income after deduction
- $70,900
- Taxable gain
- $10,000
- Tax owed without the sale
- $9,870
- Tax the sale added
- $300
- Total federal tax
- $10,170
- Effective rate on the gain
- 3%
The short-term loss crosses over and cancels $8,000 of the long-term gain, leaving $2,000 to be taxed.
Caveats on this example (1)
- Net investment income was derived from capital gains and qualified dividends only. Interest, non-qualified dividends, rents, royalties and passive business income included in your other income are also net investment income under IRC 1411(c) and are not counted here.
Show the working — 13 steps, each with its citation
- Net short-term capital gain or loss for the year-$8,000
Assets held one year or less. Taxed at ordinary rates if a net gain.
- Net long-term capital gain or loss for the year$10,000
Assets held more than one year. Eligible for the 0/15/20% rates.
- Short-term loss applied against long-term gain-$8,000
A net loss of one character offsets a net gain of the other.
- Standard deduction-$16,100
Adjusted gross income of $87,000 less $16,100.
- Taxable income$70,900
The figure the rate tables and the capital gain ceilings are both measured against.
- Ordinary income taxed at 10%$1,240
$12,400 of taxable income between $0 and $12,400.
- Ordinary income taxed at 12%$4,560
$38,000 of taxable income between $12,400 and $50,400.
- Ordinary income taxed at 22%$4,070
$18,500 of taxable income between $50,400 and $68,900.
- Ordinary income stacked below the long-term gain$68,900
Long-term gain is taxed by reference to where it sits ON TOP of $68,900 of other taxable income, not from the bottom of the rate table.
- Long-term gain taxed at 15%$300
Gain between the $49,450 zero-rate ceiling and the $545,500 15% ceiling.
- Net investment income tax threshold$200,000
Modified AGI of $87,000 against the $200,000 threshold for a single filer. This threshold is statutory and is not adjusted for inflation.
- Net investment income tax does not apply$0
Modified AGI is $113,000 below the threshold.
- Total tax$10,170
$10,170 on $87,000 of total income, an effective rate of 11.69%.
The same loss, washed
The same person buys the position back ten days after selling it, inside the window, so the loss is disallowed and the whole gain is taxed.
- Taxable income after deduction
- $78,900
- Taxable gain
- $10,000
- Tax owed without the sale
- $9,870
- Tax the sale added
- $1,500
- Total federal tax
- $11,370
- Effective rate on the gain
- 15%
Washing the loss costs $1,200 this year. In a taxable account the $8,000 is not gone: it sits in the basis of the replacement shares and returns when they are sold. Bought back in an IRA, it would be gone for good.
Caveats on this example (1)
- Net investment income was derived from capital gains and qualified dividends only. Interest, non-qualified dividends, rents, royalties and passive business income included in your other income are also net investment income under IRC 1411(c) and are not counted here.
Show the working — 12 steps, each with its citation
- Net short-term capital gain or loss for the year$0
Assets held one year or less. Taxed at ordinary rates if a net gain.
- Net long-term capital gain or loss for the year$10,000
Assets held more than one year. Eligible for the 0/15/20% rates.
- Standard deduction-$16,100
Adjusted gross income of $95,000 less $16,100.
- Taxable income$78,900
The figure the rate tables and the capital gain ceilings are both measured against.
- Ordinary income taxed at 10%$1,240
$12,400 of taxable income between $0 and $12,400.
- Ordinary income taxed at 12%$4,560
$38,000 of taxable income between $12,400 and $50,400.
- Ordinary income taxed at 22%$4,070
$18,500 of taxable income between $50,400 and $68,900.
- Ordinary income stacked below the long-term gain$68,900
Long-term gain is taxed by reference to where it sits ON TOP of $68,900 of other taxable income, not from the bottom of the rate table.
- Long-term gain taxed at 15%$1,500
Gain between the $49,450 zero-rate ceiling and the $545,500 15% ceiling.
- Net investment income tax threshold$200,000
Modified AGI of $95,000 against the $200,000 threshold for a single filer. This threshold is statutory and is not adjusted for inflation.
- Net investment income tax does not apply$0
Modified AGI is $105,000 below the threshold.
- Total tax$11,370
$11,370 on $95,000 of total income, an effective rate of 11.97%.
Run your own figures
Nothing you enter leaves your browser.