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

USD
Original Cost Basis
$15,000.00

2Sale (Loss Position)

USD
Sale Proceeds
$12,000.00
Gain: $3,000.00

3Replacement Shares

USD
Replacement Cost
$12,500.00
%

Wash Sale Analysis

Not a Wash Sale
No loss realized on the sale
Disallowed Loss
$0.00
Added to replacement cost basis
Adjusted Replacement Cost
$12,500.00
Original + disallowed loss
Tax Savings
$0.00
Deferred tax benefit
Net Realized Loss
$3,000.00
Gain recognized
Wash Sale Window Timeline
Original
2025-01-01
Sale
2025-01-15
Replacement
2025-01-25
Original purchaseSale at lossReplacement shares

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

  1. Enter Original Purchase Details: Input the number of shares, purchase price, and date of your original position.
  2. Enter Sale Details: Specify the number of shares sold, sale price, and sale date. The calculator identifies if you sold at a loss.
  3. Enter Replacement Purchase Details: Input the number of replacement shares purchased, purchase price, and date.
  4. Set Tax Rate: Adjust the marginal tax rate to calculate potential tax savings from the deferred loss.
  5. 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.

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.