A 401(k) is a valuable asset for building your retirement savings, but it can also cost you if you're not careful. The IRS has strict rules about when you can take money out of your account, and violating them can lead to costly penalties.

Losing money due to early withdrawals is known as 401(k) leakage. According to the most recent data from the Employee Benefit Research Institute (EBRI), it cost Americans $92.4 billion in 2015. But a lot of this is avoidable with the right strategy.

Stressed person looking at smartphone.

Image source: Getty Images.

How does 401(k) leakage happen?

401(k) leakage is often, though not always, the result of the account holder's choices. Perhaps they need the money for a hardship withdrawal or they cash out their 401(k) when quitting a job to avoid leaving it behind. Both of these things will trigger income taxes on the withdrawal plus a 10% penalty if you're under 59 1/2.

Leakage can also happen because employers cash out former employees' 401(k)s and send them a check. Companies can only do this if you have less than $1,000 in your account. They can also roll your money into an IRA if your balance is less than $7,000. (This limit was for plans with $5,000 or less in prior years.)

If your employer cashes out your account -- even if it's against your wishes -- you'll still be receiving your 401(k) funds and could pay taxes and penalties. You're also setting yourself back because your savings can no longer grow like it would have if you'd kept the money invested.

The EBRI estimates that if workers' 401(k)s were automatically transferred to their new 401(k)s or IRAs in their name, it could increase Americans' retirement balances by close to $2 billion over 40 years. Six of the country's leading 401(k) providers -- Alight Solutions, Empower, Fidelity Investments, Principal, TIAA, and Vanguard -- have teamed up in recent years to enable employees to automatically transfer 401(k) funds between their networks, but this won't be an option for all Americans.

How can you prevent 401(k) leakage?

There are two main types of 401(k) leakage, and it helps to have a strategy for both. The first type occurs while you're still an employee with the company that houses your 401(k). This includes 401(k) loans and hardship withdrawals you make.

This type of leakage might be necessary in some cases when you genuinely have nowhere else to turn for financial support. But it's best to explore all of your options before doing this. If you have extra cash in a savings account or you qualify for a reasonable rate on a personal loan, these might be better options for you than risking the taxes, early-withdrawal penalties, and loss of future earnings that come with making a 401(k) withdrawal.

The other type of 401(k) leakage happens if you or your employer cash out your account when you leave the job. If your balance is greater than $1,000, you won't have to worry about this. But if you have a small balance, it's important to take prompt action to ensure your employer doesn't close your account without your consent.

Set up an IRA and transfer the funds yourself before your employer gets a chance to. It's possible to cash out your old 401(k) for a check and then deposit the funds yourself, though this isn't recommended.

For one reason, you only have 60 days to make the deposit, or the balance will be considered a distribution and taxed accordingly. For another, your 401(k) administrator will withhold 20% of your withdrawal for taxes, but you'll still need to deposit the full balance in your new account to avoid penalties. So you'll need an extra source of cash on hand to do this.

It's much better to do a direct 401(k) rollover. In this case, you'll open an IRA in your name. Then, you inform your 401(k) provider where you'd like the funds sent and it will handle the transfer for you. The only thing you'll have to worry about is paying a one-time transfer fee, which comes automatically out of your account. You won't owe taxes on these funds that year unless you're doing a 401(k) to Roth IRA conversion.

If you have any questions about the rollover process or other rules associated with your 401(k), it's best to reach out to your plan administrator for clarification before you make any moves. If you're forced to withdraw money from your 401(k) early, be sure to rethink your retirement strategy so you know how much you must save going forward to meet your goals.