How to minimize taxes on large unrealized capital gains in ETFs and stocks

Trying to figure out the best approach before I actually sell anything. I've been holding a mix of broad market ETFs and individual tech stocks for about 8 years, most with very low cost basis. Some positions are up 300–400%. Nothing has been sold yet so all of this is still unrealized. I've read about tax-loss harvesting but my portfolio is almost entirely gains right now, very few losers to offset. I looked at charitable giving options and donor-advised funds but I'm not sure how those interact with Schedule D and Form 8949 when you donate appreciated shares directly. My main question is: what are the realistic levers to pull to minimize taxes on large unrealized capital gains in ETFs and stocks before or at the time of sale? Specifically what happens on the actual forms when you use each strategy. I'm not asking about anything exotic, just what's available to someone filing a regular 1040.

42 comments

Are you planning to sell everything at once or spread it across multiple tax years? That changes the answer pretty significantly because you're stacking ordinary income and capital gains in the same year if you sell all at once, which can push you into a higher bracket. The rate that applies to your long-term gains depends on your total taxable income for that year, not just the gain itself. The IRS Topic 409 page covers how the rates tier.

Greg J.

Author

Planning to sell gradually, not all at once. Probably over 3–4 years. Part of the reason I'm asking is to figure out how to plan the timing across those years to keep income below certain thresholds.

Donating appreciated shares directly to a donor-advised fund is one of the cleanest moves here. You avoid recognizing the gain entirely on those shares, and you get a charitable deduction for the fair market value at the time of the donation. The shares never hit Form 8949 or Schedule D on your return because you're not selling them, you're transferring them. The deduction goes on Schedule A if you itemize.

Greg J.

Author

That's the part I wasn't sure about. So the donated shares just never appear on 8949 at all? The broker doesn't send a 1099-B for a transfer to a DAF?

Correct, no 1099-B for a charitable transfer of shares. The broker may send a letter confirming the transfer but it's not a sale so there's no proceeds to report. The DAF gives you the acknowledgment letter for the deduction. You'd want to keep that letter carefully for the Schedule A.

What's your income picture outside the portfolio look like? Wages, business income, anything like that? Reason I ask is that the threshold where long-term capital gains rates shift is based on taxable income including everything else, not just the gain. If you can get taxable income low enough in a given year, some of the gain could be taxed at zero. I uploaded my brokerage statements and a draft of my Schedule D to taxr.ai last year when I had a similar situation. It mapped out which lots were long vs short term, flagged the ones closest to the 1-year holding threshold, and gave me a list of which to hold vs sell first. Saved me from accidentally selling a lot that was 11 months old.

Greg J.

Author

Mostly salary income, so taxable income before any sales is already pretty high. Zero rate probably isn't available to me but I'll check the Schedule D instructions for the qualified dividends and capital gains worksheet to run the numbers.

The worksheet that actually computes the rate is the Qualified Dividends and Capital Gain Tax Worksheet inside the Form 1040 instructions, not Schedule D itself. Worth running it with different sale amounts plugged in to see where the brackets fall for your situation.

Have you looked at whether any of your ETF positions have had internal turnover that generated embedded gains? Some ETFs are structured to avoid this better than others. Broad index ETFs often use in-kind redemptions so the fund itself doesn't distribute capital gains. That's a different question from your personal unrealized gain, but it matters for how much you get hit even when you don't sell.

Greg J.

Author

Good point, I hadn't thought about fund-level distributions. The ETFs I hold are all broad index funds, so I think they're relatively efficient on that front. But I'll check the fund prospectus to confirm.

Specific lot identification is underrated here. If you hold the same ETF bought in multiple batches over the years, you can tell your broker which specific lots to sell rather than defaulting to FIFO. That lets you sell the higher-basis lots first and keep the low-basis lots invested longer. When I was sorting through this I had Taxr read through my 1099-B from the prior year and my broker's lot detail report side by side. It flagged three lots the broker had marked with incorrect basis and showed me exactly which column (g) adjustment I'd need on Form 8949 for each one, with the right adjustment code. Check your broker's cost basis method setting before any sale, because if it defaults to FIFO you may not be able to change it retroactively after the trade.

Greg J.

Author

I didn't realize you could do that retroactively after the trade, or rather that you can't. Good warning. I'll go into the account settings now and switch to specific lot ID before anything is sold.

Specific lot ID has to be set up before the sale, and you generally have to designate which lots you're selling at the time of the trade, not after. The broker confirmation statement is how you lock it in. Some brokers let you do it online at the time of the order, others require a phone call.

Does anyone know how installment sales work for stock? I keep hearing about them for real estate but I wasn't sure if they apply here.

Installment sale treatment under Form 6252 is not available for publicly traded securities. It applies mainly to real estate and privately held business interests. For publicly traded stocks and ETFs the full gain is recognized in the year of sale regardless of when you receive the proceeds.

That clears it up, thanks. So for stocks the only real timing lever is literally which tax year you sell in.

Are you in a state with its own capital gains tax on top of federal? A few states don't distinguish between short and long term at all and tax all gains as ordinary income. That can make a meaningful difference in which year you choose to sell if you're close to a state income threshold or if you're thinking about relocating.

Greg J.

Author

Yes, high-tax state unfortunately. That's part of why I'm trying to be careful about how much I realize in a single year. The combined rate adds up fast.

One thing worth flagging on the charitable giving angle: when you donate appreciated stock to a DAF the deduction is generally limited to a percentage of your adjusted gross income, not unlimited. If the donation is large relative to your income, the excess carries forward. Publication 526 at irs.gov and the Schedule A instructions both cover the limits, and they differ depending on the type of organization the DAF qualifies as.

Correct addition. The carryforward period is five years for the excess, so a very large donation doesn't disappear, it just spreads. Worth modeling it out before you transfer a big block of shares.

What about Roth conversions alongside this? If income is going to be elevated in the sale years anyway, is there any reason to do conversions at the same time?

Generally you'd want to avoid stacking a large Roth conversion in the same year as a large capital gain realization, since both add to taxable income. The conversion adds ordinary income on top of everything else. The better play is usually to do conversions in lower-income years and capital gain realizations in separate years if you can control the timing.

Makes sense. So they compete for the same headroom in the bracket rather than helping each other.

Going back to the Form 8949 mechanics since that's what the original question was partly about: each lot you sell gets its own row. Column (a) is the description, (b) date acquired, (c) date sold, (d) proceeds, (e) cost basis. If you've been using specific lot ID and your broker reports it correctly as a covered security, it goes in Part II box D (since yours are long-term) and no adjustment is needed in column (g) unless the basis is wrong. Exception 1 in the Form 8949 instructions lets you skip the form entirely for covered transactions with no adjustments and put the total straight on Schedule D line 8a.

Greg J.

Author

This is exactly what I needed. So if everything is covered and no adjustments are needed I don't have to list every individual lot on 8949, I can aggregate on Schedule D line 8a?

Right, but only if box D applies (basis reported to IRS, no adjustments). The moment you have a wash sale code W, a basis correction code B, or any other adjustment in column (g), that lot has to be on Form 8949 individually. So keep your lot detail handy even if you end up not needing the form.

Worth mentioning that holding period starts the day after you acquired the shares and the day you sell counts as part of the period. For exchange-traded securities it's the trade date that matters, not settlement. So if you're within a few days of the one-year mark on a lot, check the trade date on the confirmation, not the settlement date, before you sell.

Greg J.

Author

I actually had one lot I thought was long-term that turned out to be 364 days when I counted from the trade date. Good catch.

Has anyone actually used tax-loss harvesting to offset gains in a year where most positions are up? The only way I see it working is if you hold something that dropped recently and can sell it, then buy something similar but not substantially identical within 30 days.

That's the core of it. The trap is wash sales: if you sell at a loss and buy substantially identical shares within 30 days before or after, the loss is disallowed and gets added to the basis of the new shares instead. The 30-day window runs both directions. Publication 550 chapter 4 covers the wash sale rules in detail.

So you could sell a Vanguard S&P 500 ETF at a loss and immediately buy a Fidelity S&P 500 ETF and the IRS might still call them substantially identical?

That's the gray area. Two ETFs tracking the same index are arguably substantially identical. The safer move is switching to a fund tracking a different but similar index, like swapping a total market fund for an S&P 500 fund or vice versa. No IRS ruling has definitively settled the ETF-swap question, so conservative practice is to change the index too.

Do gifting shares to family members help here? Like giving appreciated stock to someone in a lower bracket?

The basis carries over to the recipient for gain purposes. So if you give appreciated stock to a family member, they take your original cost basis. When they sell, their gain is computed from your basis, not the value at the time of the gift. Publication 551 on irs.gov covers the gift basis rules. The long-term or short-term character also depends on your holding period, not theirs, since the holding period transfers too.

So the gain doesn't disappear, it just shifts to them and they pay at their rate when they sell.

Exactly. If they're in a lower bracket and their income is low enough to qualify for the zero long-term rate, the tax on that gain could be reduced significantly. But you need to know their actual income situation before counting on that.

Is there any way to avoid the gain entirely at death through a step-up in basis? Morbid question but it's relevant for very long holds.

Inherited property generally gets a basis equal to the fair market value at the date of death, so the unrealized gain during the original owner's lifetime disappears. That's covered in Publication 551. For a beneficiary, the holding period is automatically long-term regardless of how long either person held it.

So the entire strategy of holding appreciated stock until death and passing it to heirs is essentially a legal way to avoid realizing that gain at all.

Legally yes, but it means you never actually use the money yourself. Some people hold certain positions for exactly this reason, especially low-basis inherited stock they received that's appreciated further. It's a real planning tool but you have to weigh giving up the liquidity against the tax savings.

Pulling it together from what this thread has covered: the main levers are spreading sales across tax years to manage bracket exposure, specific lot identification to sell highest-basis lots first, donating appreciated shares directly to a DAF to avoid gain recognition entirely, tax-loss harvesting with care around the wash sale window, and for very long-term holds the step-up at death. Each one shows up differently on the forms, or in the case of the DAF donation, doesn't show up at all. If the positions are large enough that a mistake costs tens of thousands, it's worth getting a CPA or enrolled agent to run the actual numbers before any sale.

Greg J.

Author

This is a good summary. The lot identification and DAF points were the two things I was least clear on when I posted. Appreciate everyone walking through the form mechanics, that was the part I actually needed.