How to sell a fund at a gain to use capital losses and rebuy immediately — wash sale?

Trying to figure out if the wash sale rules apply when I'm selling at a GAIN to harvest losses elsewhere. Here's my situation: I have about 20k in unrealized losses in some individual stocks I want to realize this year. But I also have a mutual fund sitting at a big gain. My plan was to sell the fund at the gain (to absorb those losses via Schedule D), then immediately rebuy the same fund so I stay invested. Someone told me this triggers a wash sale but that doesn't feel right to me — I thought wash sales only matter when you sell at a loss. Can someone confirm whether the wash sale rules even apply here, or am I misreading Publication 550? I don't want to mess up my 1099-B reporting on Form 8949.

36 comments

The wash sale rules only apply to losses. If you sell a fund at a gain, there is no wash sale issue at all — you can rebuy the identical fund the next second and it does not matter. The rule under Publication 550 is specifically about sales at a loss where you buy substantially identical securities within 30 days before or after. A gain sale is fully outside that rule.

Carla C.

Author

That's what I suspected. So the gain gets reported normally on Form 8949 and Schedule D, the losses offset it, and the rebuy just sets a new cost basis at whatever I paid?

Yes, exactly. The fund you rebuy gets a fresh cost basis equal to what you paid for it on the rebuy date. Your holding period on those new shares starts the day after the repurchase trade date.

Confirming what was said above — gain sales are not covered by wash sale rules at all. I had a similar situation last year with overlapping transactions across a few accounts and uploaded my broker's year-end 1099-B to taxr.ai. It read through every transaction, flagged which ones had a code W in column (f) of Form 8949, and confirmed none of my gain-side sales were affected. Useful sanity check when the forms get complicated.

Carla C.

Author

Good to know. My 1099-B is already looking messy with a bunch of covered and uncovered lots mixed together so that kind of check sounds useful.

Does the fund type matter here? Like would this work the same way for an ETF versus a mutual fund? I always assumed ETFs had different rules but maybe that's just about the underlying tax treatment not the wash sale side.

The wash sale rule applies to stocks and securities broadly — ETFs and mutual funds are both covered. The difference you're thinking of is probably how capital gains distributions work inside the fund, not the wash sale rule itself.

Ah right, the internal cap gains distributions thing. That makes sense.

Are you realizing the losses in the same tax year? If the losses are in December and the gain sale is in January they'd land on different Schedule D forms for different years and you couldn't net them.

Carla C.

Author

Yes, all in the same calendar year. I want both the gain and the loss sales to show up on the same Schedule D so they net against each other.

Good, then you're fine. Just make sure the trade dates — not settlement dates — are both in the same year. For exchange-traded securities it's the trade date that counts for the holding period and for which year the transaction falls in.

Wait, I want to make sure I understand the original question. You're selling the LOSING stocks and also selling the GAINING fund, right? You're not trying to rebuy the losing stocks immediately?

Carla C.

Author

Right. I'm selling the losing individual stocks and not rebuying them — those losses are real and I want to keep them. The fund is what I'm selling at a gain and immediately rebuying. So no wash sale concern on the loss side either.

Ok that's cleaner than I thought. If you were rebuying the losing stocks within 30 days that would trigger wash sales on those losses and the disallowed amounts would get added to the cost basis of the repurchased shares instead of being deductible this year.

One thing worth checking: if your net capital losses after all this still exceed your gains, you can only deduct a limited amount against ordinary income in a given year. The rest carries forward. The exact limit is on Schedule D and Topic 409 on irs.gov describes how the carryover worksheet works.

Carla C.

Author

In my case I'm actually trying to make sure the gains are large enough to absorb all the losses so I don't have any excess. I want a near-zero net on Schedule D this year.

The strategy you're describing is pretty standard tax-loss harvesting in reverse — using a gain realization to absorb losses rather than generating losses to offset existing gains. I ran my brokerage statements through Taxr last filing season when I had a similar netting question. It mapped every lot to the right Part I or Part II box on Form 8949 and showed me the net short vs long-term figures before I even touched the actual form.

Carla C.

Author

That's exactly the step I always mess up — figuring out which lots are short-term vs long-term when I have multiple purchases of the same fund over different years.

Yes, and it matters a lot because short-term gains get netted against short-term losses first, then long-term against long-term, before any cross-netting. Getting the holding period wrong on even one lot can shift your net into a different bucket.

Does the holding period on the fund you're selling affect anything here? If you've held it over a year it's long-term gain, under a year it's short-term. Short-term gains don't get the preferential rate and they interact differently with your loss buckets on Schedule D.

Carla C.

Author

The fund has been held well over a year so it's long-term. I was counting on that. The individual stock losses I'm harvesting are also long-term so it should be a clean long-term offset.

Is there any risk the IRS treats the immediate rebuy of the fund as a sham transaction or something like economic substance? I've heard that term thrown around.

No, that's not really a concern for a simple same-fund rebuy at a gain. Economic substance arguments come up in more complex structured transactions, not ordinary open-market trades. The wash sale rules are the specific statutory rule Congress created for this area, and they don't apply to gain sales.

The holding period on the repurchased fund shares — does it start fresh from the rebuy date?

Yes. Because you sold at a gain (not a loss), the wash sale rules don't apply and there is no tacking of the old holding period. The new shares' holding period begins the day after the trade date of the repurchase.

Got it, so if I sold and rebuyed in December I'd need to wait until the following December to have a long-term position again in those shares.

Just to double-check my reading of your plan: the losses from the individual stocks are going in Form 8949 Part I or Part II depending on holding period, and the fund gain is also going in Form 8949 before the Part totals carry to Schedule D lines 1b–3 or 8b–10 for netting — right?

Carla C.

Author

That's my understanding. Everything flows through Form 8949 into the right Part, then Schedule D nets it all. I'll have a 1099-B for each so the broker codes should tell me which box to check.

What broker are you using? Some brokers are better than others at identifying wash sales on the 1099-B automatically in box 1g. If yours misses something you still have to report it correctly even if it's not flagged — Publication 550 is clear that you can't deduct a wash sale loss even if the 1099-B doesn't show the W code.

Carla C.

Author

Using a major online brokerage. But good reminder — I've heard stories of brokers missing wash sales across different accounts since they can only see within their own system.

For anyone confused about why this isn't a wash sale: the wash sale rule in Publication 550 says the disallowed loss gets added to the basis of the new shares. If there's no loss to disallow — because you sold at a gain — there's nothing to add to anything. The rule simply has no mechanism to operate.

Are you planning to do this before year-end? The trade date is what matters for which tax year the sale falls in, and if you're cutting it close you want to confirm execution dates, not just order dates.

Carla C.

Author

Yes, aiming for mid-December to give myself buffer. Good point about execution vs order date — I'll make sure the trade actually confirms in the right year.

Is there any state tax angle here worth thinking about? Some states don't conform to federal capital gain treatment.

State rules vary too much to generalize — some states have their own holding period rules or don't allow capital loss carryovers the same way federal does. Worth checking your state's department of revenue guidance separately from the federal Form 8949 and Schedule D work.

Solid thread. The short version: wash sale rules are only triggered by a loss sale with a repurchase of substantially identical securities within the 30-day window on either side. Gain sales are outside the rule entirely. Rebuy the fund the same day if you want — no issue on the gain side.