Tax-loss harvesting at year-end: the 30-day wash sale rule, and why buying back in an IRA kills the loss
Selling investments at a loss offsets capital gains, then up to $3,000 of ordinary income a year, with the rest carried forward indefinitely. But buying the same or a substantially identical security within 30 days before or after the sale, including in your own or your spouse's IRA, is a wash sale. With an example and a year-end checklist.

Tax-loss harvesting means selling investments that are down before year-end and using the realized losses to offset this year's capital gains. If losses are left over, up to $3,000 a year can offset wages and other ordinary income, and the rest carries forward with no time limit. The key is the wash sale rule: buy the same or a substantially identical security in any account within 30 days before or after the sale and you can't deduct the loss this year. If the purchase is in your own or your spouse's IRA, the loss is gone for good.
How losses offset income
Step one: short-term losses offset short-term gains, and long-term losses offset long-term gains. One year or less is short-term; more than one year is long-term.
Step two: if one side ends with a net loss and the other with a net gain, they offset each other.
Step three: a remaining net loss offsets up to $3,000 of ordinary income a year, $1,500 if married filing separately.
Step four: whatever is left carries forward indefinitely, keeping its short- or long-term character. Unused carryforwards disappear at death; heirs can't use them.
Which losses are worth more: a short-term loss that offsets short-term gains (taxed up to 37%) usually saves more than one that offsets long-term gains (15% or 20%).
Example: what harvesting saves
Example (hypothetical numbers, to show the method): the Zhaos live in North Carolina and file jointly. Their 2026 MAGI is about $320,000, their long-term gains are taxed at 15%, and their investment income is already subject to the 3.8% net investment income tax (the joint threshold is $250,000). Mid-year they sold a stock they'd held for years, realizing a $30,000 long-term gain. They also hold an international stock fund with a $25,000 paper loss.
They sell the losing fund in December: the $25,000 loss offsets $25,000 of the gain. That saves $3,750 of federal capital gains tax (15%), $950 of NIIT (3.8%) and about $998 of North Carolina tax (3.99%), roughly $5,698 in all.
What about the cash? To stay invested, people often buy a fund that tracks a different index, or wait 31 days and buy the original back. What to buy is an investment decision and we don't make recommendations; we just flag the tax rules.
It's a deferral, not a write-off. The replacement's basis is its purchase price, so if it recovers you'll owe tax on that gain later. What you actually keep is the time value, any rate difference (deducting against short-term gains now, paying long-term rates later) and, if you hold until death, the step-up that means that gain is never taxed as income.
The wash sale rule: a 61-day window
The rule: if, within 30 days before or after the day you sell at a loss (61 days in all), you buy, contract to buy or acquire an option to buy the same or a substantially identical security, you can't deduct the loss this year.
The loss moves; it doesn't vanish. The disallowed loss is added to the basis of the new shares, and their holding period includes the old shares'. You get the benefit when you sell the new shares. Your broker lists wash sale losses it disallowed in box 1g of Form 1099-B.
Partial buybacks: sell 100 shares and buy back 40 within the window, and only the loss on 40 shares is disallowed. The other 60 shares' loss is deductible.
The 30 days before count too: buying a new lot and then selling an old losing lot within 30 days is also a wash sale. Many people only watch the 30 days after.
What is substantially identical
Almost always: the same class of stock in the same company, bonds or preferred stock convertible into it, and options to buy it.
Gray area: ETFs or index funds from different sponsors tracking the same index. The IRS hasn't issued a clear rule, so the cautious approach is to avoid it.
Generally not: funds tracking different indexes, different companies' stock, or another company in the same industry.
The four most common traps
Trap one: buying back in an IRA. Sell at a loss in a taxable account and buy the same stock or fund in your IRA or Roth IRA within 30 days, and Rev. Rul. 2008-5 says it's a wash sale. The disallowed loss can't be added to your IRA basis, so it's lost permanently. Regular 401(k) purchases of the same fund deserve a look too.
Trap two: your spouse buys it. If you sell at a loss and your spouse buys the same security in their account within the window, it's a wash sale, whether you file jointly or separately.
Trap three: automatic dividend reinvestment. A reinvested dividend in the same stock or fund within 30 days of the sale is a small purchase that disallows a small part of the loss. Turn off reinvestment before harvesting.
Trap four: multiple brokers and accounts. Brokers track wash sales only within the same account. Purchases at another firm or in another account aren't on their radar, so you adjust for them on your return.
Year-end checklist
Trade date counts: a sale on a trading day by December 31 counts this year; settlement can come later.
Total the year first: add up realized gains and losses across every broker, your spouse's accounts and any foreign accounts before deciding how much to harvest. With only $3,000 of ordinary income to absorb losses, a large loss with no gains to offset mostly banks a carryforward.
Pick your lots: if you bought a stock in several lots, identify the biggest-loss lot when you sell. You can't change it afterwards.
Low-income years work the other way: if your taxable income is within the 0% capital gains bracket, harvesting losses does little; realizing gains to raise basis may be better, and gains aren't subject to the wash sale rule.
Crypto: the wash sale rule covers stock and securities. Under the law in effect as of November 2026, crypto sold at a loss and bought back right away generally still produces a deductible loss. Congress has considered changing that, so check again before relying on it.
For the full picture, including 2026 capital gains rates, fund distributions, interest, real estate, employee stock, foreign investments, state taxes and 20 tax-saving moves, see our guide to how investments are taxed. To run all your accounts together before year-end, book a free 15-minute call or add WeChat YCLUSA. YCL CPA doesn't sell financial products, manage investments or recommend what to buy; we get the tax right and the forms filed, and results depend on your facts and the tax rules.
Questions this article answers
How much of my capital losses can offset ordinary income each year?
Capital losses first offset capital gains. Any net loss left over offsets up to $3,000 of ordinary income a year ($1,500 married filing separately). The rest carries forward indefinitely until used, but unused carryforwards can't pass to heirs at death.
How does the 30-day wash sale window work?
It runs 30 days before and 30 days after the day you sell at a loss, 61 days in total. Buying the same or a substantially identical security in that window disallows the loss for now and adds it to the basis of the new shares.
Can I deduct a loss if I sell in my brokerage account and buy the same stock in my IRA?
No. Under Rev. Rul. 2008-5, buying substantially identical securities in your IRA or Roth IRA within 30 days is a wash sale, and the disallowed loss can't be added to your IRA basis, so it's lost permanently. The same applies if your spouse buys.
Does the wash sale rule apply to crypto?
Under the law in effect as of November 2026, the wash sale rule applies to stock and securities, and crypto isn't included, so selling at a loss and buying back right away generally still produces a deductible loss. Congress has considered extending the rule, so confirm before relying on it.
Ready to talk? The first 15 minutes are on us.
Book online, or send us a few details and we will come back with a written quote within one business day.
