You can take money out of your 401k when you sever employment. It is also possible to take money out if you have a serious economic hardship.
If you sever employment by retiring, quitting or getting fired, you can withdraw money from your 401k, but you must pay income taxes on the withdrawal. In addition, if you are under age 59.5 you must pay a 10 percent penalty beyond the regular tax. However, the withdrawal can be put into an IRA with no tax consequences.
Some plans allow for a distribution because of financial hardship, such as medical bills or home foreclosure. You will have to pay income taxes on your withdrawal and an additional 10 percent penalty if you are under age 59.5.
Also, some 401k plans allow you to take out a loan against your 401k. There are usually numerous conditions that must be met and rules that must be followed before your plan will allow you to take out such a loan.