Answer · IRC § 1091

What is the wash sale rule?

Sell at a loss and buy substantially identical stock within 30 days either side, and the loss is disallowed. What the rule reaches, and what it costs you.

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
  1. Net short-term capital gain or loss for the year-$8,000Short-term / long-term nettingIRC 1222; IRS Pub. 550

    Assets held one year or less. Taxed at ordinary rates if a net gain.

  2. Net long-term capital gain or loss for the year$10,000Short-term / long-term nettingIRC 1222; IRS Pub. 550

    Assets held more than one year. Eligible for the 0/15/20% rates.

  3. Short-term loss applied against long-term gain-$8,000Short-term / long-term nettingIRC 1222; IRS Pub. 550

    A net loss of one character offsets a net gain of the other.

  4. Standard deduction-$16,100Deduction from adjusted gross incomeRev. Proc. 2025-32 4.14(1) (IRC 63(c)(2))

    Adjusted gross income of $87,000 less $16,100.

  5. Taxable income$70,900Taxable incomeIRC 63(a)

    The figure the rate tables and the capital gain ceilings are both measured against.

  6. Ordinary income taxed at 10%$1,240Ordinary income tax bracketsRev. Proc. 2025-32 4.01 (IRC 1(j)(2))

    $12,400 of taxable income between $0 and $12,400.

  7. Ordinary income taxed at 12%$4,560Ordinary income tax bracketsRev. Proc. 2025-32 4.01 (IRC 1(j)(2))

    $38,000 of taxable income between $12,400 and $50,400.

  8. Ordinary income taxed at 22%$4,070Ordinary income tax bracketsRev. Proc. 2025-32 4.01 (IRC 1(j)(2))

    $18,500 of taxable income between $50,400 and $68,900.

  9. Ordinary income stacked below the long-term gain$68,900LTCG bracket stackingIRC 1(h); Schedule D Tax Worksheet, Form 1040 instructions

    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.

  10. Long-term gain taxed at 15%$300LTCG bracket stackingRev. Proc. 2025-32 4.03 (IRC 1(h), 1(j)(5))

    Gain between the $49,450 zero-rate ceiling and the $545,500 15% ceiling.

  11. Net investment income tax threshold$200,000IRC 1411 thresholdIRC 1411(a)-(b); 26 C.F.R. 1.1411-2

    Modified AGI of $87,000 against the $200,000 threshold for a single filer. This threshold is statutory and is not adjusted for inflation.

  12. Net investment income tax does not apply$0IRC 1411 thresholdIRC 1411(a)-(b); 26 C.F.R. 1.1411-2

    Modified AGI is $113,000 below the threshold.

  13. Total tax$10,170Sum of all tax stepsRev. Proc. 2025-32 (I.R.B. 2025-45)

    $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
  1. Net short-term capital gain or loss for the year$0Short-term / long-term nettingIRC 1222; IRS Pub. 550

    Assets held one year or less. Taxed at ordinary rates if a net gain.

  2. Net long-term capital gain or loss for the year$10,000Short-term / long-term nettingIRC 1222; IRS Pub. 550

    Assets held more than one year. Eligible for the 0/15/20% rates.

  3. Standard deduction-$16,100Deduction from adjusted gross incomeRev. Proc. 2025-32 4.14(1) (IRC 63(c)(2))

    Adjusted gross income of $95,000 less $16,100.

  4. Taxable income$78,900Taxable incomeIRC 63(a)

    The figure the rate tables and the capital gain ceilings are both measured against.

  5. Ordinary income taxed at 10%$1,240Ordinary income tax bracketsRev. Proc. 2025-32 4.01 (IRC 1(j)(2))

    $12,400 of taxable income between $0 and $12,400.

  6. Ordinary income taxed at 12%$4,560Ordinary income tax bracketsRev. Proc. 2025-32 4.01 (IRC 1(j)(2))

    $38,000 of taxable income between $12,400 and $50,400.

  7. Ordinary income taxed at 22%$4,070Ordinary income tax bracketsRev. Proc. 2025-32 4.01 (IRC 1(j)(2))

    $18,500 of taxable income between $50,400 and $68,900.

  8. Ordinary income stacked below the long-term gain$68,900LTCG bracket stackingIRC 1(h); Schedule D Tax Worksheet, Form 1040 instructions

    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.

  9. Long-term gain taxed at 15%$1,500LTCG bracket stackingRev. Proc. 2025-32 4.03 (IRC 1(h), 1(j)(5))

    Gain between the $49,450 zero-rate ceiling and the $545,500 15% ceiling.

  10. Net investment income tax threshold$200,000IRC 1411 thresholdIRC 1411(a)-(b); 26 C.F.R. 1.1411-2

    Modified AGI of $95,000 against the $200,000 threshold for a single filer. This threshold is statutory and is not adjusted for inflation.

  11. Net investment income tax does not apply$0IRC 1411 thresholdIRC 1411(a)-(b); 26 C.F.R. 1.1411-2

    Modified AGI is $105,000 below the threshold.

  12. Total tax$11,370Sum of all tax stepsRev. Proc. 2025-32 (I.R.B. 2025-45)

    $11,370 on $95,000 of total income, an effective rate of 11.97%.

Run your own figures

Nothing you enter leaves your browser.

Showing an example. Change any figure.

Your sale
Not sure? Work it out from the dates

What counts as cost basis?

What you paid, plus commissions and fees. Your gain is the sale proceeds less this. For an inherited asset it is usually the market value at the date of death, not what the person who left it to you paid.

About you
Why are some states unavailable?

States we can't yet compute for 2026 stay in the list, disabled, so a missing state is never mistaken for one with no tax. How states are checked.

Itemizing your deductions?
Standard or itemized?

The standard deduction is a fixed amount everyone can subtract — $16,100 single for 2026. Itemizing means totting up specific costs instead: mortgage interest, state taxes, charitable gifts. Take whichever is larger; most people take the standard.

Related questions

Can I offset capital gains with capital losses?

Yes, and the netting order is fixed: short-term losses against short-term gains and long-term against long-term first, then any remaining loss of one character offsets the other. If losses still exceed gains, up to $3,000 a year offsets ordinary income for individuals, and anything beyond that carries forward indefinitely. The carryforward does not expire.

How to avoid capital gains tax

The gain itself is rarely avoidable, but its rate very often is, because the rate is set by facts you control. Holding past one year moves the gain onto the 0/15/20% ladder. Realizing in a low-income year can drop it into the 0% band outright. Splitting a disposal across two tax years keeps each half lower in the stack. Harvesting losses offsets gains dollar for dollar. Watching the net investment income tax threshold can save 3.8% on the whole amount. Each of these is a timing or accounting choice the statute expressly contemplates — none of it is evasion, which is concealing a gain you actually realized.

The guide index lists every answer page; the state comparison adds the state layer.