CalculatorVillageCalculatorVillage

Wash Sale Rule Calculation: Adjusted Basis, Partial Replacement and Holding Period, Lot by Lot

Section 1091 and IRS Publication 550 worked through five sets of lots: a full buyback, fewer and more shares bought than sold, a dividend reinvestment, and an IRA purchase.

A wash sale does not erase a loss; it moves it. Under 26 U.S.C. 1091, a loss on stock is disallowed if you buy substantially identical shares within 30 days before or after the sale, and the disallowed amount is added to the basis of the replacement shares. Buy back fewer shares than you sold and only the matched share count loses its deduction. The old shares' holding period also carries over to the new ones.

The rule table, with dates

Each row below is a rule that changes a number in a wash sale calculation, the official text it comes from, and when that text was issued or last changed. Publication 550 is the IRS's plain-language reading of the statute and regulation; where it adds detail the statute leaves to regulations, the table says so.

Tax education built from the Internal Revenue Code, Treasury regulations and IRS Publication 550 (2025), not advice on your own return. Every lot below is invented to show the arithmetic, with its inputs stated. Rules checked October 30, 2026.

RuleWhat it does to the numbersOfficial sourceDate of the text
61-day windowA loss is disallowed if replacement shares are acquired in the period from 30 days before the sale to 30 days after it. The regulation calls this the 61-day period.26 U.S.C. 1091(a); Treas. Reg. 1.1091-1(a)Section enacted Aug. 16, 1954; amended 1976, 1984, 1988, 2000, 2002. Regulation T.D. 6500 (Nov. 26, 1960), amended T.D. 6926 (Aug. 9, 1967)
What counts as acquiringA purchase, a fully taxable exchange, or a contract or option to buy. Options and contracts count as "stock or securities" for this section.1091(a); Reg. 1.1091-1(f)As above
Who buysYou, your spouse, or a corporation you control. A purchase inside your traditional or Roth IRA also counts.Pub 550 (2025), Wash Sales; Rev. Rul. 2008-5Pub 550 for 2025 returns; ruling published in Internal Revenue Bulletin 2008-3, Jan. 22, 2008
Basis of replacement sharesBasis of the shares sold, increased or decreased by the difference between the replacement's purchase price and the sale price. Pub 550 states the same result as cost of new shares plus disallowed loss.1091(d); Pub 5501954 text
No basis step-up in an IRAWhen the IRA is the buyer, the loss is disallowed and the IRA basis is not increased.Rev. Rul. 2008-5Jan. 22, 2008
Fewer shares bought than soldPurchases are matched, earliest first, against an equal number of shares sold. Only matched shares lose their loss.1091(b); Reg. 1.1091-1(c)1954 / 1960
More shares bought than soldSold shares are matched against the earliest replacement purchases; later purchases keep their own cost and dates.1091(c); Reg. 1.1091-1(d)1954 / 1960
Several losses, one purchaseLosses are tested in order of sale, earliest first. A purchase used to disallow one loss is ignored when testing any other loss.Reg. 1.1091-1(b), (e)1960
Holding periodThe replacement shares' holding period includes the time you held the shares sold.26 U.S.C. 1223(3); Pub 550, Holding PeriodPub 550 for 2025 returns
Same-day blocksA wash sale loss on one block cannot reduce gains on identical blocks sold the same day.Pub 5502025 edition
Broker reportingForm 1099-B box 1g shows the disallowed loss only for covered securities bought back with the same CUSIP in the same account. The loss is still disallowed when the form is silent.Pub 550, Nondeductible wash sale loss2025 edition
How to reportForm 8949, Part I or II: code W in column (f), the disallowed amount as a positive number in column (g).Pub 550, How to report2025 edition
DealersThe rule does not apply to a dealer's losses in the ordinary course of business.1091(a)1984 amendment

Two notes on currency. The statute text above was read from the 2024 edition of the United States Code on govinfo.gov; the section's last amendment listed there is from 2002. Publication 550 (2025) is the edition the IRS marks "for use in preparing 2025 Returns," and its What's New section lists no change to wash sales.

One loss, two formulas, same basis

People get stuck on the basis step because the statute and the IRS publication describe it differently. They are the same arithmetic.

Section 1091(d) starts from the old shares: the basis of the replacement is the basis of the shares sold, "increased or decreased" by the difference between what you paid for the replacement and what you sold the old shares for. Publication 550 starts from the new shares: add the disallowed loss to what the new shares cost.

Write it out per share and the two meet. Call the old cost C, the sale price S and the repurchase price P. The disallowed loss is C minus S. Publication 550 gives P plus (C minus S). The statute gives C plus (P minus S). Both equal C plus P minus S.

The regulation's own Example 2, which Publication 550 repeats with 2024 and 2025 dates, uses these figures: 100 shares bought for $5,000 and sold for $4,000, with 50 replacement shares bought for $2,750 and 25 more for $1,125. Here is that example run both ways.

Replacement lotStatute: basis of shares sold, plus price paid minus price receivedPub 550: cost plus disallowed lossAdjusted basis
50 shares for $2,750$2,500 + ($2,750 - $2,000) = $3,250$2,750 + $500 = $3,250$3,250
25 shares for $1,125$1,250 + ($1,125 - $1,000) = $1,375$1,125 + $250 = $1,375$1,375

The publication's form is easier to run on a statement. The statute's form is easier to check, because it shows that the "decreased" case is real: when you buy back cheaper than you sold, the adjustment shrinks, as the next section shows.

Lot 1: a full buyback and the holding period that travels with it

Inputs (hypothetical): 100 shares bought April 14, 2025 for $50 each, $5,000 total. Sold February 10, 2026 for $38, or $3,800. Bought back 100 shares on February 24, 2026 for $40, or $4,000.

  • Loss on the February sale: $5,000 minus $3,800 = $1,200.
  • The repurchase came 14 days after the sale, inside the window, and covers all 100 shares, so the whole $1,200 is disallowed.
  • Basis of the new shares: $4,000 + $1,200 = $5,200, or $52 a share. The statute's way: $5,000 + ($4,000 - $3,800) = $5,200.

Now the holding period. Publication 550 says to start counting on the day after you acquire property, and to count the day you sell it. The original shares were held from April 15, 2025 through February 10, 2026: 302 days. Under section 1223(3), those 302 days are added to the new shares' own holding period. The 14 days between the sale and the repurchase belong to no shares, so they are not counted.

If the new shares are sold onDays held as new sharesPlus days carried overTotalGain or loss character
April 1, 202636302338Short-term (not more than 1 year)
July 15, 2026141302443Long-term (more than 1 year)

Suppose the July 15 sale is at $47 a share, $4,700 in total. Against the $5,200 adjusted basis, that is a $500 long-term loss.

Compare what the same trades would have produced without the rule. The February sale would have given a $1,200 short-term loss. The July sale, from a $4,000 basis held only 141 days, would have given a $700 short-term gain. The net is a $500 loss either way. What the wash sale changed was the timing (none of the loss in February) and the character (the $500 lands as long-term rather than as a short-term loss and a short-term gain). For someone with short-term gains elsewhere, character can matter as much as the dollar amount. The federal income tax brackets for 2026 show how far apart ordinary rates, which apply to short-term gains, sit from each other.

Near the one-year line, the day count is where errors happen. Publication 550's own example treats a sale two days short of the anniversary as short-term and one a week after as long-term. If your combined total lands within a few days of a year, check the acquisition and sale dates on your broker's records rather than a rounded month count.

Lot 2: when fewer shares come back than went out

This is the partial replacement case, and the one that most often gets calculated wrong, usually by disallowing the whole loss.

Inputs (hypothetical): 200 shares bought June 2, 2025 at $30, $6,000 total. All 200 sold January 15, 2026 at $22, $4,400 total. Two repurchases follow: 50 shares on February 2, 2026 at $23 ($1,150) and 30 shares on February 9, 2026 at $21.50 ($645). Both dates fall within 30 days after the sale (18 and 25 days).

The loss is $1,600, or $8 on each of the 200 shares. Only 80 replacement shares were bought, so under section 1091(b) and Regulation 1.1091-1(c), 80 of the shares sold are matched with them, in order of purchase. The loss on those 80 shares is disallowed. The loss on the other 120 stays deductible.

ItemSharesPer shareAmount
Total loss on the sale200$8.00$1,600
Matched to Feb. 2 purchase (disallowed)50$8.00$400
Matched to Feb. 9 purchase (disallowed)30$8.00$240
Unmatched, still deductible120$8.00$960

Each replacement lot then absorbs only the loss matched to it:

Replacement lotCostDisallowed loss addedAdjusted basisPer shareStatute check
50 shares, Feb. 2$1,150$400$1,550$31.00$1,500 + ($1,150 - $1,100) = $1,550
30 shares, Feb. 9$645$240$885$29.50$900 + ($645 - $660) = $885

The second statute check is the "decreased" case in action. Those 30 shares were bought for $21.50, less than the $22 sale price, so the difference term is negative ($15) and the adjusted basis comes out below the old $30 cost. Through either formula, the result is $885.

The $960 deductible loss is short-term, because the original shares were held 227 days. Each replacement lot also inherits those 227 days for its own holding period, while the 120 unmatched shares simply leave your books.

A quick sanity test for any partial replacement: the disallowed fraction of the loss equals replacement shares divided by shares sold. Here, 80 divided by 200 is 40%, and 40% of $1,600 is $640.

Lot 3: buying back more than you sold

Inputs (hypothetical): 100 shares bought November 12, 2024 at $45 ($4,500). Sold March 2, 2026 at $36 ($3,600), a $900 loss, $9 a share. Over the next days, three purchases of 40 shares each: March 9 at $35 ($1,400), March 10 at $34 ($1,360) and March 11 at $35.50 ($1,420).

With 120 shares bought against 100 sold, section 1091(c) and Regulation 1.1091-1(d) take the replacement shares in purchase order until the 100 sold shares are covered. That uses both March 9 and March 10 lots, then only 20 of the 40 shares bought March 11. The broker, and your records, must split the third lot.

LotSharesCostLoss addedAdjusted basisPer shareDays carried over
Mar. 940$1,400$360$1,760$44.00475
Mar. 1040$1,360$360$1,720$43.00475
Mar. 11, matched part20$710$180$890$44.50475
Mar. 11, unmatched part20$710$0$710$35.500 (own period from Mar. 12, 2026)
Total120$4,180$900$5,080

The total checks out: $4,180 of cash cost plus the $900 disallowed loss is $5,080.

The holding period column is where this example earns its place. The original shares were held 475 days, so the $900 was a long-term loss. Because the 100 matched replacement shares carry those 475 days, they are long-term on the day you buy them. Sell them at a loss next month and the loss is long-term, not short-term. The 20 unmatched shares are a separate, short-term position that started March 12, 2026, and their sale has to be tracked separately.

Publication 550's version of this case has four purchases of 50 shares each after a 100-share sale. The disallowed loss goes half to the first day's 50 shares and half to the second day's; the third and fourth days' purchases keep their own basis.

Lot 4: the reinvestment you did not place

A dividend reinvestment plan buys shares for you on each payment date. Publication 550 describes a plan as one that lets you use your dividends to buy more shares instead of taking cash. Nothing in section 1091 exempts a purchase because it was automatic, and Publication 550 does not address the overlap directly. The rule that follows is the statute applied to its own words: a reinvestment within the window is an acquisition by purchase, matched like any other. Separately, Publication 550 says a reinvested dividend is still dividend income, whatever the wash sale outcome. The DRIP calculator projects how those reinvested lots pile up over years.

Inputs (hypothetical):

  • Lot A: 300 shares bought January 10, 2025 at $60 ($18,000).
  • Lot B: 200 shares bought August 15, 2023 at $40 ($8,000).
  • All 500 shares are enrolled in the reinvestment plan.
  • On May 1, 2026 a $0.75 dividend is paid on 500 shares, $375, and reinvested at $50: 7.5 shares.
  • On May 20, 2026 you sell Lot A only, identified by lot, at $48: $14,400.

The Lot A loss is $18,000 minus $14,400 = $3,600, or $12 a share. The May 1 reinvestment came 19 days before the sale, so those 7.5 shares are replacement shares. The matching rule speaks of "an equal number of shares"; neither the statute nor Publication 550 mentions fractional shares, so this example applies the matching proportionally, 7.5 shares against 7.5 of the 300 sold.

ItemAmount
Loss on Lot A$3,600 ($12 x 300)
Disallowed: 7.5 shares x $12$90
Deductible long-term loss (Lot A held 495 days)$3,510
Basis of the 7.5 reinvested shares$375 + $90 = $465 ($62.00 a share)
Statute check$450 + ($375 - $360) = $465

The next dividend, paid August 3, 2026, lands 75 days after the sale, outside the window, so it disallows nothing. Had you sold Lot A on April 15 instead, the May 1 reinvestment on your remaining 200 shares (3 shares at $50) would have come 16 days after the sale and been caught the same way. The window runs in both directions.

Two details make reinvestment cases tidier than they first look. First, Regulation 1.1091-1(e): once those 7.5 shares have been used to disallow part of the Lot A loss, they are ignored in testing any other loss. If you also sold a different losing lot of the same stock on May 22, the May 1 reinvestment could not be counted against it a second time. Second, the reinvestment was small, so the damage is $90 out of $3,600. The arithmetic only turns painful when reinvested shares are large relative to the lot sold, as in a big fund position paying a year-end distribution.

When a sale crosses a reinvestment date, the broker usually catches it, because the reinvested shares sit in the same account under the same CUSIP; Publication 550 lists those as the conditions for box 1g reporting. A plan run directly by a company's transfer agent is a different account, and the broker selling your other shares will not see it.

A repurchase inside an IRA

Revenue Ruling 2008-5 answered a specific question: what if you sell at a loss in a taxable account and have your IRA or Roth IRA buy the same stock? Its facts were plain. An individual owned 100 shares with a $1,000 basis, sold them on December 20, 2007 for $600, and the next day had an IRA buy 100 shares at market value. The ruling held that the $400 loss is disallowed under section 1091, and that the individual's basis in the IRA is not increased under section 1091(d).

That second holding is what makes the IRA case different from every lot above. Elsewhere, a wash sale defers the loss into the replacement basis, and the loss returns when the replacement is sold. When the IRA buys, the loss is disallowed and no basis anywhere absorbs it. Publication 550 reflects the same outcome: it lists an IRA or Roth IRA purchase among the acquisitions that trigger a wash sale, then tells you to add the disallowed loss to the new shares' cost "except" in that case.

Run hypothetical numbers side by side. You sell 100 shares that cost $8,000 for $6,500, a $1,500 loss, and six days later 100 shares are bought for $6,600.

Where the 100 shares are boughtLoss deducted this yearBasis of the new sharesDoes the $1,500 come back later?
Same taxable account$0$6,600 + $1,500 = $8,100Yes, through the higher basis
Your traditional or Roth IRA$0IRA basis not increasedNo
Nowhere for 31 days or more$1,500Not applicableAlready deducted

Partial matching works the same way as Lot 2. If the IRA bought 40 shares instead of 100, the loss on 40 of the shares sold, $600, would be disallowed, and $900 would stay deductible. The $600 would be lost rather than deferred.

The 1099-B will not flag this. Publication 550 limits box 1g reporting to repurchases in the same account, so a taxable sale and an IRA purchase never meet on one form. The ruling is also explicit about what it leaves out: it addresses only the issues it names, and says no inference should be drawn about any issue under section 4975, the prohibited-transaction rules.

Spouses, and losses that line up against one purchase

Publication 550 adds that if you sell and your spouse or a corporation you control buys substantially identical stock, you also have a wash sale. Neither spouse's broker will report it, for the same account reason as the IRA. When both spouses trade the same names, the 61-day window has to be checked across both sets of statements.

When several loss sales sit near one purchase, Regulation 1.1091-1(b) and (e) decide which loss is hit. Hypothetical: you sell lot X, 100 shares of a stock, on September 1, 2026 at a $700 loss, and lot Y, another 100 shares, on September 10 at a $400 loss. On September 15 you buy 100 shares for $2,000, enough to cover either sale.

  • Losses are tested in order of sale, so lot X, sold first, is tested first. The September 15 purchase is within 30 days, so the $700 loss on lot X is disallowed and the new shares' basis is $2,000 + $700 = $2,700.
  • Under paragraph (e), that purchase is now disregarded in testing lot Y. Unless another purchase falls in lot Y's window, its $400 loss is deductible.

If the September 15 purchase had been 150 shares rather than 100, the first 100 would be used against lot X and the remaining 50 would be available against lot Y, disallowing the loss on 50 of its shares under the partial rule.

A related rule covers trades on one day. Publication 550's example has three blocks of 100 shares bought at $158, $100 and $95, all sold on one December day at $125, with 250 identical shares bought back two weeks later. The $33 per share loss on the $158 block is disallowed, and it cannot be used to shrink the gains on the other two blocks sold that same day. Selling a whole position at once does not average the lots into one net figure for wash sale purposes.

Rolling the loss forward more than once

Nothing stops a deferred loss from being deferred again. Take Lot 1's replacement shares, basis $5,200. Suppose you sell them in April at $4,000, a $1,200 loss, and buy back again ten days later at $4,100. That $1,200 loss is itself disallowed and moves into the newest shares, giving them a basis of $4,100 + $1,200 = $5,300. Their holding period now includes the days held as the first shares, as the second shares, and their own.

The total loss is never lost in a chain like this, as long as each buyer is a taxable account of yours. It is postponed until a sale with no replacement purchase in the window, often the following year. Someone trading the same stock every few weeks can carry a large disallowed amount into December without noticing, which is why the 1099-B box 1g total sometimes surprises people.

What "substantially identical" does and does not settle

The arithmetic above assumes the replacement is the same stock. Publication 550 says the question of whether two securities are substantially identical depends on all the facts and circumstances. Ordinarily, one corporation's stock is not substantially identical to another's, though a reorganization can make predecessor and successor stock identical. A company's bonds or preferred stock are ordinarily not identical to its common stock, but convertible preferred can be: Publication 550 lists convertibility, matching voting rights, the same dividend restrictions, prices that track the conversion ratio, and unrestricted conversion as the factors.

It also notes that selling common stock at a loss while buying warrants on the same company's common triggers the rule, and that the reverse depends on whether the warrants and stock are substantially identical. Options and contracts to buy are covered by the statute. Commodity futures and foreign currency are outside it, per Publication 550.

For mutual funds and exchange-traded funds that track the same index, neither the statute nor Publication 550 draws a line, and this page does not draw one for you.

A worksheet for any set of lots

The steps below reproduce every example on this page. They work on a spreadsheet as well as on paper.

  1. List the loss sale: date, shares, cost, proceeds, loss per share and days held.
  2. Mark the window: 30 days before through 30 days after the sale date.
  3. List every acquisition in the window, in date order, across all your accounts, your spouse's, your IRAs and any reinvestment plan. Remove any shares already used to disallow an earlier loss (Reg. 1.1091-1(e)).
  4. Match: take acquisitions in date order until they equal the shares sold or run out. Split the last lot if needed.
  5. Split the loss: matched shares times loss per share is disallowed; the rest is deductible.
  6. Adjust basis: add each matched lot's share of the disallowed loss to its cost. For IRA purchases, add nothing and record the amount as permanently disallowed.
  7. Tack the holding period: add the days the old shares were held to each matched replacement lot.
  8. Check: total adjusted basis of the matched lots should equal their cash cost plus the disallowed loss. For an IRA buyer, it equals cash cost alone.
  9. Report: on Form 8949, code W in column (f) and the disallowed amount, as a positive number, in column (g), whether or not box 1g of your 1099-B shows it.

The stock profit calculator gives gain or loss per lot quickly for step 1, and the investment calculators index lists the other position tools on this site.

How Canada's superficial loss rule differs

Canada's equivalent, the superficial loss, uses the same 30 days before and 30 days after, but adds a condition the US rule lacks. The Canada Revenue Agency says a loss is superficial only if you, or a person affiliated with you, buy identical property in the window and still own it, or have a right to buy it, 30 days after the sale. Under section 1091 there is no ownership test at the end: buy and resell inside the window and the purchase can still disallow the loss. The CRA also lets the denied loss be added to the cost of the substituted property only if you are the one who acquired it. The capital gains tax guide for Canada works a superficial loss through the adjusted cost base.

Running your own lots

If you are deciding whether a loss sale is worth making at all, the tax-loss harvesting calculator estimates what the deduction is worth at your bracket. Take its answer back to step 3 of the worksheet before you place any purchase, because a single reinvestment, a spouse's order or an IRA contribution inside the 61 days can change the figure it gives you.

Sources

Statute, regulation, ruling and publication text came straight from govinfo.gov, irs.gov and canada.ca, read October 30, 2026. The lot figures are this desk's own hypotheticals, recalculated that day.

Frequently Asked Questions

How do you calculate adjusted basis after a wash sale?
Add the disallowed loss to what the replacement shares cost. If 100 shares cost $5,000, sell for $3,800 and are bought back for $4,000, the $1,200 loss is disallowed and the new shares have a basis of $5,200. Section 1091(d) states the same result from the other side: the old basis of $5,000, plus the $200 by which the repurchase price exceeded the sale price.
What happens if I buy back fewer shares than I sold?
Only part of the loss is disallowed. Replacement shares are matched, earliest purchase first, with an equal number of the shares sold, and the loss on the matched shares is disallowed. Sell 200 shares at an $8 loss each and buy back 80, and $640 is disallowed while $960 stays deductible. The $640 is added to the basis of the 80 new shares.
Does a dividend reinvestment trigger a wash sale?
It can. A reinvestment is a purchase of shares, and section 1091 has no exception for automatic purchases. If dividends are reinvested within 30 days before or after you sell other shares of the same stock at a loss, the reinvested shares are matched against the shares sold and that portion of the loss is disallowed and added to their basis. The reinvested dividend is still taxable dividend income either way.
Does buying the same stock in my IRA trigger the wash sale rule?
Yes. Revenue Ruling 2008-5 holds that a loss is disallowed when you sell at a loss and cause your traditional or Roth IRA to buy substantially identical stock within the window, and that your basis in the IRA is not increased. Unlike a repurchase in a taxable account, the loss is not deferred into a higher basis, so it does not come back later.
Does the holding period carry over in a wash sale?
Yes. Under 26 U.S.C. 1223(3), the replacement shares include the time you held the shares you sold. Shares held 302 days, sold at a loss and bought back two weeks later become long-term once the new shares have been held long enough to push the combined total past one year. The days between the sale and the repurchase do not count.
How long do I have to wait to buy back a stock after selling it at a loss?
The window covers 30 days after the sale and 30 days before it, so a repurchase on the 31st day after the sale falls outside it. Purchases in the 30 days before the sale count too, including reinvested dividends and purchases by your spouse, a corporation you control, or your IRA.
Will my 1099-B always show a wash sale?
No. Box 1g shows a disallowed loss only for covered securities bought back with the same CUSIP in the same account. A repurchase in another account, your spouse's account or an IRA will not appear there, but IRS Publication 550 says the loss is still not deductible. Report it on Form 8949 with code W and the disallowed amount in column (g).
Important: Educational Purposes OnlyThe calculators, estimates, and financial formulas provided on CalculatorVillage.com are for informational and educational purposes only. They are not intended as certified financial planning, tax, legal, or investment advice. Actual rates, terms, and returns will vary. Always consult with a qualified professional before making significant financial decisions.