Almost four out of 10 Americans are living on the edge of financial ruin, given rainy-day funds that either match or are lower than their credit card debt.

About 24 percent have more credit card debt than emergency savings, while another 13 percent have neither credit card debt nor emergency savings, a new survey from Bankrate.com found.

While Americans have never been particularly great savers, at least in recent decades, many workers are finding it harder than ever to sock away money for emergencies. That's because wages have been stagnant or falling for most. The country's lowest-paid workers are the only segment to see a significant pay gain last year, thanks to minimum wage hikes.

Get Breaking News Delivered to Your Inbox

"People don't have enough money for unplanned expenses, and if they have more credit card debt than emergency savings, it's a double whammy," said Bankrate chief financial analyst Greg McBride. "In the event of unplanned expenses, their options are limited."

People between the ages of 30 to 49 were in the worst shape, which is likely due to the financial stresses of that age group, such as saving or paying for their children's tuition and paying for higher expenses such as mortgages and child care.

Nevertheless, more Americans are in better shape this year than in 2014, the survey found. About 58 percent of workers have more emergency savings than credit card debt, compared with 51 percent last year.

About one-quarter of Americans also say they feel more secure in their jobs and are feeling better overall about their debt loads than at any time since June 2013.

One tip to boosting savings is to sock away money at the start of the month, rather than waiting to see what's left over by the time it comes to an end, said McBride. The rule of thumb among financial planners is to have three to six months of expenses set aside.

The savings rate for Americans has been steadily falling since the 1980s, when it stood at about 10 percent to 12 percent of their incomes. In recent years, it has dipped to less than half of that. In December, it was only 4.9 percent.