Should I sell long-term stocks to cover living costs while maxing 401k?

Trying to figure out the right move here. I have a solid taxable brokerage account with long-term positions, most held more than a year, and I'm trying to decide whether I should sell some of those shares to cover monthly expenses so I can keep maxing out my 401k contributions at work. The logic feels right to me: long-term capital gains rates are lower than ordinary income rates, and 401k contributions reduce my taxable income now. But I'm not sure if the math actually works out, or if I'm missing something on the tax side. My employer matches up to a certain percentage so I definitely want to hit at least that threshold. I've been reading about Schedule D and capital gain rates but I can't find a clean comparison of the two tax treatments side by side. Does anyone actually do this, and is there a tax reason it might backfire?

33 comments

Schedule D is where this plays out. Your net long-term gains land on Schedule D line 15, and what rate applies depends on your taxable income after all deductions, including the 401k reduction. So the 401k contribution itself lowers the income threshold that determines whether your gains are taxed at zero, fifteen, or a higher rate. That interaction is the key piece most people miss when they run this comparison.

Derek G.

Author

Schedule D line 15 — okay that's where I should be looking. So the 401k deduction actually shifts me down into a lower gain bracket potentially. That's the part I hadn't connected.

The employer match is free money so hitting that floor is non-negotiable regardless of anything else. Beyond the match, whether to max the full 401k depends on your marginal ordinary income rate versus your expected long-term rate on the stock sale. For the specific rate thresholds, the Form 1040 instructions have a qualified dividends and capital gain tax worksheet that walks you through it line by line based on your actual taxable income (the Schedule D instructions have the Schedule D Tax Worksheet if you have 28% rate or unrecaptured section 1250 gain).

Derek G.

Author

Qualified dividends and capital gain tax worksheet — I didn't realize that was in the Form 1040 instructions. I'll pull that and run my numbers through it.

Worth noting that worksheet also covers qualified dividends, so if any of your brokerage positions pay dividends those get folded in too. Same rate logic applies.

One thing that can backfire: if your long-term gains push your income high enough, you can trigger the net investment income tax on top of the capital gains rate. That's reported on Form 8960. The 401k contribution reduces your modified AGI, which is what Form 8960 uses, so there's a real interaction there worth modeling before you sell.

Derek G.

Author

Form 8960 — hadn't even put that on my radar. So the 401k contribution could keep me under that threshold too depending on my income level.

Form 8960 line 13 is where your modified AGI goes, and line 14 is the threshold it gets compared to. The instructions for Form 8960 have the exact threshold amounts by filing status.

I ran this exact tradeoff last year — selling appreciated long-term positions to fund living costs and maxing my 401k at the same time. I uploaded my 1099-B and my draft return to taxr.ai and had it map out how each lot sale affected Schedule D, the capital gain worksheet, and Form 8960 all together. It flagged two lots where my gain rate assumption was wrong because the holding period was just barely over a year. Saved me from a surprise on the short-term side.

Derek G.

Author

The holding period piece is exactly what I was going to gloss over. Good reminder to check each lot date before assuming everything qualifies as long-term.

Holding period: the IRS counts from the day after you acquired the shares, and the day you sell counts as part of the holding period. For exchange-traded securities it's trade date to trade date, not settlement date. So if you're right on the edge of that one-year mark, verify the actual trade dates before you decide which lots to sell.

Cost basis method matters a lot here too. If your broker lets you do specific identification, you can cherry-pick the lots with the highest basis to minimize the gain on the sale. That reduces how much taxable gain lands on Schedule D compared to FIFO, which defaults to your oldest lots first and those often have the most embedded gain.

Derek G.

Author

Specific identification — I think my broker supports that. I should confirm before I sell anything so I can choose the right lots.

Confirm it in writing before the sale, not after. Some brokers require you to designate the lot at the time of the trade. After the fact they may not let you change it.

The 1099-B your broker sends in January will show your proceeds and what basis they reported to the IRS. For covered securities the basis is in box 1e and whether it was reported to the IRS is flagged in box 12. If the basis on the 1099-B is wrong you enter code B in column (f) on Form 8949; with box A or D checked you keep the 1099-B basis in column (e) and correct it with an adjustment in column (g), while with box B or E checked you enter the correct basis in column (e) and -0- in column (g). Keep your trade confirmations so you have something to back up any correction.

Don't forget state taxes. Long-term capital gains get favorable federal treatment but several states tax them as ordinary income. Depending on where you live that could swing the math enough to change whether the sell-and-max strategy beats just reducing 401k contributions and spending from cash flow instead.

Derek G.

Author

Good point. My state does tax capital gains as ordinary income so I need to factor that in. The federal analysis isn't the whole picture.

If any of the positions you're thinking of selling are in a loss, check the wash sale rule before you do anything. If you sell at a loss and then buy a substantially identical security within 30 days before or after, the loss is disallowed and gets added to the cost basis of the new shares instead. The disallowed amount shows up in Form 1099-B box 1g if the shares were covered securities with the same CUSIP bought in the same account.

Form 1099-B box 1g — this caught me once when I was rebalancing and sold something at a loss right before an automatic dividend reinvestment bought more of the same fund. The loss just disappeared.

Dividend reinvestment is a classic wash sale trap. If you're selling a losing position, consider suspending DRIP on that fund for the 30-day window on both sides of the sale.

I'm in a similar situation and was second-guessing whether my 401k contributions were actually reducing my taxable income the way I thought on paper. I uploaded my W-2 and my brokerage statements to Taxr and it walked through how my box 12 contributions flowed into the AGI calculation and then how my capital gain worksheet shifted based on different sale scenarios. Made the tradeoff a lot clearer than staring at the forms myself.

Derek G.

Author

W-2 box 12 into AGI and then the capital gain worksheet — that's the chain I was missing a clear picture of. Useful to see it laid out.

Something to model: if your taxable income after deductions and after the 401k reduction puts your long-term gains in the zero percent bracket, selling appreciated stock is essentially free from a federal standpoint. That's a real scenario for some income levels, not just a theoretical one. The qualified dividends and capital gain tax worksheet in the Form 1040 instructions is the place to test whether you land there.

Zero percent long-term rate is real. I hit it one year during a gap in employment. The worksheet makes it clear where the line falls for your filing status.

Derek G.

Author

Zero percent bracket — now I really want to run the worksheet. If I'm anywhere near that threshold the strategy basically pays for itself.

The primary source for holding period rules and wash sales is Publication 550 on the IRS site, which goes through both in detail. Topic 409 covers the capital gain rates and the Schedule D mechanics. Those two together answer most of the questions in this thread.

I went through this decision a couple of years ago and ended up needing to compare several sale scenarios against my projected AGI before I felt confident. I uploaded my prior year return and brokerage lot detail to Taxr and it built out a worksheet showing how each lot's gain would affect my Schedule D total, the capital gain worksheet, and Form 8960, and flagged which lots to sell first to stay under the NIIT threshold. Helped me sequence the sales across two tax years instead of doing it all at once.

Derek G.

Author

Splitting sales across two tax years is something I hadn't considered. If I'm close to a threshold that could matter a lot.

Spreading sales across December and January is a simple way to straddle two tax years if you're near a bracket edge or the NIIT threshold. No need for the December trades to settle before year-end — for exchange-traded securities trade date controls, not settlement date, so a December 31 trade counts in that year.

Derek G.

Author

Trade date controls — good to know. I was about to assume settlement date mattered for the year-end question.

Form 8949 is where each lot sale actually gets reported, before it flows to Schedule D. Part II is for long-term lots. Column (d) is proceeds, column (e) is basis, and the gain or loss per lot goes in column (h). Schedule D just aggregates those totals. Worth understanding both forms even if your software fills them in, so you can spot an error if the basis from your 1099-B doesn't match your records.

If this is a large enough amount of stock that the sale itself moves you into a higher income bracket, an enrolled agent or CPA who handles investment income regularly can model the multi-year sequencing more precisely than a spreadsheet. The tradeoff between a larger 401k deduction now and a higher capital gains rate now is genuinely a math problem, not just a rule-of-thumb question.

Derek G.

Author

That's fair. If the numbers get complicated enough I'll bring in an EA. Good to know what kind of professional to look for — someone who specifically handles investment income.