The wash sale rule is a U.S. tax rule that can prevent an investor from deducting a loss immediately after selling a stock or security if they buy a substantially identical stock or security within 30 days before or after the sale. In that case, the loss is generally disallowed for the current sale and added to the basis of the replacement position instead. The IRS discusses this treatment in Publication 550, and Investor.gov summarizes that IRS rules prohibit deducting losses related to wash sales through its wash sales glossary entry.
Wash Sale Rule: Rules, Examples & Tax Effects
The wash sale rule is a U.S. tax rule that can prevent an investor from deducting a loss immediately after selling a stock or security if they buy a substantially identical stock or security…
Practice trading with Finelo
Practice in a simulator, learn with bite-sized lessons, and build confidence before risking real money.
Want to learn more?
Practice in a simulator, learn with bite-sized lessons, and build confidence before risking real money.
Explore FineloExplore Finelo's 28-day challenges
Turn learning into a daily habit with guided challenge paths.
Before using a tax loss in planning, it helps to understand that the rule is about timing, not whether the investment was “good” or “bad.”
This article is for educational purposes only and does not constitute financial or investment advice. Finelo does not recommend any security, strategy, or transaction. Investing involves risk, including possible loss of principal.
How the Wash Sale Rule Works
A wash sale can occur when an investor sells or trades stock or securities at a loss and, within the relevant 30-day window, buys or otherwise acquires substantially identical stock or securities. The window runs both ways: 30 days before the sale and 30 days after the sale. Including the sale date, investors often think of this as a 61-day period.
The practical effect is usually this:
- The investor sells at a loss.
- A substantially identical replacement position is acquired inside the window.
- The loss is not deducted immediately.
- The disallowed loss is generally added to the cost basis of the replacement position.
That last point is important. The loss is not necessarily “gone forever.” In many standard cases, it is deferred through an adjustment to the replacement investment’s basis. Basis is the tax-cost figure used to calculate gain or loss when the replacement position is later sold.
For example, if an investor sells shares at a $2,000 loss and buys substantially identical shares within the wash-sale window, the $2,000 loss may not be currently deductible. Instead, the $2,000 may be added to the replacement shares’ basis, changing the gain or loss calculation when those shares are eventually sold.
A stock, fund share, option, or other investment holding is a type of asset, and wash-sale analysis is partly about whether the asset sold and the asset acquired are too similar for tax-loss recognition at that moment.
The 30-Day Before-and-After Window
One of the most common misunderstandings is that the wash sale rule only applies when someone buys back after selling. That is incomplete. The rule can also apply when the replacement purchase happened before the loss sale.
Investor.gov describes a wash sale as occurring when an investor sells or trades securities at a loss and, within 30 days before or after the sale, buys substantially identical securities, acquires substantially identical securities in a fully taxable trade, or acquires a contract or option to buy substantially identical securities (Investor.gov).
Consider this timeline:
| Day | Trade | Why it matters |
|---|---|---|
| Day -20 | Buy 100 shares of the same stock | This may be a replacement purchase even though it happened before the loss sale |
| Day 0 | Sell older shares at a loss | The loss sale triggers the wash-sale review |
| Day +31 | No purchase | Waiting after the sale does not erase the Day -20 purchase |
In that example, the investor might assume there is no wash sale because they did not buy after selling. But the lookback period can still matter.
A second misconception is that the rule applies only to common stock. IRS Publication 550 states that wash sale rules can apply to losses from sales or trades of contracts and options to acquire or sell stock or securities, and it specifically notes that warrants can trigger the rule when common stock is sold at a loss and warrants for common stock of the same corporation are bought at the same time (IRS Publication 550).
The key question is not only, “Did I buy the same ticker?” It is, “Did I acquire something substantially identical within the wash-sale window?”
What “Substantially Identical” Can Mean
“Substantially identical” is the phrase that creates many close calls. Some situations are straightforward: selling a stock at a loss and buying the same stock back 10 days later is generally a classic wash-sale scenario. Other situations can be harder.
Potentially relevant comparisons may include:
- Common stock versus the same company’s common stock
- Stock versus an option or contract to buy that same stock
- Stock versus warrants on the same company’s stock
- One fund versus another fund with very similar holdings or structure
- Automatic reinvestments that purchase the same or very similar security
The IRS and Investor.gov descriptions focus on substantially identical securities, not merely investments that are in the same broad category. For example, two investments could both be technology-related without necessarily being substantially identical. But if two positions are designed to provide nearly the same exposure, the analysis can become more sensitive.
For educational purposes, it may help to separate three ideas:
| Comparison | Lower-risk interpretation | Higher-risk interpretation |
|---|---|---|
| Same stock sold and repurchased | Usually easy to identify | Classic wash-sale concern |
| Different company in same industry | Not automatically identical | Still requires judgment if linked or derivative exposure exists |
| Similar index funds or ETFs | May or may not be substantially identical | Risk increases if the funds track the same index or are structured to mirror each other |
| Stock sold, call option bought | Not the same instrument | Investor.gov and IRS materials include contracts or options to acquire substantially identical securities |
This is where educational material has limits. The phrase “substantially identical” is not always resolved by a single formula. When tax reporting depends on a close comparison, a qualified tax professional may be needed.
Finelo’s guide to tax-loss harvesting provides related educational context for why replacement-security timing and wash-sale awareness matter when realizing losses.
Practice trading with Finelo
Practice in a simulator, learn with bite-sized lessons, and build confidence before risking real money.
Worked Example: Full Wash Sale Calculation
Assume the following simplified facts:
- Account type: taxable brokerage account
- Security: XYZ common stock
- Commissions: ignored for simplicity
- Other purchases or sales: none
- Replacement purchase: same stock, same number of shares
- Tax discussion: federal wash-sale mechanics only, not a complete tax return
Step 1: Original purchase
An investor buys 100 shares of XYZ at $50 per share.
Arithmetic:
- 100 shares × $50 per share = $5,000 cost basis
So the original basis is:
- Total basis: $5,000
- Per-share basis: $50
Step 2: Sale at a loss
Later, the investor sells 100 shares of XYZ at $38 per share.
Arithmetic:
- 100 shares × $38 per share = $3,800 sale proceeds
- $3,800 proceeds − $5,000 basis = −$1,200 loss
Without a wash-sale issue, the investor might expect a $1,200 capital loss from that sale, subject to the normal tax rules for capital gains and losses.
Step 3: Replacement purchase inside the wash-sale window
Ten calendar days after the sale, the investor buys 100 shares of XYZ at $39 per share.
Arithmetic:
- 100 shares × $39 per share = $3,900 replacement cost
Because the investor bought the same stock within 30 days after selling it at a loss, the transaction fits the basic wash-sale pattern described by Investor.gov and IRS Publication 550.
Step 4: Loss disallowed for the current sale
The $1,200 loss is not currently deducted from the sale.
Arithmetic:
- Economic loss on sale: $1,200
- Currently deductible loss from that sale: $0, assuming the wash sale fully applies
- Disallowed loss: $1,200
Step 5: Add disallowed loss to replacement basis
The disallowed loss is generally added to the basis of the replacement shares, as described in IRS Publication 550.
Arithmetic:
- Replacement purchase cost: $3,900
- Disallowed loss added to basis: $1,200
- Adjusted basis of replacement shares: $3,900 + $1,200 = $5,100
Per-share basis:
- $5,100 ÷ 100 shares = $51 per share
So even though the replacement shares were bought for $39 each, their adjusted basis for tax purposes becomes $51 each under this simplified example.
Step 6: Later sale of replacement shares
Suppose the investor later sells the 100 replacement shares for $44 per share, and no new wash-sale issue is triggered.
Arithmetic:
- Sale proceeds: 100 shares × $44 = $4,400
- Adjusted basis: $5,100
- Gain or loss: $4,400 − $5,100 = −$700
In this simplified example, the earlier disallowed loss affected the replacement shares’ basis. The eventual tax result depends on the later sale price and whether any additional wash-sale or other tax rules apply.
The important lesson is that the wash sale rule did not create a brokerage fee. It changed when and how the loss entered the tax calculation.
Common Misinterpretations and Failure Modes
The wash sale rule is mechanical in some ways, but investors can still get surprised. These are the most common errors.
“I waited 30 days after selling, so I’m safe”
Maybe, but only if there was no substantially identical purchase in the 30 days before the sale. The lookback period is often overlooked.
“My broker did not flag it, so it cannot be a wash sale”
Broker reporting can be helpful, but it may not capture every relevant fact, especially if an investor uses more than one platform or has complex positions. Tax responsibility ultimately depends on the taxpayer’s full facts, not only a single screen or alert.
“The loss disappears forever”
In many standard cases, the disallowed loss is added to the replacement position’s basis. That means the loss is deferred rather than simply erased. However, the exact result can depend on the facts, including what was bought, how many shares were replaced, and what happens next.
“Only buying after the sale matters”
Buying before the sale can matter. A purchase 20 days before the sale can create the same kind of issue as a purchase 20 days after the sale.
“Options do not count”
They can. Investor.gov includes contracts or options to buy substantially identical securities in its wash-sale description, and IRS Publication 550 discusses options, futures contracts, and warrants in the wash-sale context.
“Any similar investment is automatically a wash sale”
Not necessarily. Similar does not always mean substantially identical. But the closer two investments are economically, structurally, or contractually, the more careful the analysis may need to be.
“A small automatic reinvestment cannot matter”
Automatic dividend reinvestment or recurring purchases may create unintended replacement purchases if they acquire substantially identical securities within the window. Even a small purchase can complicate the loss calculation, especially for partial wash sales.
“Tax-loss harvesting always improves the outcome”
Tax-loss harvesting can be affected by timing, market movement, replacement choices, transaction costs, capital gain and loss limits, and personal tax circumstances. Finelo’s explanation of realized versus unrealized gains can help distinguish a paper loss from a completed taxable sale.
A Practical Review Workflow Before Reporting a Loss
A wash-sale review is easiest when it is done from actual trade records, not memory. The following educational workflow can help organize the issue before tax filing or before discussing it with a professional.
1. Identify every loss sale
For each sale, write down:
- Security name and ticker or identifier
- Number of shares or contracts sold
- Trade date
- Sale proceeds
- Cost basis or adjusted basis
- Dollar loss
The wash sale rule matters only where there is a loss. A gain sale does not create a wash-sale disallowance because there is no loss to disallow.
2. Check 30 days before the sale
Review purchases during the 30 days before the loss sale. Include:
- Manual purchases
- Automatic reinvestments
- Recurring investment plans
- Option or contract acquisitions
- Similar positions bought in another account or platform, if relevant to the tax review
The goal is to find anything that may be substantially identical to what was sold.
3. Check 30 days after the sale
Then review the 30 days after the loss sale. A replacement purchase inside this period can cause the loss to be disallowed and moved into the replacement position’s basis.
4. Compare the replacement position
Ask whether the acquired position is:
- The same security
- A contract or option to acquire the same or substantially identical security
- A warrant connected to the same corporation’s stock
- A fund or product that may be economically very close to the one sold
This is not always a yes-or-no exercise for non-identical funds or complex instruments. Close calls may require professional judgment.
5. Calculate the adjusted basis if the rule applies
If the wash sale applies, calculate:
- Original loss
- Portion of the loss disallowed
- Cost of the replacement position
- Adjusted basis after adding the disallowed loss
For a full replacement of the same number of shares, the arithmetic is usually straightforward. For a partial replacement, the calculation can be more complicated because only part of the loss may be disallowed.
6. Keep records that explain the calculation
Useful records may include:
- Trade confirmations
- Brokerage tax forms
- Lot-level purchase and sale history
- Notes showing which replacement lot absorbed the disallowed loss
- Any tax professional’s explanation for close-call comparisons
Good records matter because the wash-sale adjustment may affect a later year when the replacement position is sold.
FAQ About the Wash Sale Rule
Is the wash sale rule a penalty?
It is better understood as a loss-disallowance and deferral rule, not a normal penalty or trading fee. The investor may lose the immediate deduction, but the disallowed loss is generally reflected through the replacement position’s basis.
Does the rule apply if I buy first and sell later?
Yes, it can. The timing window includes purchases within 30 days before the loss sale as well as 30 days after it.
Does the 30-day period mean 30 trading days?
The rule is commonly discussed as 30 calendar days before or after the sale, not merely market trading days. Investors reviewing trades should be careful around weekends, holidays, and year-end dates.
What if I replace only some of the shares?
A partial replacement can create a partial wash sale. For example, if 100 shares are sold at a loss and only 40 substantially identical shares are bought within the window, only part of the loss may be disallowed. The allocation can be more detailed than the full-replacement example above.
Can selling in December and buying in January create a wash sale?
Yes. The 30-day window can cross tax years. A loss sale near year-end followed by a substantially identical purchase in January can still affect whether the December loss is deductible for that tax year.
What is the safest takeaway?
The safest educational takeaway is to check both sides of the loss sale: 30 days before and 30 days after. If a substantially identical position was acquired in that period, the loss may be deferred through the replacement position’s basis rather than deducted immediately. For tax filing, close comparisons, or multi-account situations, official IRS guidance and a qualified tax professional can help resolve the facts.
Frequently asked questions
Is the wash sale rule a penalty?
Does the rule apply if I buy first and sell later?
Does the 30-day period mean 30 trading days?
What if I replace only some of the shares?
Can selling in December and buying in January create a wash sale?
What is the safest takeaway?
Practice trading with Finelo
Practice in a simulator, learn with bite-sized lessons, and build confidence before risking real money.
About the author
Finelo Team
The Finelo Team creates practical investing and trading education designed to help beginners learn faster with structured challenges, simulator practice, and bite-sized lessons.
Keep reading — Related articles
SOFR Rate: What It Is, Where to Find It, and How It Affects Costs
The SOFR rate—the Secured Overnight Financing Rate—is a U.S. benchmark interest rate based on overnight borrowing transactions secured by Treasury securities.
Risk Free Rate: Inputs, Valuation & Example
The risk free rate is the baseline return used in finance to estimate what an investor could earn without taking meaningful default or market risk.
Real Interest Rate: Inflation, Formula & Example
A real interest rate is an interest rate adjusted for inflation. It estimates how much purchasing power a saver earns, or how much purchasing-power cost a borrower pays, after prices change.