If I sell all of a stock before the end of the year can there be a wash sale?
Executive summary
Selling every share of a stock before year-end does not automatically prevent a wash sale; the IRS disallows a loss if the same or a “substantially identical” security was acquired within 30 days before or after the loss sale, creating a 61‑day window that can cross calendar years [1] [2]. The rule applies across accounts and even into IRAs, and when triggered the disallowed loss is typically added to the basis of the replacement shares rather than being lost forever [3] [4].
1. What the wash‑sale test actually asks — timing, identity and intent
The wash‑sale rule is simple in its questions: did the taxpayer sell the security at a loss, and was the same or a substantially identical security purchased within 30 days before or after that sale date — a 61‑day window that brackets the sale — because if either purchase or acquisition occurred in that window the loss is disallowed for the current year [1] [5] [2]. Brokers and tax advisers at large firms such as Fidelity, Schwab and JPMorgan explain the rule in the same terms, stressing that the calendar year boundary does not stop the rule from applying — a repurchase in early January can strip a December loss of deductibility [6] [7] [2].
2. Selling all shares doesn’t immunize a loss — repurchases, prior buys and account crossing matter
Even when an investor sells every share of a position by December 31, a wash sale can still occur if any purchase of the same or substantially identical security happened within the 30 days before that sale or within 30 days after it — the order of buy and sell is irrelevant to the test [2] [5]. The rule reaches across accounts — purchases in IRAs, spouse’s accounts, or other brokerage accounts can create a wash sale and the IRS expects taxpayers to aggregate these transactions when determining disallowed losses [3] [8]. Practically, selling all shares at year‑end and then reestablishing the position on January 10, for example, will typically trigger the wash rule and disallow the December loss [2] [3].
3. What happens when a wash sale is triggered — tax consequence and mechanics
When a wash sale is triggered the immediate tax consequence is disallowance of the loss for the current tax year; that disallowed amount is not erased but generally gets added to the cost basis of the replacement shares, effectively deferring the tax benefit until those replacement shares are later disposed of in a non‑wash transaction [4] [8]. Industry writeups and tax guidance note special traps — dividend reinvestment plans, automatic option exercises or buying “substantially identical” ETFs or funds can trip the rule — and that ambiguity over “substantially identical” means the IRS may be the ultimate arbiter [9] [6] [10].
4. Practical cautions, disputed edges and where professional help matters
Advisors and broker‑education pages uniformly recommend waiting at least 31 days after a loss sale before repurchasing the same or a substantially identical security to avoid a wash sale, or using different but genuinely non‑identical funds to retain market exposure without risking the rule [6] [2]. There are gray areas — what counts as “substantially identical” between two ETFs or share classes is not precisely defined and can create contested tax positions [6] [8] — and brokers do not always calculate wash losses across every account for a taxpayer, leaving the onus on individuals to reconcile trades when filing [8]. Major financial firms producing guidance (J.P. Morgan, Fidelity, Schwab) have an incentive to sell advisory services and sophisticated tax planning, so their practical examples emphasize caution and consulting a tax pro when trades cluster around year‑end [7] [6].
5. Bottom line for year‑end sellers
Selling all shares before year end can still produce a wash sale if any substantially identical security was bought within the 30 days before or after the sale date, including purchases that occur in the next calendar year or in other accounts such as IRAs — the safe operational rule is to avoid repurchasing substantially identical securities for at least 31 days after a loss sale or to use clearly different instruments to regain exposure [2] [3] [6]. If uncertainty remains about “substantially identical” status or cross‑account activity, documented advice from a tax professional is prudent because the IRS, not broker heuristics, determines compliance [8] [9].