No advisor is ever going to tell you that raiding your 401(k) retirement account early is a good idea—you’ll have to pay penalties and taxes and you’re withdrawing money that’s specifically intended for your post-work life (and missing out on potential compound returns, too). But life happens. Here’s what to consider if you’re thinking about tapping your 401(k) plan.

Why is raiding your 401(k) a bad idea?

First, let’s explore the reason you have a 401(k) in the first place. Employer-sponsored 401(k) plans are among the best ways to jumpstart your financial future because they allow you to invest for retirement with before-tax dollars, which means you are not paying your normal tax rate on the money that you are socking away. Nor will you be paying tax on the gains your account makes as your investment grows over time. (Spoiler alert: You will eventually pay taxes when you cash out your account, but likely at a reduced tax rate.) Finally, many employers offer a “matching option” to encourage participation in 401(k) accounts, which means that they will match a percentage of the contributions you make—essentially free money.

But a 401(k) account is intended to help you ensure you have money in retirement. In exchange for those tax benefits, the understanding is that you will leave your money alone until you’re at least 59 ½. Tapping your 401(k) account before then can cost you. Here’s what will happen if you take those funds from your 401(k):

  • You will owe a penalty. Yep, the IRS will lop 10 percent right off the top.

  • You have to pay taxes on the money. While we can’t predict the future and your eventual tax rate once you eventually turn 59 ½, it’s reasonable to assume that it is likely to be less than it is now during your peak earning years.

  • You will be giving up the gains you otherwise would realize through “compounding.”

Can you cash out your 401(k) any time you want?

But just because you shouldn’t do it, does that mean you can’t? It’s important to know that you actually can’t cash out the 401(k) you hold with your current employer anyway—unless you qualify for what’s known as “hardship” provisions. Here are the hardships that the IRS specifies that could allow you to get your hands on the funds in your current 401(k) early:

  • Medical expenses for you or a qualified dependent

  • Funeral expenses for you or a qualified dependent

  • College tuition or room and board for you or a qualified dependent

  • A down payment for a house

  • Funds to prevent foreclosure of or eviction from your primary residence

  • Funds needed to fix damage to your primarily residence

Not all plans allow for hardship withdrawals, though, so you’ll want to check with your HR department. And you can’t take out more than you need for the immediate need.

Also, note that those hardships above don’t exempt you from the penalties we’ve discussed; they just make it possible for you to access your current funds. There are, however, a few situations under which you can cash out your 401(k) without facing a penalty. These include:

  • A complete and permanent disability

  • Medical expenses that exceed 10% of your gross income

  • A court-approved order to give funds to your divorced spouse, child or dependent

  • Qualified military reservists called to active duty for 180 days or more

  • Leaving, or being fired by, your employer at age 55 or over

Borrowing from the Bank Of You

Although you can’t cash out your current 401(k) except in these narrowly defined “hardship” situations, your plan may allow you to take a loan, so check with your HR department if you believe you have an important need. Even if you are allowed by your company, the IRS has limits—$10,000 or half of your vested account balance, whichever is greater, but not more than $50,000.

But this is now a loan, which means you have to pay it back or face consequences. Your plan will let you know the payment schedule and the interest rate—but it’s often similar to a bank loan, with the added bonus that the interest goes back to you. Keep in mind, though, that if you leave your job, you will have to repay the loan fully or face income taxes and a 10-percent penalty.

What if I leave my job and need to use some of the money?

Leaving your job is the one time you can “cash out” your entire 401(k) for any old reason. And as you’re packing up your pictures of your dog, your snack stash and your favorite coffee mug, you might be tempted to take the funds in your 401(k) with you, too. But because of those penalties we mentioned, that’s almost always a bad idea.

However, there are times that you might consider dipping into your retirement savings. Here are some guidelines on what might be an acceptable situation for cashing out your 401(k):

When you have high-interest loans

If you’re crumbling under credit card debt or student loans with a sky-high interest rate, it might make sense to pay them off and stop the compounding interest (the bad kind…yes, it works in reverse when you are accruing interest that you are paying rather than earning.) But do the math to figure out what your tax penalty would be and if it’s less than the interest that is piling up. And note that there are likely other, better options—for example, transferring your balance to a lower-rate card, consolidating student loans to a better rate or asking your loan servicer if they can reduce the interest rate.

You also might look into nabbing a job with a company that might help with the student loan problem; some companies now offer contributions to help employees pay down their student loans—and a select few hyper-generous employers are helping employees both pay down their student loans and contribute to their 401(k) plan. So make sure you check with your HR department to ensure you are taking full advantage of all the benefits on offer.

When you are facing bankruptcy

If your debt has accumulated to the point where your only option appears to be bankruptcy, you might be better off tapping some of your retirement account to pay off your debts. That’s because a bankruptcy can sit on your credit report for up to 10 years, making it hard to borrow money for a mortgage or other loan. But consider other options first like consolidating loans or negotiating with creditors.

Leave your 401(k) where it is

It may be tempting to touch that money when your financial needs are so great. But there are usually better ways to address your needs besides tapping your 401(k) account. Ultimately, current you (who has to pay a penalty and taxes) and future you (who will be facing a bleak retirement) will likely be happier if you leave it alone. It’s usually smarter to try and keep your 401(k) account out of sight and out of mind…except to give yourself a pat on the back when you check the balance every now and then.

Investing involves risk including loss of principal. This article contains the current opinions of the author, but not necessarily those of Acorns. Such opinions are subject to change without notice. This article has been distributed for educational purposes only and should not be considered as investment advice or a recommendation of any particular security, strategy or investment product. Information contained herein has been obtained from sources believed to be reliable, but not guaranteed. Acorns does not provide legal or tax advice. Please consult your tax and/or legal counsel for specific tax or legal questions and concerns.