Tax-Loss Harvesting Before December 31: How It Works and the Wash-Sale Trap
Selling a loser in a taxable account can trim this year's tax bill, but the wash-sale rule can quietly undo it. How it works, a worked example, and a 61-day calendar.
There is a particular shade of red in a brokerage account at the end of December. It looks like failure. For tax purposes, though, it is sometimes a small asset, and the deadline for using it falls on a Thursday.
This piece is about the mechanics of tax-loss harvesting, written for anyone with a taxable brokerage account and a year that did not go to plan. It is not investment advice, and it is not tax advice for your particular return. If your situation has moving parts, such as a business, large gains, or accounts in several states, an hour with a tax professional is cheap next to a mistake.
What harvesting actually does
Harvesting means selling an investment that is worth less than you paid for it, inside a taxable account, so that the loss becomes real in the eyes of the IRS. A realized loss first cancels capital gains you realized in the same year. If your losses are bigger than your gains, you can use up to $3,000 of the excess against other income, such as wages, in a single year ($1,500 if you are married filing separately). Anything beyond that carries forward to later years, with no expiry date. The IRS lays this out in Topic 409, which is short and worth a read.
Notice what it does not do. It does not make the loss disappear from your portfolio. You are still down. What changes is that a loss you were stuck with anyway turns into something you can use on a tax return.
The steps, in order
- Confirm the account. Only taxable brokerage accounts count. A loss inside an IRA or 401(k) is not recognized, so there is nothing to claim.
- Find the losers, lot by lot. Compare cost basis with current value for each purchase lot, not just each fund. Two lots of the same fund bought at different prices can have opposite results. If your broker allows it, you can choose which lots to sell.
- Check how long you held each lot. One year or less is short-term. More than one year is long-term. That decides which bucket the loss lands in.
- Check the wash-sale window across every account you and your spouse control. This is where plans usually break, so it gets its own section below.
- Decide what happens next. Either stay in cash for the waiting period, or buy something with similar exposure that is not substantially identical.
- Sell before the deadline. The trade date decides the tax year, not the settlement date. The last trading day of 2026 is Thursday, December 31. Check your broker's calendar, and do not leave it for the final hour, so that one hiccup does not cost you the year.
- Record it. The sale goes on IRS Form 8949 and flows to Schedule D on your 2026 return. Your broker's Form 1099-B will report most of it, but keep your own note of anything the broker cannot see.
Short-term and long-term losses
Gains and losses are sorted by how long you held the investment. Short-term losses offset short-term gains first, and long-term losses offset long-term gains first. After that, a net loss in one bucket can offset a net gain in the other, and whatever is still a net loss can use the $3,000 allowance.
Short-term gains are taxed like ordinary income, which for most people is a higher rate than long-term gains get. That is why a short-term loss is usually the more valuable one: it tends to cancel gains that would have been taxed more heavily. A long-term loss does the same job against more lightly taxed gains. Neither is bad, but if you can choose lots and the numbers are close, the holding period deserves a look.
The wash-sale rule
This is the rule that surprises people. If you sell at a loss and buy the same or a substantially identical security within 30 days before or after the sale, the loss is disallowed for now. Count the sale day plus 30 days on each side and you get a 61-day window. The 30 days after is easy to remember. The 30 days before is what catches people.
The traps are almost always automatic:
- Dividend reinvestment. A reinvested dividend is a purchase. If it lands inside the window, it can disallow part of your loss. Turn reinvestment off for the fund you are selling before you sell.
- Recurring buys. The weekly or monthly auto-investment you set up and forgot is a purchase every time it runs.
- Your IRA. Buying the same fund in an IRA inside the window counts. It is worse than a delay. The IRS said in Revenue Ruling 2008-5 that the disallowed loss is generally not added to the IRA's basis, so the loss is usually gone for good.
- Your spouse's accounts. These are commonly treated as covered. Assume they are.
Anyone who writes software will recognize the shape of the problem. It is a uniqueness check enforced in application code, where each service only checks its own table. Your broker generally flags wash sales within a single account. Across accounts, you are the integration layer.
When the rule does hit a repurchase in a taxable account, the loss is not erased. It is added to the cost basis of the replacement shares, and your holding period carries over. That is a deferral, and most brokers handle it automatically inside one account, but it undoes the reason you sold.
What counts as substantially identical? The IRS has never drawn a bright line. A fund from a different provider that tracks the same index, such as two S&P 500 funds, is commonly treated as fine, but that is custom and not a formal blessing. A swap into a fund that tracks a different index is the more conservative route. If you buy back fewer shares than you sold, only that portion of the loss is disallowed.
It defers the tax; it does not erase it
Harvesting lowers your cost basis. Say you sell a position at $6,500 that you bought for $10,000, and you buy a similar fund for $6,500. If the new holding climbs back to $10,000, you owe tax on a $3,500 gain, a gain you would not have had if you had simply kept the original. You took the benefit early and gave it back later.
So where is the win? Mostly in time and in rates. Money you do not send to the IRS this year keeps working. And a loss that shelters ordinary income now can be repaid later as a long-term gain, which is often taxed at a lower rate. If you hold the replacement until death, the basis can step up and the deferral can become permanent, but that is a question for an estate planner. The honest summary is that harvesting is a loan from the IRS, not a gift.
The crypto question
Under current law, as far as I can verify, the wash-sale rule in section 1091 of the tax code is written for "stock or securities," and the IRS treats crypto as property. That has generally meant the rule does not apply when you sell crypto at a loss and buy it back right away. Two cautions. First, this is unsettled. A bill that would extend wash-sale treatment to digital assets has been moving through the House this fall, and I could not confirm that it has become law. Check the current status before you act, and ask a professional. Second, crypto ETFs and shares of crypto companies are securities, and the wash-sale rule applies to them like any other stock.
When it isn't worth the effort
- The loss is small. A $120 loss saves a few dollars and costs an evening of paperwork.
- The account is tax-advantaged. IRAs, 401(k)s and HSAs have nothing to harvest.
- You are in a low bracket. If your taxable income puts you in the 0% long-term capital gains bracket, harvesting gains can be the better move: sell a winner and buy it back to raise your basis at no federal tax. Check the current thresholds for your filing status.
- The replacement is a worse investment. If you sell something you believe in and buy something you do not, only for the tax, the tax is steering the portfolio.
- State rules differ. State treatment of capital losses varies, and a few states have no income tax at all, so the saving may be smaller than the federal number suggests.
- The tracking burden. Every harvest adds lots to follow. If you will not keep notes, the benefit can turn into a headache at filing time.
A worked example and a 61-day calendar
Everything in this section is hypothetical, with round numbers, to show the arithmetic. It ignores state tax and the net investment income tax.
Earlier in 2026, you sold something for a long-term gain of $2,000. Now you look at two positions in a taxable account:
- Position A: bought 2026-04-14 for $10,000, now worth $6,500. Held less than a year, so it is a short-term loss of $3,500.
- Position B: bought in 2022 for $8,000, now worth $5,500. Held well over a year, so it is a long-term loss of $2,500.
The netting goes like this:
- Short-term bucket: a $3,500 loss and no short-term gains. Net short-term loss: $3,500.
- Long-term bucket: a $2,000 gain minus a $2,500 loss. Net long-term loss: $500.
- Combined net capital loss: $4,000.
- This year's deduction against other income: $3,000, applied to the short-term loss first.
- Carried forward to 2027: $1,000, made up of $500 short-term and $500 long-term.
The $2,000 gain is wiped out, and $3,000 of other income is sheltered this year.
Now the calendar. Suppose you sell both positions on Tuesday, 2026-12-22. The 61-day wash-sale window then runs from Sunday, 2026-11-22 through Thursday, 2027-01-21, counting both ends.
| Stretch | Dates | What to check |
|---|---|---|
| 30 days before | Sun 2026-11-22 to Mon 2026-12-21 | Any purchase of the same fund, including reinvested dividends, recurring buys, and shares bought in an IRA or a spouse's account |
| Sale day | Tue 2026-12-22 | Sell both lots, and confirm the fills and the trade dates |
| 30 days after | Wed 2026-12-23 to Thu 2027-01-21 | The same list, plus year-end dividend reinvestment, auto-invest runs in early January, and new IRA contributions that get invested into the same fund |
| First clean day | Fri 2027-01-22 | Earliest day to buy the original fund back without a wash sale |
In between, a similar-but-different fund can keep you invested. Selling on the 22nd rather than the 31st leaves nine days of margin for a typo or a missed dividend date.
I think the quiet appeal of all this is that it asks you to look squarely at the red column, which most of us avoid until April.
Frequently asked questions
Can I harvest losses in my IRA or 401(k)?
No. Losses inside tax-advantaged accounts are not recognized, so there is nothing to deduct. Harvesting only works in taxable accounts. Those other accounts matter for a different reason: a purchase inside them can trigger a wash sale on a loss you take in a taxable account.
If I sell on December 31, can I buy it back on January 2?
Not without triggering the rule. The window runs 30 days after the sale, so January 2 falls inside it. You can buy a similar but not substantially identical fund right away, or wait until the 31st day after the sale to buy the original.
What if I miss the December 31 deadline?
The loss simply counts in 2027 instead of 2026. There is no penalty, only a shift in timing. The trade date has to fall inside the year, and nothing can be backdated.