Normally if you sell one equity and buy another with that money, any gains or losses are reflected in your taxes at the time you do that rebalancing and you have a new cost basis on the new investment.

Moving money around inside a traditional pre-tax 401k does not get reflected in taxes in that year. But I can't believe Los Federales would just let me raise the cost basis this way and pay tax only on what happens after I shuffle the deck.

So what do they use for the basis when you start withdrawing that money? Track each dollar back to an original purchase? Treat the whole account as one meta-equity, compute an effective overall cost basis, and tax based on that and the percentage you're withdrawing? Something else?

(I did a fairly massive rebalancing before retirement, shifting to a strategy that reflected not having the salary coming in. Quicken shows the cost basis of the 401k adjusting after those moves as if it was a normal investment account. I don't believe it.)

2 Answers 2


There's no cost basis in Traditional IRA for investments, the cost basis is for contributions.

Whatever after-tax contributions you've made - that's your cost basis, and you use it to reduce the taxable income when making withdrawals. Your custodian will track that and report on 1099-R.

Otherwise, all the withdrawals from 401k are taxed as ordinary income, and the holding periods and buy/sell differences of the individual holdings don't matter.

  • Ah, right. Ordinary income, not cap gains. Sorry, confused myself.
    – keshlam
    Dec 6, 2023 at 23:41

To add to littleadv's excellent answer (+1), if you have a cost basis in your Traditional IRA/401(k) account because you made post-tax contributions, then when you make a withdrawal, the withdrawn amount is prorated between the taxable part and the nontaxable part, and so the last nontaxable cent (basis) does not leave your account until the last withdrawal when the account is zeroed out.

  • While you may think of your IRA accounts as different because they have different custodians, the IRS considers all your Traditional IRA accounts as a single IRA (invested in different accounts). Thus, even if you take a withdrawal from a specific IRA account, the proration mentioned above is based on the total taxable value and total basis (over all your Traditional IRA accounts). In short, that last nontaxable cent does not leave your account until the last Traditional IRA that you hold is zeroed out.
  • I don't recall what the corresponding rule is for Traditional 401(k) accounts if you have more than one. Many people roll over their 401(k) accounts into their IRAs upon retirement and so the issue does not arise for them.
  • 1
    I think the rules for IRA and for 401k in terms of prorata and attribution differ. For 401k there's a separate "after tax" bucket that the custodians have to track. You can withdraw after-tax contributions any time, and there's no proration in 401k. Rolling over after tax 401k into a traditional IRA creates a basis in IRA and then the prorata rules kick in on the withdrawal
    – littleadv
    Dec 7, 2023 at 23:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .