Saving for retirement requires foresight and discipline, and it can be hard to avoid the temptation of tapping into retirement accounts like IRAs when a mid-career financial emergency comes up. Fortunately or unfortunately, you always have the right to cash in your IRA, but there are different consequences depending on the type of IRA you have, your age, and the reason for taking out the money.

We have answers to lots of your IRA questions at our IRA Center. Here, we'll look specifically at the consequences of cashing in those investment vehicles.

Paying tax on IRA distributions
You'll always pay tax on money you withdraw from a traditional IRA, regardless of your age or the reason for taking money out. This is because you received an up-front deduction for the initial contributions you made to your IRA, and so taxing withdrawals is how the IRS balances things out.

With a Roth IRA, things get more complicated. If you withdraw money after turning 59 1/2 and at least five years after opening your first Roth IRA, then withdrawals will be tax-free. However, if you take money out before age 59 1/2 or before five years have passed since opening a Roth, then the portion of your withdrawal that corresponds to earnings will be subject to income tax unless you use the money for first home purchase up to $10,000 or on account of suffering a disability. The part of your withdrawal that represents your initial contribution is not taxed.

Paying penalties on IRA distributions
In addition to the tax consequences, the IRS imposes a 10% penalty on most withdrawals from IRAs before turning 59 1/2. This gives you an incentive to keep money in the account until retirement.

There are some exceptions, though. In addition to the first-home and disability provisions above, withdrawals for education expenses or medical expenses above 10% of your adjusted gross income. You can also take a series of substantially equal periodic payments and avoid penalties.

Finally, Roth IRA withdrawals are only subject to penalties to the extent that they consist of earnings. You're allowed to withdraw the amounts you initially contributed without penalty.

Be smart
Even though you can cash in your IRA, doing so early is usually a poor move. Not only do you potentially incur tax liability and additional penalties, but also you miss out on any future tax-deferred or tax-free growth that your IRA can provide.

Sometimes, you can't help but tap an IRA for dire financial needs. Nevertheless, it's important to think twice before you take money out of a retirement account. The consequences are far-reaching and can dramatically affect your financial security down the road.

This article is part of The Motley Fool's Knowledge Center, which was created based on the collected wisdom of a fantastic community of investors. We'd love to hear your questions, thoughts, and opinions on the Knowledge Center in general or this page in particular. Your input will help us help the world invest, better! Email us at knowledgecenter@fool.com. Thanks -- and Fool on!

Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.