Life has a way of throwing expensive surprises our way, whether it involves vehicles breaking down or air conditioners malfunctioning at home. When these unplanned bills pop up, the importance of savings becomes evident. That's why it's crucial to have an emergency fund for those unanticipated expenses.

Ideally, that emergency fund should contain enough money to cover anywhere from three to six months' worth of living expenses. Some people even go so far as to sock away a year's worth of bills. Either way, the point is to have a source of immediately available cash so that when the unforeseen strikes, you're not forced to resort to debt to cover those sudden expenses.

Person taking notes on pie chart

IMAGE SOURCE: GETTY IMAGES.

The problem with keeping your money locked up in a savings account, however, is that doing so will surely stunt its growth. These days, you'll be lucky to score a 1% annual interest rate on a traditional savings account, whereas if you were to invest that money in the stock market, you easily might see an average yearly return of 7% or more.

In the short term, that difference may not matter. But let's imagine you're able to save up $20,000 and you keep it in the bank over a 30-year period, all the while earning 1% interest on that sum. After three decades, that $20,000 will grow to about $27,000. Now, instead of keeping that cash in the bank, let's say you invest it and snag that 7% average annual return we just talked about. After 30 years, you'd be sitting on $152,000 -- quite the difference.

Clearly there's a lot to be lost by keeping money in the bank. It therefore begs the question: Do you really need that emergency fund if you have an investment portfolio to tap?

Protecting your principal

There are two reasons why it's smart to keep your emergency savings in the bank. First, savings accounts are easily accessible. You don't have to wait to liquidate assets to get cash, but rather, you can generally grab your money on the spot if the need arises.

The other benefit of keeping your emergency fund in the bank is that you don't risk losing principal -- provided you're not exceeding the FDIC limit. In other words, if you stick $20,000 in the bank, that sum can't go down -- it can only go up.

When you invest, on the other hand, there's always the risk that you lose out on some principal. But an even bigger risk is having to take a withdrawal at a time when the market is down.

Imagine you happen to encounter a home repair situation during a week when the market takes a major tumble. If you need to pay your contractor right away and you're forced to sell investments at a loss to get that cash immediately, that's money you'll kiss goodbye.

You might argue that taking the occasional loss is worthwhile because of the potential for higher returns. And in some scenarios, you may be right. But is that really a risk you're willing to take?

That said, having a robust investment account and no emergency fund isn't the worst situation you can put yourself in. Imagine you spend $5,000 a month, in which case your emergency fund should fall somewhere in the $15,000 to $30,000 range. If you have $5,000 in the bank but $80,000 in investments, let's face it -- you're still in pretty good shape. And if you do wind up taking a loss, not only do you have a nice cushion, but you'll probably recover at some point. But if you're sitting on $15,000 total, you're better off having that money in the bank, and then putting whatever additional funds you accumulate into an investment account.

Finally, while it's wise to have a dedicated emergency fund, you don't want to go overboard, either. There is such a thing as having too much money in cash, so once you have that safety net established, be sure to start investing the rest of your savings for better long-term returns.

The Motley Fool has a disclosure policy.