Tax-Loss Harvesting and the Wash Sale Rule
Tax-loss harvesting is the strategy of selling investments at a loss to offset capital gains and reduce your tax bill. You can deduct up to $3,000 in net capital losses per year ($1,500 married filing separately) against ordinary income, with excess losses carrying forward to future years. However, the wash sale rule prevents you from claiming a loss if you buy a "substantially identical" security within 30 days before or after the sale.
How tax-loss harvesting works
When you sell an investment for less than you paid for it, you realize a capital loss. Capital losses are first used to offset capital gains from other sales during the same tax year. If your losses exceed your gains, the net loss has additional tax uses.
Here is a step-by-step illustration:
- You sell Stock A, which you held for 2 years, for a $10,000 gain (long-term).
- You also sell Stock B, which you held for 6 months, for a $4,000 gain (short-term).
- You sell Stock C, which has declined in value, for an $8,000 loss (long-term).
- Net result: The $8,000 long-term loss offsets the $10,000 long-term gain, leaving a $2,000 net long-term gain. The $4,000 short-term gain remains.
Without the harvested loss, you would owe capital gains tax on both the $10,000 long-term gain and the $4,000 short-term gain. By harvesting the $8,000 loss, you reduced your taxable long-term gain to $2,000.
The netting rules work as follows: long-term losses first offset long-term gains, and short-term losses first offset short-term gains. Any remaining net loss in one category then offsets gains in the other category. The specific ordering is governed by IRC 1222.
The $3,000 ordinary income deduction
Under IRC 1211(b), if your net capital loss for the year exceeds your capital gains, you can deduct up to $3,000 of the excess loss against ordinary income. The limit is $1,500 for married filing separately filers. These amounts are statutory and are not indexed for inflation.
For example, if you have $5,000 in capital losses and $1,000 in capital gains, your net capital loss is $4,000. You can deduct $3,000 of that against ordinary income on your tax return. The remaining $1,000 carries forward to next year.
At a 22% marginal ordinary income rate, a $3,000 deduction saves $660 in federal income tax. At the 24% rate, it saves $720. The deduction is valuable but limited, which is why the carry-forward rule matters for larger loss balances.
The wash sale rule
The wash sale rule under IRC 1091 is a critical limitation on tax-loss harvesting. The rule disallows a capital loss deduction when you sell a security at a loss and you buy a "substantially identical" security within a window that begins 30 days before the sale and ends 30 days after the sale. That is a 61-day window centered on the sale date.
The purpose of the wash sale rule is to prevent taxpayers from taking a paper loss for tax purposes while maintaining essentially the same economic position in the investment.
When a wash sale occurs, the disallowed loss is not permanently lost. Instead, it is added to the cost basis of the replacement security. The holding period of the original security is also tacked on to the holding period of the replacement. The loss is effectively deferred until you sell the replacement security in a non-wash-sale transaction.
What triggers a wash sale
The following transactions trigger the wash sale rule if they occur within the 30-day window before or after the loss sale:
- Buying the same stock you sold: Selling 100 shares of Company X at a loss and buying 100 shares of Company X back within 30 days is the textbook wash sale.
- Buying options on the same stock: Purchasing a call option on Company X stock within the 30-day window after selling Company X at a loss can trigger the wash sale rule, because the option gives you substantially identical exposure to the same security.
- Substantially identical mutual funds: Selling shares of one S&P 500 index fund and buying shares of a different S&P 500 index fund from another fund family within 30 days may be treated as substantially identical, particularly if both funds track the exact same index. This area involves some judgment and is not always clear-cut.
- Purchases in IRA or 401(k) accounts: If you sell stock at a loss in a taxable brokerage account and your IRA or employer plan purchases the same stock within the 30-day window, the wash sale rule may apply. The IRS has provided guidance on this, and the disallowed loss in this situation is lost permanently because the IRA cannot adjust basis in the same way.
- Spouse's accounts: Purchases by your spouse within the 30-day window count. The rule looks at purchases by you or your spouse in any account.
What does not trigger a wash sale
Not every replacement purchase triggers the wash sale rule. The securities must be "substantially identical." Here are situations where the rule generally does not apply:
- Selling one company's stock and buying a competitor's stock: Selling Ford and buying General Motors is not substantially identical, even though both are automakers. These are separate companies with different risk profiles.
- Selling a sector ETF and buying a different sector ETF: Selling an energy sector ETF and buying a different energy ETF that holds different underlying securities is generally not a wash sale, though the analysis depends on how similar the holdings are.
- Selling an S&P 500 fund and buying a total market fund: A broad total market index fund includes different securities (and different weightings) than a pure S&P 500 fund. This type of swap is generally considered acceptable for tax-loss harvesting, though there is no definitive IRS ruling on every possible fund pair.
- Selling a bond fund and buying a similar but different bond fund: Different bond funds with different issuers or maturities are generally not substantially identical.
The "substantially identical" determination is facts-and-circumstances based. When in doubt, consulting a tax professional is advisable, particularly for large loss transactions.
Carrying losses forward
Capital loss carryforwards are one of the most taxpayer-friendly features of the tax code. If your net capital losses exceed $3,000 in a given year, the excess carries forward indefinitely to future tax years. There is no expiration date on capital loss carryforwards.
Carryforward losses retain their character: long-term losses carry forward as long-term losses, and short-term losses carry forward as short-term losses. In the year you use the carryforward, the losses follow the same netting rules as current-year losses.
For example, if you have a $25,000 net capital loss in one year:
- Year 1: Deduct $3,000 against ordinary income; carry forward $22,000.
- Year 2: Use carryforward to offset $10,000 in capital gains; deduct $3,000 against ordinary income; carry forward $9,000.
- Year 3: Use remaining $9,000 to offset future gains.
Capital loss carryforwards can only be used during your lifetime. They do not transfer to heirs. Married couples report combined capital gains and losses on a joint return, but if one spouse dies, the surviving spouse generally loses the ability to use the deceased spouse's separate carryforward losses.
Year-end planning
Tax-loss harvesting is most commonly done in the fourth quarter of the tax year (October through December). The reason is that by late in the year, you have a clearer picture of your total realized gains for the year and which positions are sitting at losses.
Key year-end considerations:
- Settlement dates: A stock sale must settle by December 31 to be recognized in the current tax year. US stock markets currently use T+1 settlement (trade date plus one business day). A sale executed on December 30 generally settles December 31 and counts for the current year.
- Watch the 30-day clock: If you harvest a loss on December 15, you cannot repurchase the same security until January 15 without triggering a wash sale. Plan replacement purchases accordingly.
- Review mutual fund distributions: Mutual funds often distribute capital gains in December. If you purchase a fund shortly before its distribution record date, you receive a taxable distribution even though the fund's value drops by the same amount. Checking distribution schedules before buying helps avoid an unwanted tax bill.
- Long-term vs. short-term timing: If a loss position is approaching the one-year mark, holding it past the anniversary converts any future loss from short-term to long-term. Depending on your gain mix, one character may be more useful than the other.
For context on current long-term capital gains rates, see the 2026 bracket tables in our Capital Gains Tax Brackets for 2026 guide. Single filers with taxable income up to $49,450 pay 0% on long-term gains, which can affect the value of offsetting those gains versus using losses to offset ordinary income.