You can borrow up to 50% of your vested 401k balance, up to $50,000. The loan term and repayment period are up to your employer's policy. You'll typically have five years to repay the loan, but if you use the loan to buy a primary home, some plans may allow you up to 15 years.