The recent federal government shutdown has underscored the importance of a basic financial planning rule: You need a rainy day fund to cover emergency expenses, such as a major home repair, medical bills, or a job loss.

But many Americans lack even a small amount of savings to help them through an emergency. As a recent report (PDF) by the Federal Reserve found, 4 in 10 adults said they wouldn't be able to cover a $400 emergency expense without having to borrow the money or sell something.

Without cash on hand to cover unexpected bills, families often end up opting for costly strategies, such as running up credit card balances. Federal workers had to turn to food banks or tap their retirement accounts, resulting in tax penalties.

Granted, setting aside those dollars in a rainy day fund is a challenge for many families. It can also be difficult to figure out how much you should to stash away. Here’s how to determine what a reasonable rainy day fund looks like for your needs, and how to build those savings over time.

How to Set Your Savings Goal

As a guideline, many financial experts recommend that individuals have an emergency fund large enough to cover three to six months of their essential expenses. That amount will typically meet most recurring bills, such as those for housing, groceries, utilities, and student loan payments, says Craig Jaffe, a certified financial planner and managing director at United Capital in Boca Raton, Fla.

More on Saving

That said, the size of your emergency fund should be geared to your financial circumstances, says Joe Pitzl, a certified financial planner in Arden Hills, Minn. For example, workers with variable incomes, perhaps from commission-based jobs, and those who work in shaky industries or who anticipate higher costs may need more than six months in savings. 

"If your car is always breaking down, or you own an old house that needs constant repairs, you need to factor those costs into your emergency fund," says Brandy Wright, a certified financial planner at Modera Wealth Management in Atlanta. (You can use an online emergency savings calculator to help estimate your essential expenses.)

Retirees, especially, may need a sizable emergency fund. If you're relying mainly on Social Security income, you should have three to six months of cash. Those tapping retirement portfolios for income may need a year's worth of cash in their 401(k) or IRA accounts. That way, you can avoid having to sell investments during a market downturn or for medical emergencies, says Wright. 

How to Get There

Once you determine your savings target, you may be daunted by the number. Relax: You don't have to come up with that amount right away. The key is to get on track toward that goal. Following these steps can help.

1. Set a timetable. Expect that it will take awhile to build a large rainy day fund—perhaps one or two years. Still, just by accumulating smaller amounts to start, you'll go a long way toward reducing your financial risk. 

"Even if you have just $500 in emergency savings, that may help you avoid taking on credit card debt for a small car repair," says Wright.

Use an online calculator, like this one, to see how much you’ll need to set aside regularly to reach your goal, and how quickly that money will grow.

Let’s say your essential living expenses come to $2,000 per month. If you can start building your emergency fund by putting away $100 a week, you’ll amass about $6,000 in a year and three months, assuming you earn 2 percent on that money. 

If it’s going to take a lot longer than that to build a sufficient emergency fund, look for ways to speed up the process, such as saving any windfalls or raises, or cutting back on discretionary expenses.

2.  Choose the best place for your cash. Stick with savings and money market accounts for your rainy day fund. "That way your cash is at least earning interest, and you can access the money without paying a penalty,” says Pitzl.

For maximum safety, keep your account at a bank or credit union, where your savings will be federally insured. You don't want to take risks with your emergency funds.

Still, you should try to earn as much as you can on your account. The highest-yielding savings rates can often be found at online banks and credit unions, which were recently paying 2 percent and more, according to

It's also important to keep your rainy day account separate from your regular checking account. "Otherwise, it will be too easy to dip into that money for discretionary spending, like a vacation," says Wright.

3. Strike a balance if you have other urgent needs. While building emergency savings should be a priority, you may have other urgent financial obligations, such as high-interest credit card debt. The average U.S. household with credit card debt has an estimated $6,929 in revolving balances, according to a recent study by NerdWallet.

With the average credit card interest rate hovering at 17.7 percent, letting that debt build could wipe out the benefit of your emergency savings. So your best strategy is to strike a balance—funneling some of your savings dollars toward paying off high-interest debt, with the rest going toward your emergency fund.

The precise amounts you earmark for these different needs will depend on the interest rate of your debt, any other debt obligations, as well as your cash flow. (For more on paying off credit card debt, see our article here.)

“The most important thing is consistency and commitment,” says Marguerita Cheng, a certified financial planner and CEO at Blue Ocean Global Wealth in Gaithersburg, Md. 

4. Automate your savings. To ensure that you really build that emergency fund, set up a direct deposit so that a set amount of money from your paycheck is sent directly into your rainy day account. That way, you don't have to remember to move it yourself each month.

If your employer won't set up separate deposits, you can arrange an automatic bank transfer from your checking account to your savings account.

This set-it-and-forget it approach reduces the temptation to spend those funds on splurges. Moreover, by not seeing that money in your checking account, you are less likely to miss it.

And if you're faced with an emergency, having those savings available to tap will be invaluable.