If you lose your job, you have to repay the loan in full, usually within 90 days, or that loan is treated like a distribution and subject to income tax and a 10 percent withdrawal penalty (assuming you're under age 59 1/2).
Plus, it's vital that you keep saving for retirement -- so you need to be able to afford the 401(k) loan repayment and some level of 401(k) contribution (at the very least, you want to take full advantage of your company's match). By all means you want to get out of credit card trouble, but you don't want to create another problem by neglecting to build assets for retirement. Caution: Some plans will not allow you to contribute while you have an outstanding loan. Check with your plan administrator.
Out of Control?
There's another issue to consider: Is your credit card burden the result of out-of-control spending? Or is it the result of hard times or unexpected expenses? If you're in the habit of spending too much, simply paying off the current balances on your cards may not help you long term (you could easily rack up another bill). But if you've had, say, unexpected medical bills or needed a costly repair to your home -- if this burden is truly unusual -- then the 401(k) loan might give you some relief. (And if you're considering bankruptcy, definitely do not consider a 401(k) loan. Creditors can't touch your retirement accounts under federal law.)
In other words, taking out a 401(k) loan is not a decision to be made lightly. Be sure to consider your alternatives before you go down that route. For example: If you have a home equity line of credit, use that to pay off your credit card balances (you'll get a much lower rate). Or consider a balance transfer offer from another card issuer to consolidate your high interest debt onto another lower-rate card (lots of them have extremely low teaser rates -- sometimes 0 percent for as much as 12 months). You can even use a balance transfer offer as a lever with your existing card companies to get a lower rate. Finally -- and probably the best alternative if you can swing it -- is just to commit yourself to paying the balances down, starting with the highest rate cards first, as fast as you can (while continuing to make 401(k) contributions up to the level of your company match -- and to return to full contributions as soon as your debts are repaid). If out-of-line spending is an issue, get some help from an accredited credit counselor or financial advisor.
So while borrowing against a 401(k) account can be a viable alternative as a last resort, don't forget why these accounts were created in the first place: to help you finance your retirement. That's why it is hard to tap that money, and that's the way it should be. But if you feel your back is against the wall and the other alternatives are less than ideal, borrowing from your financial future can be done. Just understand the consequences -- and make sure it's the right solution for you.