You can access funds from your 401(k) in a few ways, if necessary, but there are costs to doing so.
If your plan allows for a loan (or perhaps up to two loans), then you can borrow from the plan up to 1/2 of your vested account balance, usually with a minimum loan amount of about $1,000. Often, the interest you pay on the loan is credited to your account, but the cost of processing the distribution and of completing the amortization may be taken from loan proceeds. This is generally not taxable, unless you do not pay it back. If you change employment without paying it back, or if you fail to pay it back for any other reason, then it will be taxable, and any penalties for early withdrawal will also be assessed.
If you are over a certain age, your plan may allow for "in-service" distributions. The age can be different for different plans, and your plan might not offer it at all. Check with your administrator to verify. Such a distribution will be taxable to you and you may not repay the plan.
The third option is a "hardship" withdrawal. The IRS has rules about what constitutes a hardship withdrawal, and they are fairly limited, but if you qualify, and if your plan allows them, the distribution will be taxable and you may be assessed the early withdrawal penalty. You may not pay it back to the plan, nor can you continue to defer to the plan for some period of time after the hardship distribution.
Each of these options could be slightly different dependent on your plan's rules, so ensure you are well aware of your specific plan before moving forward with any option.
Mr. Defrance is spot on with his thorough response. The only thing that could be added is that any loan could be limited to $50,000 or 1/2 of your vested account balance (whichever is larger). You should consider the tax impact and opportunity cost of borrowing from the 401k. Many people underestimate the true cost of withdrawing from this valuable asset.
Before even considering this option, I would of course exhaust a multitude of other potential options available. Once all else is ruled out as a source of money, then I would advise that the most efficient way to take money out from your 401k account would be as a loan. Mr. Defrance and Mr. Garcia both brought up extremely good points. You would be making regular payments based on an amortization schedule, and be paying interest. One benefit is that you would be making the interest payment to yourself. The drawbacks include taxes and penalties for failing to pay the loan back; but, in my opinion, usually the opportunity cost is the most costly. Bottom line, giving your money the time to grow in the appropriate vehicles, while compounding the growth effect along with continual deposits, is the most effective way to build up a retirement account that would have a good shot in helping you reach your financial goals in later years of life, so weigh the options very carefully before committing to diving into retirement funds. The ‘future you’ would definitely be very appreciative!