Photo source: David Goehring via Flickr

If you're like most Americans, you'll change employers a few times during your career, and will probably end up with a few 401(k) accounts from former employers.

There are four basic options when it comes to old 401(k) accounts. You can leave the account where it is, roll it into your new employer's plan, or roll the account into an IRA where you can choose your own investments. Any of these three options is perfectly acceptable, and the best one for you depends on your own investment knowledge, goals, and risk tolerance. But the fourth option -- cashing out -- should be avoided at all costs.

Why would anyone cash out a 401(k)?
There are actually a lot of reasons people decide to cash out their 401(k). A lot of people do it to pay off credit card debt, or to pay for a big expense, such as college tuition. Some people cash out to bridge the gap between ending one job and starting another. And, some people simply think, "Hey, the account isn't very big -- cashing out isn't going to hurt me in the long run."

And it happens more than you may think. According to Fidelity, one in three 401(k) participants has cashed out their plan, usually when changing jobs. The rate is actually highest (44%) among people under 30, and this is the exact group that shouldn't even think of cashing out, as we'll see in a bit.

The average balance that people in their 20s, 30s, and 40s cash out is $14,300, which may not seem like too much at first. However, the actual "cost" of cashing out might be more than you think.

Taxes and penalties can be stiff
The most obvious and immediate consequence of cashing out your 401(k) is the taxes and penalties that you'll face.

First, you'll have to pay taxes on the money you cash out, since it was originally contributed on a pretax basis (so the government never got its "cut" of that income). The actual tax rate you'll pay depends on what tax bracket you're in during the year you cash out. And don't forget state income taxes as well.

Additionally, you'll most likely have to pay a 10% penalty to the IRS for cashing out before you reach an eligible retirement age (typically 59 and a half years old).

So, as an example, let's assume you decide to cash out the average amount that I mentioned above ($14,300). If you're in the 25% federal tax bracket and pay another 5% to your state, you'll be left with just $8,580 after including the 10% penalty as well.

However, many people decide to cash out and take a lump sum, even with the knowledge of the lower payout. Still think cashing out is the best move you can make? Read on.

But there is more to consider than penalties
Even though the taxes and penalties take a big chunk of your money when you cash out, the real reason it's a bad idea is the lost opportunity from compound investment returns.

As an example, let's say that you're 30 years old and have $10,000 in your 401(k) from your last job. How much do you think that could grow to by the time you are ready to retire (we'll assume you want to retire at 65)?

Assuming 7% average annual investment gains, which is actually substantially less than the S&P 500's historical average, that $10,000 in your account could grow to more than $106,000 by the time you're 65. And if the market performs to the level it has over the past few decades, your account would be worth even more.

So, you could either have about $6,000 now, which is what would be left after taxes and penalties, or more than $106,000 later. It seems like such a no-brainer it's a wonder more people don't choose to keep their money invested.

Avoid at all costs
Having said all of that, if you are in dire circumstances (such as you need the money to avoid foreclosure on your home), and have no other way to get the money, it's nice to have an old 401(k) to fall back on.

However, if you don't absolutely need the money, cashing out is almost never a good idea. Keep your money invested for as long as you can, and you'll be very glad you did when the time comes when you really do need the money.