NEW YORK (MainStreet) — The power of compounding interest and the growth of money over time is nothing short of miraculous — if you can leave your retirement funds alone until you're 59.5. To get the most bang for your 401(k) buck, you shouldn't borrow against your funds unless it's absolutely necessary.

"A 401(k) loan should be one's very last resort, as these funds are earmarked for retirement — a goal that one can't borrow for," says Jill Williams, a certified financial planner with MetLife's Premier Client Group. "With that said, it is certainly one of the most accessible, low-cost, low-impact sources for short-term liquidity needs."

Before you even think about borrowing against your 401(k), ask yourself how secure you feel in your job. Negative tax consequences "loom large" if you can't pay your loan back within 60 days of leaving your job, Williams explains. If you're unable to pay back the loan, you'll be charged a 10% early distribution penalty and the money you withdrew will be taxed at your tax rate in the year you withdrew it.

"If you feel secure in your job, I think it can be a good source of credit compared to other options out there," she says. "There are no high interest rates, no impact to your credit report or a lengthy application process. I don't think it's a terrible idea when there's a need for short-term liquidity, but it's not the first place you should think to go."

If you do borrow against your 401(k), you must have a strict plan for repayment.

"You're effectively losing money every month because the money isn't in your account benefiting from compounding interest. There has to be a plan to repay it as quickly as possible, whether you pay it off every week or every month. Also, there's no penalty for early repayment, so you can put it back as soon as you're able," Williams says.

Just because your 401(k) plan offers loans doesn't mean you should go there every time you need money. If you're considering going down that road, here's a look at the only five remotely decent excuses for taking money out of your 401(k) before retirement.

1. Consolidating and paying off high-interest, short-term debt (such as credit cards).

It could be that you're paying more in interest on your credit cards each month than the money in your 401(k) is earning. If that's the case, one option is to pay down your high-interest rate debt using money from your retirement fund, then get on a strict re-payment plan-and a budget.

"When you're in over your head with credit card debt and you've got double-digit interest rates to pay every month, this can be difficult to overcome," Williams says. "In this case, it makes sense to consolidate your debt, get it paid off and then pay back your 401(k) over a five-year period or however long it takes you to do it. Hopefully you have enough job security to do that."

2. A medical or other emergency that requires liquidity, when there is no other source of capital.

If you or someone in your family face a medical emergency that has the potential to send you into bankruptcy, borrowing from your 401(k) to pay medical expenses may be your best option, Williams says.

"When there is no other source of capital and you're facing a crisis, it can make sense," she says. "You just have to get that money back into your account as quickly as you're able to repay it."

3. Advancing one's career with a short-term education loan for tuition.

"It's the whole 'You've got to spend money to make money' problem,'" Williams says. "If you need an MBA or another degree that's going to advance your career and lead to a higher income, then it can be a wise decision."

To take the loan without penalty, you'll need to stay employed with the employer where you have your 401(k) throughout your school years, and as along as it takes for you to pay the money back, Williams reminds.

"Again, this is an investment in your future. If your degree is going to lead to increased earning ability, then this can be a good use of your money."

4. Down payment toward a first-home purchase.

If you need money for a down payment on a first home or for building a house, your 401(k) can help pave the way, says Terry Dunne, managing director at Millennium Trust.

"This would be one of the more unusual expenditures for a qualified retirement plan, but a certain portion of it could be used for buying a house," he says. "At a certain point in your life, the home might be such a great investment that you feel can't pass it up."

As long as you know you're going to be settled in an area for while and you have "weighed the pros and cons of investing in property," using your retirement money toward a down payment on a first home can make sense, Williams says.

5. A dire situation where you are unable to afford food and/or shelter.

"I often hear people who borrow against their 401(k) say things like, 'But it's such a great rate' or 'I am paying myself back,'" says Kathleen Connelly, executive vice president at financial services firm Ascensus. "Those things tend to be true, but you are not letting the power of your money work for you. I honestly don't recommend taking money out unless you're in a dire situation where you need to be able to feed your family and keep a roof over your head."

"I would suggest that with almost anything else, you can find a different way of getting money. You can take out student loans, you can eliminate your daily Starbucks or lunches out with colleagues. These are the kinds of things you are almost certainly going to regret down the road when you see what those loans do for your overall balance," she says.

— Written by Kathryn Tuggle for MainStreet

Follow Kathryn on Twitter @KathrynTuggle.