Traditional vs Roth 401k to stay in the 0% long-term capital gains bracket

Trying to figure out the right 401k contribution strategy for next year and the long-term capital gains bracket question is making my head spin. I have a decent amount of taxable brokerage investments I want to start harvesting over the next few years. The 0% long-term capital gains rate only applies when your taxable income stays under a certain threshold, and I keep going back and forth on whether traditional pre-tax contributions or Roth after-tax contributions get me there more efficiently. My situation: salaried job, filing single, contributing to a brokerage account separately. I already tried running rough numbers in a spreadsheet but I'm not accounting for the interaction between ordinary income and the capital gains stacking rules correctly. Does traditional 401k lower my AGI enough to push me into the 0% bracket, or is the Roth approach better here for some reason I'm missing?

34 comments

Are you currently close to the threshold or pretty far above it? That matters a lot because the answer flips depending on where you land after contributions.

Leah R.

Author

Probably $15k to $20k above the threshold right now, before any 401k contributions. So traditional could realistically close that gap depending on how much I put in.

This is exactly the stacking problem that tripped me up last year. Capital gains don't just sit on top of ordinary income randomly — your long-term gains occupy the top of your income stack. So ordinary income fills from the bottom, and LTCG stacks above it. Reducing ordinary income with traditional pre-tax contributions creates more room in the 0% LTCG band before your gains get pushed into the 15% rate. I uploaded my W-2 and brokerage 1099-B to taxr.ai and asked it to map out exactly how my AGI, deductions, and capital gains layered against each bracket cutoff. It flagged that I was $3k over the 0% ceiling and that one more traditional contribution would have fixed it. Would have saved me real money if I'd done it before year-end.

Leah R.

Author

The stacking visual finally clicked for me reading this. So traditional contributions lower my ordinary income floor, which gives LTCG more room before it hits 15%. Roth contributions don't move that floor at all. That's the key difference I was missing.

Did Taxr pull the bracket cutoff automatically from the form or did you have to enter it manually? Asking because I want to try the same thing with my 1099-B.

It read the 1099-B numbers directly. I just told it I was filing single and it worked through the layers from there. Worth doing before you finalize contributions.

Traditional pre-tax is almost always the right move for this goal, but are you also accounting for the standard deduction? Your taxable income — not AGI — is what gets compared to the 0% threshold. So AGI minus deductions is the actual floor your LTCG stacks on top of.

Leah R.

Author

Oh that's a good catch. I was comparing AGI to the threshold, not taxable income. So I have even more room than I thought if I take the standard deduction.

Exactly. Run it as: salary minus traditional 401k contribution minus standard deduction equals ordinary taxable income. Then check how much of the 0% LTCG band is left above that number. That's your harvest room.

What's your expected retirement income situation? Because flipping to Roth now only makes sense if you think your rate in retirement will be higher than your current rate. For capital gains harvesting in the near term though, traditional wins almost every time if you're trying to stay in 0%.

Worth noting: the threshold for the 0% long-term capital gains rate changes each year with inflation adjustments. The IRS doesn't publish those in Publications 550 or Topic 409 for future years, so check the Schedule D instructions for the tax year you're filing. Don't lock in a strategy based on this year's number assuming it stays the same.

This burned me once. I planned around one year's number and it shifted slightly, pushed me just over. Now I always look at the actual instructions for that year rather than relying on memory.

Have you modeled what happens if you over-harvest? Because if your LTCG pushes taxable income above the 0% ceiling even slightly, only the amount above the threshold gets taxed at 15%, not the whole gain. So going a little over isn't a cliff — it's a slope. I had Taxr read through my Schedule D draft and the capital gains worksheet last spring when I was trying to figure out exactly how much room I had. It went line by line and showed me which gains were still in the 0% zone and which had spilled into the 15% rate. Helped me decide how many shares to sell without going over.

Leah R.

Author

That slope vs cliff point is reassuring actually. I was treating it like any dollar over meant everything got taxed at 15%.

Right, the qualified dividends and capital gain tax worksheet in the Form 1040 instructions walks through that calculation exactly. Each band is computed separately.

Does your employer plan even allow you to split contributions between traditional and Roth? Some plans do, some don't. Worth confirming before you build a strategy around that flexibility.

Leah R.

Author

Good point. I checked and mine does allow split contributions, so I could do mostly traditional and a small Roth portion if I wanted.

Are you also harvesting any losses in your brokerage to offset gains? Net capital gains are what matters for the bracket math, not gross proceeds. Losses reduce the LTCG amount that stacks on your income, so you get more room.

Leah R.

Author

I have a few positions with unrealized losses I haven't touched. If I harvest those in the same year, they'd offset some of the gains and shrink how much actually stacks against the bracket. Good point.

Just watch the wash sale rule if you plan to rebuy those positions. If you sell at a loss and buy substantially identical shares within 30 days before or after the sale, the loss gets disallowed and added to the basis of the new shares instead. The IRS covers that in Publication 550.

Traditional 401k reduces your AGI which flows through to your taxable income. Roth 401k does not. For this specific goal — staying in 0% LTCG — traditional is the tool. Roth has other advantages but they don't help you here.

How are you tracking your brokerage cost basis? If your shares have held a long time and you're trying to stay under a threshold, selecting specific lots with the highest basis gives you the most control over how much gain you recognize in a given year.

Leah R.

Author

I've been using the default average cost method but I should probably switch to specific identification. My broker supports it. Would I need to notify them before the sale or can I specify lots after the fact?

You need to identify the specific lots before or at the time of sale, not after. Tell the broker which lots you want to sell before you place the order. Keep a record of their confirmation in case the IRS ever questions the basis.

Switching methods mid-stream has some rules around it too depending on what your broker tracks. Worth reviewing Publication 550 on basis for shares — it covers specific identification and what you need to do to elect it properly.

If you end up with leftover capital losses after harvesting, they don't disappear. Net losses above your gains can offset up to a certain amount of ordinary income per year with any excess carrying forward. Topic 409 on irs.gov and Publication 550 both cover the carryover rules and the worksheet for figuring it.

My loss carryforward from a few years ago actually created this exact opportunity for me. Wiped out gains for two years straight and kept me comfortably under the threshold.

The interaction between AGI and the NIIT is worth keeping in mind too if your income climbs. The net investment income tax kicks in above a separate threshold and applies to capital gains regardless of which 0% bracket you're in. It's not on Schedule D — it's on Form 8960. Might not apply to you now but worth knowing as your income grows.

Does the 401k contribution also affect your state taxes? In some states traditional 401k contributions are deductible at the state level too, which could matter if your state also taxes capital gains as ordinary income.

Leah R.

Author

My state follows federal AGI pretty closely so yes, the traditional contribution would help there too. Hadn't fully thought through the state side.

To actually calculate your harvest room: take your expected W-2 income, subtract your planned traditional 401k contribution, subtract the standard deduction for your filing status. The result is your ordinary taxable income floor. The 0% LTCG ceiling minus that floor is roughly how much in long-term gains you can realize tax-free. Run that number and compare it to your unrealized gains to decide how much to harvest.

Leah R.

Author

This is the clearest formula I've seen laid out in this thread. Going to build this in a spreadsheet with the standard deduction and actual 401k contribution amounts as variables so I can adjust as the year goes on.

One thing I'd flag: if your employer matches, that match usually goes in pre-tax traditional, but if your plan allows it you can elect to have the match made as Roth, and a Roth match counts as taxable income to you that year. So your taxable income reduction from contributions is only on your own deferrals, not the match.

Mostly. The match is pre-tax on the employer side unless your plan lets you elect a Roth match, which would add to your taxable income. Doesn't change the AGI reduction math for your own contributions though.