can i sell a stock and immediately buy it back
can i sell a stock and immediately buy it back?
can i sell a stock and immediately buy it back is a common question from traders and investors who want to realize a loss, lock in a gain, or manage intraday positions. This guide explains what that action means for taxes (the U.S. wash‑sale rule), trading mechanics (settlement, margin and pattern‑day‑trader rules), and how the rules differ for cryptocurrencies. You’ll get practical examples, avoidance strategies, reporting notes, cross‑account pitfalls — and simple calculations you can follow.
As of 2024-06-01, according to TurboTax and Charles Schwab guidance, the wash‑sale rule remains a core U.S. tax constraint on selling a security at a loss and buying a “substantially identical” security within a 61‑day window (30 days before through 30 days after the loss sale).
Overview
Investors ask “can i sell a stock and immediately buy it back” for several reasons:
- To harvest a tax loss before year‑end while staying economically invested.
- To realize gains and re‑enter a position quickly.
- To adjust intraday positions for risk or short‑term trading strategies.
There are two distinct concerns when you sell and then repurchase right away: tax consequences (primarily the wash‑sale rule in U.S. federal income tax) and trading/operational constraints (settlement timing, margin usage, and broker/FINRA rules such as pattern‑day‑trader requirements). For cryptocurrencies, the tax status has been historically separate from securities rules; however, guidance evolves and taxpayers should monitor updates and consult a tax professional.
This article balances beginner‑friendly explanations with practical, authoritative detail you can use to make informed recordkeeping and trading decisions. When you need a platform to trade or store assets, consider Bitget and Bitget Wallet for secure, feature‑rich execution and custody of digital assets.
The wash‑sale rule (U.S. federal income tax)
The wash‑sale rule prevents taxpayers from deducting a capital loss on the sale of a security if they acquire a “substantially identical” security within 30 days before or after the sale. The rule’s purpose is to stop taxpayers from creating a tax loss while maintaining an essentially unchanged economic position.
Key concept: if you sell at a loss and buy back within the wash window, the loss is disallowed for immediate deduction and is instead added to the cost basis of the replacement shares. That defers recognition of the loss until the replacement shares are sold in a taxable transaction that isn’t part of another wash.
Time window and mechanics
The effective period is 61 days: 30 days before the sale, the day of sale, and 30 days after the sale. If you acquire substantially identical shares during that interval and you sold the original position at a loss, the loss is disallowed.
Mechanics in practice:
- The disallowed loss amount is not lost forever; it is added to the tax basis of the replacement shares.
- When you later sell the replacement shares in a non‑wash transaction, the previously disallowed loss becomes part of the realized gain or loss calculation.
- The holding period of the replacement shares generally includes the holding period of the disallowed‑loss shares (this is known as tacking).
What counts as “substantially identical”?
There is no bright‑line statutory list. General guidance and practice suggest:
- Same stock (same CUSIP) is substantially identical.
- Different series or classes of the same issuer can be substantially identical (e.g., preferred vs. common may vary case‑by‑case).
- Options and convertible securities tied directly to the same underlying can create wash situations.
- ETFs and mutual funds tracking the same index are a gray area; two funds that track the same index might be treated as substantially identical if their holdings and objectives are effectively the same, but many advisers treat different‑issuer ETFs/mutual funds as likely non‑identical when they have materially different holdings or management.
Because the term is facts‑and‑circumstances based, conservative taxpayers typically avoid repurchasing any security that is effectively the same economic exposure during the 61‑day window.
Practical examples (loss, gain, and immediate repurchase)
Example A — Loss + immediate repurchase (wash sale):
- You buy 100 shares of Acme Corp for $50.00 on Jan 1 (basis = $5,000).
- You sell 100 shares for $40.00 on Jun 1 (realized loss = $1,000).
- On Jun 2 you buy 100 shares of Acme Corp at $42.00.
Because the repurchase is within 30 days after the loss sale, the $1,000 loss is disallowed under the wash‑sale rule. The $1,000 is added to the basis of the replacement shares: new basis = $42.00 * 100 + $1,000 = $5,200 (or $52.00 per share). The deferred loss is preserved but only realizes when you later sell the replacement shares (and provided no new wash applies).
Example B — Gain + immediate repurchase:
- You buy 100 shares of Beta Inc. at $50 and sell at $70 (gain realized = $2,000).
- You immediately buy 100 shares back at $71.
Selling at a gain creates a taxable event. The wash‑sale rule does not disallow gains; it only disallows loss deductions. Immediate repurchase does not undo tax on the realized gain.
Example C — Partial lots and basis tracking:
- You own 200 shares purchased at differing times (lot A 100 shares at $30, lot B 100 shares at $60).
- You sell 150 shares at a loss and repurchase during the wash window.
Wash calculations allocate the disallowed loss to the replacement shares on a lot basis; detailed lot accounting and FIFO/first‑in/first‑out rules affect which shares are considered sold and which basis applies.
How wash sales affect cost basis and future taxes
When a loss is disallowed, the disallowed amount increases the cost basis of the replacement shares. That means you don’t lose the economic loss forever — it’s deferred into the replacement cost basis and affects the amount of future gain or loss when the replacement shares are sold in a non‑wash sale.
Important implications:
- A higher adjusted basis reduces future taxable gain (or increases future deductible loss) when the replacement shares are later sold.
- The holding period of the replaced shares is tacked onto the holding period of the replacement shares for determining short‑ vs. long‑term capital gain treatment.
- Repeated wash sales can aggregate and reallocate loss amounts across multiple lots and transactions; careful recordkeeping is required.
Reporting and broker behavior
U.S. brokers report sales on Form 1099‑B, and many now attempt to flag wash sales for reporting. However:
- Brokers generally detect wash sales only within the same account and for the same CUSIP/security they clear.
- Wash sales that cross brokerage firms, individually managed accounts, or that involve purchases inside retirement accounts (IRAs) may not be detected or reported by the broker.
- Taxpayers have the ultimate responsibility to track cross‑account and cross‑broker wash sales and to report them correctly on Form 8949 and Schedule D.
As of 2024-06-01, according to Charles Schwab guidance, broker reporting improvements have reduced but not eliminated instances where cross‑account wash sales go undetected; taxpayers should reconcile broker statements and maintain their own trade logs.
Cross‑account and retirement account implications
A critical trap: purchases made in an IRA or other tax‑advantaged account can disallow a tax loss in a taxable account permanently. For example:
- You sell shares at a loss in a taxable account.
- Within 30 days you buy the same security inside your IRA.
Because the repurchase occurred in a retirement account, you cannot add the disallowed loss to the IRA basis — the disallowed loss is effectively lost permanently for tax deduction purposes. This is an area where broker reporting may not catch the interaction; taxpayers must track activity across accounts.
Spouse and related‑party transactions: the wash‑sale rules apply to purchases made by the taxpayer's spouse and certain controlled entities; selling at a loss and a near‑time purchase by your spouse can trigger wash treatment.
Same‑day trading, settlement, and margin considerations
Trading mechanics affect whether you can buy back immediately:
- Settlement: U.S. equities trade on T+2 settlement (trade date plus two business days) for delivery and final settlement. Cash in a cash account must be settled before using it to repurchase unless you use margin or you have free‑credit balance.
- Margin: Margin accounts allow immediate repurchase using borrowed funds (subject to margin requirements). However, margin trading carries interest and increased risk.
- Cash account rules: If you sell a stock in a cash account and then use the unsettled proceeds to repurchase, you may create a “good faith violation” under broker rules, which can lead to trading restrictions. Brokers monitor and enforce cash‑account settlement rules.
- Pattern‑day‑trader (PDT) rules: If you execute four or more day trades (opening and closing the same position on the same day) within five business days in a margin account and those trades represent more than 6% of your total trading activity, you may be designated a pattern‑day‑trader and subject to a minimum equity requirement of $25,000 in the account.
Operationally, you can typically sell and immediately repurchase the same security in a margin account, subject to cost and risk. The tax wash‑sale consequence is separate from these operational allowances.
Cryptocurrency and wash‑sale treatment
can i sell a stock and immediately buy it back — and what about cryptocurrency? The classic wash‑sale rule codified for securities applies to “securities” and does not explicitly mention virtual currencies. Historically, broker reporting systems and the IRS have treated many cryptocurrencies differently:
- Broker reporting: Most cryptocurrency exchanges and brokers have not applied or reported wash sales in the same automated way they do for equities.
- Tax guidance: As of mid‑2024, explicit IRS guidance applying the wash‑sale rule to cryptocurrency was not broadly enforced in the same way as securities. However, that does not mean wash‑sale treatment is impossible for crypto — the statutory language and court precedent are evolving, and tax authorities may assert wash principles where appropriate.
As of 2024-06-01, according to TurboTax guidance, taxpayers should treat crypto sales as taxable events and be conservative about near‑time repurchases if attempting tax‑loss harvesting, and consult a tax professional given potential rule changes. For crypto traders who need intraday execution and tax clarity, track transactions carefully and consider using wallets or exchanges with robust exportable trade histories — Bitget and Bitget Wallet offer tools to help manage trade logs and transaction exports.
International variations (example: Canada’s “superficial loss” rule)
Other countries have analogous rules. For example, Canada’s “superficial loss” rule disallows a loss if you or an affiliated person reacquires the same property within 30 days after the sale or if the property is owned at the time the loss is realized. Terminology and mechanics differ by jurisdiction, so consult local guidance.
Strategies to avoid triggering the wash‑sale rule
Common, conservative approaches:
- Wait 31+ days before repurchasing the same or substantially identical security to avoid wash‑sale treatment.
- Use a non‑substantially‑identical replacement: switch from one ETF to another that provides similar but not identical exposure (careful: ETFs tracking the same index may be deemed substantially identical in some circumstances).
- “Harvest and switch”: sell the loss position, buy a different sector or thematic ETF that keeps you invested, then switch back after the wash window.
- Harvest and hold: accept being out of the position for the 31‑day period.
- Increase tax‑lot sophistication: selectively sell lots with higher basis or use specific‑identification accounting to minimize undesired wash interactions.
Each strategy has tradeoffs: market timing risk, tracking error, and potential costs. There’s no universally best approach — choose a strategy consistent with your tax situation and investment objectives.
Risks and practical considerations
- Opportunity cost: Staying out of a position to avoid a wash sale exposes you to missed gains.
- Automated dividend reinvestment: DRIP programs can re‑invest dividends and accidentally create wash‑sale triggers; disable DRIP or monitor account settings around loss harvesting.
- Broker reporting mismatch: Brokers might miss cross‑account wash sales and report incorrect basis; reconcile and correct when needed.
- Recordkeeping burden: Accurate, lot‑level records are essential. Tax software and spreadsheets help but verify against broker statements.
Frequently asked questions
Q: If I sell and buy back within minutes, is it illegal?
A: No. Selling and immediately repurchasing is not illegal. However, if you sold at a loss and repurchased a substantially identical security within the wash window, the loss may be disallowed for current tax deduction purposes. Immediate repurchases may also be constrained by settlement and broker rules depending on account type.
Q: Does the wash‑sale rule apply to ETFs and options?
A: It can. Options that create economically identical exposure to the underlying, or ETFs considered substantially identical, may trigger wash treatment. Because “substantially identical” is fact‑dependent, treat such situations conservatively and consult tax guidance.
Q: What if my spouse buys the stock?
A: Purchases by your spouse (or certain related parties) within the wash period can trigger wash‑sale treatment and disallow losses. The rule applies across related taxpayers in many cases.
Q: Do brokers always report wash sales?
A: Brokers report wash sales detected in the accounts they manage, but they may not detect cross‑broker or cross‑account wash sales, nor purchases inside IRAs. You are ultimately responsible for correct tax reporting.
Recordkeeping and tools
Good practice:
- Keep a running trade ledger with trade dates, quantities, prices, commissions and fees, account type, and lot identifiers.
- Use tax software that supports wash‑sale tracking and Form 8949 generation.
- Reconcile broker 1099‑B forms to your internal records; brokers sometimes make mistakes.
- When trading crypto, use wallet and exchange exports (Bitget Wallet and Bitget transaction history can help) and consider third‑party tax tools that import exchange histories.
Sources used
This article synthesizes authoritative guidance and explainers from reputable sources (used and filtered for relevance): TurboTax (wash sale explanations and crypto guidance), Kiplinger (wash sale overview and avoidance tips), Charles Schwab (wash sale reporting and cross‑account examples), Motley Fool (same‑day trading, PDT and settlement issues), Mundurek and other tax explainers (timing and practical advice), Globe and Mail (Canada superficial‑loss overview), StackExchange and Bogleheads (practical Q&A and examples). Readers should consult primary IRS publications such as IRS Publication 550 and Form 8949 instructions for detailed tax rules.
As of 2024-06-01, according to TurboTax and Charles Schwab materials, the wash‑sale rule continues to apply broadly to securities, and taxpayers should be cautious about repurchasing substantially identical assets within the 61‑day wash window.
References and further reading
- IRS Publication 550 and Form 8949 instructions (see IRS official guidance for the latest updates).
- TurboTax help center on wash sales and cryptocurrency taxation.
- Charles Schwab client guidance on wash sales and cross‑account reporting.
- Kiplinger wash‑sale explainers and avoidance techniques.
- Motley Fool articles on settlement, margin, and pattern‑day‑trader rules.
Appendix A: Short glossary
- Wash sale: A loss‑sale followed by a purchase of substantially identical stock or security within the 61‑day window that disallows a current deduction of the loss.
- Substantially identical: A facts‑and‑circumstances standard used to determine whether replacement securities are essentially the same as the sold security.
- Basis adjustment: Adding disallowed loss to the cost basis of replacement shares.
- Settlement: The time between trade date and final exchange of cash and securities (U.S. equities are generally T+2).
- Margin: Borrowed funds in a brokerage account used to buy securities immediately.
- Pattern day trader (PDT): A trader flagged under FINRA rules for frequent day trades, subject to a $25,000 minimum account equity requirement.
- Superficial loss (Canada): A Canadian rule similar to the wash‑sale rule that disallows loss if repurchase occurs within 30 days by the taxpayer or an affiliated person.
Appendix B: Example calculations
Example 1 — Adding disallowed loss to replacement basis:
- Purchase: 100 shares at $50.00 = $5,000.
- Sale at loss: 100 shares sold at $40.00 = $4,000 (realized loss = $1,000).
- Repurchase within wash window: 100 shares at $42.00 = $4,200.
Result: disallowed loss = $1,000. New basis of replacement shares = $4,200 + $1,000 = $5,200 (or $52.00 per share). If you later sell the 100 shares at $60.00, your taxable gain would be $60 * 100 − $5,200 = $800.
Example 2 — Partial lot and allocation:
- Lot A: 50 shares bought at $30 (basis $1,500).
- Lot B: 50 shares bought at $60 (basis $3,000).
- Sell 60 shares at $25 (proceeds $1,500; loss depends on which lots are deemed sold — FIFO vs specific‑identification).
Work through lot identification and allocate the loss accordingly. If you sold primarily from Lot B, the loss might be smaller or larger depending on lot selection. Specific‑identification accounting helps manage which lots are realized and which may create wash‑sale exposures.
Final notes and next steps
If you’re wondering “can i sell a stock and immediately buy it back” for tax‑loss harvesting or trading reasons, remember these practical rules:
- Selling and repurchasing is operationally allowed in many accounts, especially margin accounts, but may create tax consequences if done around a loss.
- The wash‑sale rule disallows losses for 30 days before and after a sale that realizes a loss if substantially identical shares were purchased.
- Cross‑account repurchases (including IRAs) can create traps where losses are permanently disallowed.
- Cryptocurrency tax treatment is evolving; treat repurchases conservatively and consult a tax advisor.
For traders and investors seeking reliable execution and recordkeeping, consider Bitget for trading and Bitget Wallet for secure custody and transaction history. Keep detailed records, use tax‑aware software, and consult a qualified tax professional for complex situations.
Further explore Bitget resources to learn how to export trade histories and use tax tools to track basis and potential wash‑sale interactions. Explore more Bitget features and documentation to streamline trade capture and reporting.
Notes for editors:
- Tax rules change; readers should verify current IRS guidance and consult a tax professional.
- For crypto users, monitor administrative guidance and legislative changes.


















