Image source: via Flickr.

If you take money out of a retirement account before you reach age 59 1/2, you may be subject to an early withdrawal penalty of 10%. Here's how to determine whether your withdrawal will be exempt from the penalty, and if not, how much you can expect to pay.

What types of withdrawals are subject to a penalty?
Whether you will be assessed a penalty depends on how the money you withdrew got into your account. There are three main ways money flows into retirement accounts, and two of these can be assessed a penalty if the funds are withdrawn prematurely.

  1. Pre-tax contributions: This includes money that was withheld from your paycheck for your 401(k) or other employer-sponsored plan -- unless it is a Roth account -- as well as tax-deductible contributions to a traditional IRA, SIMPLE IRA, or SEP IRA. Employer matching contributions to your retirement accounts also fall into this category. Basically, if the contribution resulted in a tax deduction, or reduced your taxable income in the year you made it, it falls into this category. Pre-tax contributions will be assessed a penalty if withdrawn too early, unless an exception applies (more on the exceptions later).
  2. After-tax contributions: Contributions to a Roth IRA, or any other Roth account such as a Roth 401(k) are made on an after-tax basis, meaning that you've already paid income taxes on the money before you put it in the account. If you had any non-deductible traditional IRA contributions, they also fall into this category. After-tax contributions can be withdrawn at any time, and for any reason, without penalty.
  3. Investment gains: Regardless of the contribution type, investment gains (profits) in a retirement account cannot be withdrawn early without penalty. For example, if you contribute $5,000 to a Roth IRA and your account is worth $6,000 thanks to strong investment performance, you can be assessed a penalty on the $1,000 profit if you withdraw it for an unqualified purpose.

To sum it up, if you received a tax benefit on the money you're withdrawing, it can be assessed a penalty. Pre-tax contributions have obvious tax benefits, and since retirement investments are allowed to grow on a tax-free or tax-deferred basis, their profits are also considered to have tax benefits.

The early withdrawal penalty and its exceptions
In general, if you make a withdrawal from your retirement accounts before you reach age 59 1/2, the IRS will assess a 10% early withdrawal penalty. As mentioned, your original after-tax contributions to Roth accounts can be withdrawn anytime, as can any non-deductible contributions to traditional IRAs.

There are exceptions to the early withdrawal penalty, including these:

  • If you are 55 or older, you can withdraw from your 401(k) or other employer-sponsored plan if you have separated from service, that is, you are no longer at your job. Note that this exception does not apply to IRAs.
  • You can withdraw up to $10,000 from an IRA to be used toward a first-time home purchase for yourself or a loved one.
  • You can withdraw any amount from an IRA at any time, if you use the money to pay for qualified higher education expenses.
  • In a 401(k) or similar plan (but not an IRA), you can withdraw money at any time, if you agree to do so in substantially equal distributions for the rest of your expected lifetime.
  • If you become totally and permanently disabled, the penalty is waived.
  • Early withdrawals are allowed to pay unreimbursed medical expenses above 10% of your adjusted gross income.

Calculating your penalty for cashing out
If all of your contributions were made on a pre-tax basis, such as with a 401(k) or traditional IRA, the calculation is easy. As long as you don't qualify for an exception, your penalty is 10% of the entire amount you withdraw early.

In a Roth account, subtract your total Roth contributions from the amount of your withdrawal. If you get a negative number, you won't have to pay a penalty, as your withdrawal will be considered a return of your original contributions. If you get a positive number, you'll have to pay an amount equal to 10% of this amount.

If you have nondeductible traditional IRA contributions
Finally, if you have non-deductible contributions to a traditional IRA (this is not too common), you need to determine the portion of your account that represents those contributions. To do this, divide the amount of non-taxable contributions you've made to the account, and divide this amount by your account's current value.

To determine the pre-tax portion of the account, subtract this number from one.

Finally, use this as a multiplier to determine the amount of your withdrawal subject to a 10% penalty.

For example, let's say that you withdraw $5,000 from your traditional IRA early. If your account is worth $50,000 and you've made $10,000 in nondeductible contributions, you can determine that the nondeductible portion is 20%, or 0.2. Subtracting from one gives a pre-tax portion of 80%, or 0.8. Finally, the penalty can be calculated using this multiplier as described in the preceding equation.

There's a lot to know about IRAs. If you're just getting started, or if you're already invested and have questions, we can help. Check out our IRA Center for more information, links to our latest IRA-related articles, and more.

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 Thanks -- and Fool on!