Wash Sale Calculator: How to Compute Adjusted Cost Basis & Avoid Disallowed Losses
A wash sale calculator tells you whether a loss is deductible or deferred and computes the adjusted cost basis of any replacement position. For active options traders, the real value is not the rule itself—it is quickly running the numbers across assignments, rolls, and spread adjustments before tax season arrives.
This article gives you a reusable calculation framework you can drop into a spreadsheet. It covers stocks, single-leg options, put assignments, and vertical spreads, with worked examples and the exact formulas your CPA needs.
What a Wash Sale Calculator Actually Computes
The calculator answers three questions:
- Did a loss sale occur? You must realize a loss on a sale or closing transaction.
- Was a substantially identical position acquired within the 61-day window? That window is 30 days before the loss sale, the loss sale date, and 30 days after.
- What is the adjusted cost basis of the replacement position? The disallowed loss is added to the replacement's basis and deferred until that position is finally sold.
If the answer to question 2 is no, the loss is deductible now. If yes, the loss is disallowed now and added to basis.
The Core Wash Sale Formula
Adjusted Basis = Replacement Cost + Disallowed Loss
Deferred Loss = Original Loss Amount (now part of replacement basis)
Window Days = Date of Loss Sale ± 30 days (61-day total window)
Substantially identical test for options:
| Factor | Same = Higher Wash Sale Risk | Different = Lower Risk |
|---|---|---|
| Underlying | Same ticker | Different ticker |
| Strike | Same strike | Different strike |
| Expiration | Same expiration | Different expiration |
| Option Type | Same call/put | Different type |
| Moneyness | Deep ITM closer to stock | OTM or ATM |
The closer the replacement is across all five factors, the more likely the IRS treats it as substantially identical.
Stock Wash Sale Calculator: Worked Example
Scenario:
- 1/15/2026: Buy 100 SPY @ $420 (cost: $42,000)
- 2/20/2026: Sell 100 SPY @ $400 (loss: -$2,000)
- 2/21/2026: Buy 100 SPY @ $395 (cost: $39,500)
Step 1: Confirm the loss sale.
Sold at $400 with a cost basis of $420. Realized loss = ($420 - $400) × 100 = $2,000 loss.
Step 2: Check the 61-day window.
| Date | Action | Days From Loss Sale | Inside Window? |
|---|---|---|---|
| 1/21/2026 | Earliest date in window | -30 | Yes |
| 2/20/2026 | Sell 100 SPY @ $400 (loss) | 0 | Loss sale |
| 3/22/2026 | Last date in window | +30 | Yes |
The repurchase on 2/21/2026 is inside the window.
Step 3: Apply substantially identical test.
Same ticker, same shares. Wash sale triggered.
Step 4: Compute adjusted basis.
Adjusted Basis = $39,500 (replacement cost) + $2,000 (disallowed loss)
Adjusted Basis = $41,500
Your new cost basis is $41.50 per share. The $2,000 loss is deferred until those shares are sold.
Options Wash Sale Calculator: Single-Leg Example
Scenario:
- 1/10/2026: Buy 1 AAPL $200 call expiring 3/20/2026 for $5.00 (cost: $500)
- 1/25/2026: Sell the call for $2.00 (loss: -$300)
- 1/27/2026: Buy 1 AAPL $200 call expiring 3/20/2026 for $2.20 (cost: $220)
Step 1: Confirm the loss sale.
$2.00 sale price minus $5.00 cost = -$3.00 per share × 100 = $300 loss.
Step 2: Check the window.
The repurchase on 1/27/2026 is within 30 days after the loss sale on 1/25/2026.
Step 3: Apply substantially identical test.
Same underlying (AAPL), same strike ($200), same expiration (3/20/2026), same type (call). Wash sale triggered.
Step 4: Compute adjusted basis.
Adjusted Basis = $220 (replacement cost) + $300 (disallowed loss)
Adjusted Basis = $520
The replacement call's basis becomes $5.20 per share. When you eventually sell it, the $3.00 original loss is already baked into the higher basis.
Assignment Scenario: When a Put Becomes a Stock Purchase
This is where options traders get caught. A put assignment counts as a purchase at the strike price, and it can start the wash sale clock before you realize a loss.
Scenario:
- 1/5/2026: Sell 1 SPY $410 put for $2.00 premium (credit: $200)
- 1/17/2026: Assigned; buy 100 SPY @ $410 (cost: $41,000)
- 2/5/2026: Sell 100 SPY @ $400 (loss: -$1,000)
- 2/10/2026: Buy 100 SPY @ $395 (cost: $39,500)
Calculation:
- Loss sale = 2/5/2026 at -$1,000.
- 61-day window = 1/6/2026 to 3/7/2026.
- Assignment on 1/17/2026 is inside the window and counts as a purchase.
- Repurchase on 2/10/2026 is also inside the window.
- Same ticker = substantially identical. Wash sale triggered.
Adjusted Basis = $39,500 + $1,000 = $40,500
Key trap: The assignment itself is a purchase event. Even if you never bought shares again, the assignment could already contribute to a wash sale if you later sell those assigned shares at a loss within 30 days of another buy.
Rolling and Vertical Spread Calculator
Brokers track individual legs, not spread economics. A partial close can flag a wash sale on the losing leg even if the spread was profitable overall.
Scenario:
- 1/5/2026: Sell 10 SPY $440/$435 put verticals for $1.50 credit each (total credit: $1,500)
- 1/15/2026: Close 2 verticals for $2.00 debit each (total debit: $400)
- Economic P&L on 2 closed verticals: $1,500 ÷ 10 × 2 = $300 credit received, $400 debit paid = $100 loss
- Broker breakdown per closed vertical: long $440 put gains $1.20, short $435 put loses $0.70
Wash sale question: Does the broker flag the short $435 put leg as a wash sale?
Calculation:
- You closed 2 short $435 puts at a loss.
- You still hold 8 short $435 puts opened within 30 days.
- Same strike, same expiration, same underlying = substantially identical.
- Broker flags wash sale on the $140 loss from the 2 closed short puts.
That $140 is disallowed now and added to the basis of the remaining 8 short puts. Your total lifetime P&L does not change; the loss is only deferred.
Spreadsheet Formulas You Can Use Today
Paste these into any spreadsheet to build your own calculator.
| Field | Formula / Input |
|---|---|
| Loss Sale Date | Manual entry |
| Window Start | =Loss_Sale_Date - 30 |
| Window End | =Loss_Sale_Date + 30 |
| Replacement Date | Manual entry |
| In Window? | =IF(AND(Replacement_Date>=Window_Start, Replacement_Date<=Window_End), "Yes", "No") |
| Realized Loss | =(Sale_Price - Cost_Basis) * Quantity |
| Adjusted Basis | =Replacement_Cost + IF(In_Window="Yes", Realized_Loss, 0) |
For options, add a helper column that checks whether underlying, strike, expiration, and option type all match between the closed and replacement contracts.
Decision Table: Does the Calculator Trigger a Wash Sale?
| Scenario | Loss Sale? | Replacement in 61-Day Window? | Substantially Identical? | Wash Sale? |
|---|---|---|---|---|
| Sell SPY stock at loss, rebuy SPY stock | Yes | Yes | Yes | Yes |
| Sell AAPL $200 call at loss, rebuy AAPL $200 call same expiration | Yes | Yes | Yes | Yes |
| Sell AAPL $200 call at loss, buy AAPL $205 call same expiration | Yes | Yes | No (different strike) | Usually no |
| Sell SPY put at loss, sell new SPY put at different strike | Yes | Yes | No (different strike) | Usually no |
| Assigned on put, later sell stock at loss, rebuy stock | Yes | Yes | Yes | Yes |
| Sell stock at loss, sell covered call on same stock | Yes | Yes | No (selling, not buying) | No |
| Sell stock at loss, buy protective put on same stock | Yes | Yes | Yes (downside protection) | High risk |
| Trade SPY options, then trade SPX options | Yes | Yes | No (different underlying) | No |
Two Ways to Bypass Wash Sales Entirely
If your calculator keeps flagging the same underlying, consider these structural alternatives.
Section 1256 contracts. Broad-based index options such as SPX, RUT, NDX, and XSP are exempt from wash sale rules. They also receive 60/40 tax treatment. For a deeper comparison, see SPX Options Tax Treatment.
Mark-to-market trader status. Under Section 475(f), qualified traders elect to mark all positions to market at year-end. Wash sale rules do not apply, but gains and losses become ordinary income. This is irreversible without IRS permission and is not right for most investors.
Common Calculation Mistakes
Using 30 days instead of 31. The rule says within 30 days, so the earliest safe repurchase is 31 days after the loss sale. Use Loss Sale Date + 31 in your spreadsheet, not +30.
Forgetting assignments. A put assignment is a purchase. If you sell the assigned shares at a loss within 30 days of another buy, the assignment date matters.
Ignoring the IRA. If you sell at a loss in a taxable account and buy the same position in an IRA within 30 days, the loss is permanently disallowed, not deferred. The calculator should treat IRA purchases the same as taxable repurchases, but the tax result is worse.
Mixing up spread P&L with leg P&L. Your broker may flag a wash sale on one leg of a spread even when the overall spread is profitable. Track both economic P&L and per-leg wash sale adjustments.
How Days to Expiry Helps You Run the Numbers
A wash sale calculator is only as good as the trade history feeding it. If you cannot reconstruct the sequence of assignment, loss sale, and re-entry from your broker screens, you will miss triggers.
Days to Expiry is built for this:
- Use Portfolio View to review the full sequence of assignments, exits, and re-entries on each underlying.
- Use Interactive Brokers Options to import IBKR activity directly and avoid manual reconstruction.
- Use this calculator framework as a monthly checkpoint, not a once-a-year scramble.
Practical next step: Pick one underlying where you were assigned this year and trace it through the four steps above. If any repurchase falls inside the 61-day window, you already have a wash sale to report.
Bottom Line
A wash sale calculator turns a vague IRS rule into a concrete workflow: identify the loss sale, check the 61-day window, test whether the replacement is substantially identical, and adjust the basis. Build the spreadsheet once and rerun it monthly; the mistakes you catch in March are easier to fix than the ones you find in April.
For the full rulebook behind these calculations, see Wash Sale Rules for Options Traders. For a broader tax estimate across all your options activity, use Options Trading Tax Calculator.
Related Articles
- Wash Sale Rules for Options Traders – Complete guide to the rule, substantially identical tests, and broker traps
- Options Trading Tax Calculator – Estimate your full options tax bill before year-end
- SPX Options Tax Treatment – How Section 1256 contracts bypass wash sale rules
- Form 1099-B Walkthrough – How to read and reconcile broker wash sale adjustments
- Options Tax Compliance – Full framework for options tax reporting
- Covered Call Tax Rules – Qualified vs unqualified covered calls and tax timing
- Options Assignment Tracking – Why assignments matter for cost basis and wash sales
Expertise: This calculator framework was reviewed by a CPA specializing in active trader taxation. It is intended as a planning tool, not tax advice. Consult your own tax professional for your specific situation.
Frequently Asked Questions
Written by Days to Expiry Trading Team
The Days to Expiry trading team brings together experienced options traders and financial analysts dedicated to helping investors generate consistent income through proven options strategies.
Apply The Tax Framework