There's a good reason taking money out of a 401k is tricky: that money is meant for retirement. The tax breaks workers get for contributing to a 401k are to encourage them to save for their golden years. Nevertheless, borrowing from your 401k can be a good option under certain circumstances, if your plan allows it. Check with your employer to find out whether borrowing from your 401k is a possibility.
Although you'll miss out on the return your money could be earning while in the account, a loan from your 401k can make sense if you want to buy a house or find yourself in financial difficulty without other sources of funds. Unlike hardship withdrawals, loans can be made for any reason. These loans usually come with favorable interest rates compared to other types of loans. You effectively pay the interest to yourself because it goes back into your account. Another plus is that the loan doesn't show up on your credit report, so it won't affect your credit score.
You can usually borrow up to half of your vested balance or $50,000, whichever is less. In many respects, a 401k loan behaves like any other; you pay a fixed amount each month -- taken out of your paycheck -- until the loan is paid off, with a fixed interest rate, usually prime plus 1 percent. Loans must be repaid within five years. The loan term can be longer if you're using the money to buy a primary residence. If you leave your employer before the end of the loan, you'll have to pay the balance immediately or it will be treated as a withdrawal subject to taxes and a 10 percent early-withdrawal penalty.