Wash Sale Calculator
Calculate adjusted cost basis and disallowed losses when selling securities at a loss and repurchasing within the 30-day wash sale window.
1Original Purchase
2Sale (Loss Position)
3Replacement Shares
Wash Sale Analysis
What is a Wash Sale?
A wash sale occurs when you sell a security at a loss and purchase substantially identical securities within 30 days before or after the sale. The Internal Revenue Service (IRS) enacted this rule to prevent investors from claiming tax losses while maintaining their market position in the same or similar security.
When a wash sale is triggered, the loss is not immediately deductible. Instead, the disallowed loss is added to the cost basis of the replacement shares. This effectively defers the tax benefit until you eventually sell the replacement shares at a gain.
The 61-Day Window Explained
The wash sale rule applies if you purchase replacement shares within a 61-day window surrounding the sale date. This window includes:
- 30 days before the sale: Purchases made up to 30 days before selling at a loss
- The day of the sale: The actual date you sell the security
- 30 days after the sale: Purchases made up to 30 days after the sale
This 61-day period is designed to capture various strategies investors might use to maintain their position while claiming a tax loss.
How to Use This Calculator
- Enter Original Purchase Details: Input the number of shares, purchase price, and date of your original position.
- Enter Sale Details: Specify the number of shares sold, sale price, and sale date. The calculator identifies if you sold at a loss.
- Enter Replacement Purchase Details: Input the number of replacement shares purchased, purchase price, and date.
- Set Tax Rate: Adjust the marginal tax rate to calculate potential tax savings from the deferred loss.
- Review Analysis: The calculator determines if a wash sale occurred, calculates the disallowed loss, and shows the adjusted cost basis for your replacement shares.
Key Wash Sale Calculations
Disallowed Loss Formula
Disallowed Loss = Loss per Share × Wash Sale Shares
The disallowed loss is proportional to the number of replacement shares you purchased relative to the shares sold at a loss. If you replace all shares sold, the entire loss is disallowed. If you replace only a portion, only that portion of the loss is deferred.
Adjusted Cost Basis
Adjusted Cost Basis = Original Cost + Disallowed Loss
The disallowed loss is added to the cost basis of your replacement shares. This means when you eventually sell those replacement shares, your cost basis is higher, reducing (or eliminating) the gain, or increasing the loss you can claim.
Exceptions to the Wash Sale Rule
Not all sales at a loss trigger wash sale consequences. Key exceptions include:
- No Replacement Within 61 Days: If you sell at a loss and do not purchase substantially identical securities within the 61-day window, the loss is fully deductible.
- IRAs and Retirement Accounts: Sales from IRAs are not subject to wash sale rules when repurchased within an IRA, though other complex rules may apply.
- Hedging Transactions: Certain hedging transactions that clearly identify the position as a hedge may be exempt from wash sale rules.
- Different Securities: Selling one security and purchasing a different security (even in the same sector) is not a wash sale if they are not substantially identical.
Tax Implications of Wash Sales
Understanding wash sales is crucial for tax planning. While the loss is not immediately deductible, the benefit is not lost—it is deferred. The disallowed loss effectively increases your cost basis in the replacement shares, which can provide tax benefits in several ways:
- Reduced future capital gains when you eventually sell
- Larger loss deduction when you finally sell at a loss
- Potential to offset other capital gains in future tax years
Frequently Asked Questions
What qualifies as a substantially identical security?
The IRS does not provide an exact definition, but generally, securities are considered substantially identical if they are the same or very similar. This typically includes:
- Options or contracts to buy the same stock
- Convertible securities of the same company
- Very similar ETFs or mutual funds tracking the same index
However, selling one company's stock and buying a competitor's stock is generally not considered a wash sale, even if they are in the same industry.
Can I avoid a wash sale by waiting?
Yes. If you sell at a loss and want to claim the deduction, simply wait 31 days before purchasing substantially identical securities. Alternatively, you can purchase replacement shares 30 days before the sale, then sell the original shares at a loss.
What happens if I have multiple wash sales?
Multiple wash sales can be netted against each other. The disallowed losses from multiple wash sales can be added together and applied to the cost basis of the final replacement shares. Complex situations may require professional tax advice.
Does the wash sale rule apply to short sales?
Yes, wash sale rules also apply to short sales. If you close a short position at a loss and acquire the same security within the 61-day window, the loss may be disallowed.
How does the 30-day rule work for dividends?
Special rules apply to dividends and dividend reinvestment plans. If you sell at a loss and receive a dividend on substantially identical stock within the wash sale window, it may affect your ability to claim the loss.
Related Tools
Capital Gains Tax Calculator
Estimate the tax liability on your investment profits.
Capital Gains Tax Lot Optimizer
Optimize your investment tax liability by comparing FIFO, LIFO, HIFO, and tax-loss harvesting strategies. Upload trade history, track cost basis, and find the optimal lots to sell.
Crypto Tax Calculator
Estimate your cryptocurrency capital gains tax for 2026 with federal and state tax calculations.
Stock Average Calculator
Use our free stock average calculator to find the weighted average cost of your shares. Instantly know your true cost basis to make smarter investment decisions.
Stock Return Calculator
Free stock return calculator with DRIP analysis. Calculate total return, annualized return (CAGR), capital gains, and dividend income for any stock over any period.
Optimize Your Tax Strategy
You've calculated your wash sale adjustments—now take control of your entire trading strategy with Pineify. Our AI-powered Pine Script generator helps you build automated strategies that account for tax-efficient trading.