401k loan pretax vs post tax allocation

When you take out a 401k loan and have Roth contributions, do 100% of the loan proceeds need to come from the Roth 401k or can some of the loan come from vested matching contributions?

Can loan proceeds only be taken from contributions or can they also be taken from vested matching contributions? If you have 84% after tax and 16% pretax contributions, is that how it’s supposed to be allocated or is it supposed to be allocated based on total pretax including matching 64% and Roth 36%.

In other words, how is the prorata work for pretax and Roth?

Only vested money can be borrowed from your 401k.
That would be:

  • your contributions.
  • earnings on your contributions.
  • vested employer match.
  • vested earnings from the employer match.

Pro Rata rules apply to distributions from a 401k plan containing a Roth component.

See item 4 here: Retirement Plans FAQs regarding Loans | Internal Revenue Service

Of course each plan may have other unique requirements for loans so read your plan description.