Here's how much you should have saved by 40

Retire by 40 by giving up these habits
Retire by 40 by giving up these habits

By the time you hit 40, you could be about halfway to retirement. Are your savings where you want them to be?

Americans aged 40-49 with a 401(k) had an average balance of $103,500 as of the second quarter of 2018, according to data from Fidelity, the nation's largest retirement-plan provider. On average, individuals were contributing 8.4 percent of their paychecks while employers were matching 4.6 percent, putting the total savings rate for 40-somethings with 401(k)s at 13 percent.

While they're off to a good start, MagnifyMoney reports that the median Gen X household has only $15,780 in total savings.

In short, many Americans need to further prioritize saving, if they can: Experts say you should have at least three to six months' worth of living expenses in an emergency fund and also be on your way to saving $1 million for retirement.

Here's exactly how much should you have saved by the time you enter your 40s.

What to have saved for retirement

Fidelity recommends having the equivalent of three times your annual salary saved. That means, if you earn $50,000 per year, by your 40th birthday, you should have $150,000 socked away.

These should be funds you've allocated for the future, including anything in a retirement account such as a 401(k) or Roth IRA, plus any company matches, and can also include other amounts you have in long-term investments in index funds or with robo-advisers.

Click to enlarge

To get to that number, Fidelity recommends saving 15 percent of your annual income. Make sure to invest these funds instead of leaving them in a traditional low-interest savings account. "If you only saved money in an account that got no return, you'd have to save a lot more to reach your goal," Meghan Murphy, a VP at Fidelity, tells CNBC Make It.

And, Murphy adds, "if you want to live a lavish life in retirement, you may want to save a little bit more," but "if you're perfectly content hanging out at home in retirement, you may need to save a little bit less."

However, 15 percent is still more than many Americans can sock away — and that's okay. "It's something to work towards over time," Murphy says. "Always make sure you're getting that company match, then try to increase your savings by 1 percent annually until you reach that 15 percent."

Even if you're only able to contribute $30 per pay period, it's better than nothing.

You can also consider putting any windfalls, large or small, directly into savings, such as pay increases, bonuses or cash gifts from family members. "That's an opportunity to say 'I'm going to take this chunk of money and I'm going to put it in an IRA' or 'I'm going to take this bonus and I'm going to put it in my 401(k),'" Murphy says.

What to have saved for emergencies

Experts advise that you build up an emergency fund that could cover at least three-to-six months of living expenses.

Emergency funds can cushion the blow if you're struck by financial disaster, says best-selling author Dave Ramsey. Since something is always bound to go wrong, having money on hand will help.

"Car blows up. Transmission goes out. You bury a loved one. Grown kids move home again. Life happens, so be ready," Ramsey writes in "The Total Money Makeover." "This is not a surprise."

Suze Orman, personal finance expert and best-selling author of "Women & Money," agrees, though she recommends being even more prepared. "You need as much money in the bank that makes you feel secure," she says. "Don't go fooling yourself, 'It's okay, I can charge on a credit card, I can do this.' You should have at least eight months. Not six months, not three months. I'd like to see you have eight months to one year."

David Bach: Don't expect to retire at 70
David Bach: Don't expect to retire at 70

How to get started saving

If you're in your 20s or 30s, you still have decades to save for retirement. "The younger you are, the more time you have to make up for lost time," Murphy says.

While it's advantageous to start early, if you're nearing 40 and only have a paltry amount put away, don't panic. At this point, "the best thing you can do is to set a goal," Murphy says. "It may not be, 'I'll have three times my income by the time I'm 40,' but maybe it's 'I'm going to do what I need to do to have twice my income.' Sometimes that is a matter of making a few changes to how you spend your paycheck."

If you aren't sure the best way for you to catch up, don't be afraid to ask an expert. "There is a wealth of knowledge available through employers, through financial experts, checklists and simple ways to help people start thinking about it," Murphy says.

Saving, and saving for the future especially, can feel like making a dentist appointment: "It's something people don't want to think about, so they tend to put it off," Murphy explains. "But the longer you put it off, the harder it's going to be. So start early and ask lots of questions."

Like this story? Subscribe to CNBC Make It on YouTube!

Don't miss: Here's how much money you should have saved by 30

Personal finance expert David Bach's formula for becoming a millionaire
Personal finance expert David Bach's formula for becoming a millionaire