Wash Sale Rule Calculator
Check if your recent trades trigger the IRS wash sale rule, see how much loss is disallowed, and how your cost basis is adjusted.
For U.S. federal income tax education only. This tool does not provide tax, legal, or investment advice.
Wash Sale Rule Checker
| Type | Ticker | Date | Quantity | Price / share ($) |
Cost / share ($) sales only |
Total ($) | Actions |
|---|
Summary
Wash sale details
| Ticker | Loss sale date | Loss realized ($) | Loss disallowed ($) | Loss allowed now ($) | Replacement shares | Adj. basis / share ($) | Notes |
|---|
This tool assumes replacement shares are purchased in taxable accounts and that all trades are in the same security (no options). Complex situations may require professional tax advice.
How this wash sale rule calculator works
The calculator looks for loss sales and then scans for purchases of the same ticker within the 61‑day wash sale window (30 days before the sale, the sale date, and 30 days after).
For each loss sale, it:
-
Computes your realized loss:
(sale price − cost basis) × shares sold. - Counts how many replacement shares you bought in the 61‑day window.
-
Disallows the loss on the smaller of:
- shares sold at a loss, and
- replacement shares purchased in the window.
- Allocates the disallowed loss to the replacement shares by increasing their cost basis.
Key formulas
Realized loss (before wash sale):
\(\text{Loss} = (\text{Sale price} - \text{Cost basis}) \times \text{Shares sold}\)
Disallowed loss (simplified):
\(\text{Disallowed loss} = \text{Loss} \times \dfrac{\min(\text{Shares sold}, \text{Replacement shares})}{\text{Shares sold}}\)
Adjusted basis per replacement share (simplified):
\(\text{Adj. basis per share} = \text{Original basis per share} + \dfrac{\text{Disallowed loss}}{\text{Replacement shares}}\)
What is the wash sale rule?
The U.S. wash sale rule is an IRS rule that prevents you from claiming a tax loss if you sell a security at a loss and buy the same or substantially identical security within 30 days before or after the sale.
Instead of letting you deduct the loss immediately, the IRS disallows it and adds the loss to the cost basis of your replacement shares. Your loss is not gone; it is deferred until you sell the replacement shares in a non‑wash‑sale transaction.
The 61‑day wash sale window
The rule covers a 61‑day period around the loss sale date:
- 30 days before the loss sale date
- the day of the loss sale
- 30 days after the loss sale date
Any purchase of the same or substantially identical security in that window can trigger the wash sale rule for some or all of your loss.
“Substantially identical” securities
The IRS does not define this term precisely, but common interpretations include:
- The same stock or ETF (e.g., selling AAPL and buying AAPL).
- The same mutual fund in a different share class (e.g., Investor vs. Admiral shares).
- Certain options or contracts to acquire the same stock.
Different funds tracking the same index (e.g., two S&P 500 ETFs from different providers) may be considered substantially identical, though there is no bright‑line rule. When in doubt, consult a tax professional.
Example: wash sale rule in action
Suppose you:
- Buy 100 shares of XYZ at $50 (basis $5,000).
- Later sell 100 shares of XYZ at $40 on December 15 (realized loss = $1,000).
- Buy 60 shares of XYZ at $42 on December 20.
Because the repurchase is within 30 days after the loss sale, the wash sale rule applies.
- Shares sold at a loss: 100
- Replacement shares in window: 60
- Portion of loss disallowed: \(1{,}000 \times \frac{60}{100} = 600\)
- Loss allowed now: \(1{,}000 - 600 = 400\)
- Disallowed loss added to basis of 60 replacement shares: \(600 / 60 = 10\) per share
- New basis per replacement share: \(42 + 10 = 52\)
Your tax return shows a $400 capital loss now, and the remaining $600 is embedded in the higher cost basis of your 60 replacement shares.
Common edge cases and pitfalls
1. Wash sales across different accounts
The wash sale rule applies across:
- Multiple taxable brokerage accounts
- Tax‑advantaged accounts (IRAs, Roth IRAs, HSAs)
- Your spouse’s accounts if you file jointly
Your broker’s 1099‑B may not see activity at other firms, but the IRS can. This calculator assumes all trades you enter are part of the same taxpayer’s universe.
2. Wash sales involving IRAs
If you sell at a loss in a taxable account and repurchase in an IRA within the 61‑day window, the loss can be permanently disallowed (no basis adjustment in the IRA). This calculator does not model that special case; it assumes replacement shares are in taxable accounts.
3. Partial wash sales
If you sell more shares than you repurchase, only the portion of the loss corresponding to the replacement shares is disallowed. The rest of the loss is allowed immediately. The calculator handles this by prorating the loss.
4. Multiple overlapping wash sales
Active traders can create chains of overlapping wash sales (e.g., repeated buy–sell–buy patterns). This tool handles straightforward cases but cannot fully replicate the IRS’s lot‑by‑lot rules for every complex scenario.
Strategies to avoid triggering the wash sale rule
- Wait 31 days before buying the same security back.
- Use similar but not substantially identical securities to maintain market exposure (e.g., switch from a sector ETF to a broader market ETF).
- Coordinate across accounts so you are not buying in an IRA while selling at a loss in a taxable account.
- Track your trades with tools like this calculator before executing tax‑loss harvesting.
Limitations and disclaimer
This calculator is for educational purposes only. It simplifies several aspects of the wash sale rules and does not:
- Handle options, short sales, or complex derivatives.
- Model permanent disallowance of losses due to IRAs.
- Determine whether two different securities are “substantially identical.”
Always review IRS Publication 550 and related guidance, and consider consulting a qualified tax professional for your specific situation.
FAQ
Does the wash sale rule apply to crypto?
Under current IRS guidance, the wash sale rule applies to stocks and securities. Crypto assets are generally treated as property, not securities, so most practitioners believe the wash sale rule does not yet apply to crypto. However, Congress has considered extending the rule to crypto, and tax law can change. Check current guidance or speak with a tax advisor.
Can I avoid a wash sale by using a different brokerage?
No. The rule applies to all of your accounts combined, regardless of brokerage. Using multiple brokers may make it harder to track, but it does not avoid the rule.
What if I buy before I sell?
Purchases made within 30 days before a loss sale can also trigger a wash sale. The calculator includes those purchases when it scans the 61‑day window.
Is a wash sale illegal?
No. Wash sales are not illegal; they are simply subject to special tax rules. You can still trade as you wish, but you may not be able to deduct certain losses immediately.