Four in 10 American adults wouldn’t be able to cover an unexpected $400 expense with cash, savings or a credit-card charge that could be quickly paid off, a new Federal Reserve survey finds.

About 27 percent of people surveyed would need to borrow or sell something to pay for such a bill, and 12 percent would not be able to cover it at all, according to the Fed’s 2018 report on the economic well-being of households, which was released Thursday.

The share that could cover such an expense more easily has been climbing steadily and now stands at 61 percent, up from just half when the Fed started this annual survey in 2013. Still, the finding underlines the fact that many Americans remain on the edge financially even as this economic expansion is approaching record length and people have become more optimistic.

Household finances over all have shown a marked improvement over the life of this report, thanks in large part to an improving labor market that has lifted wages and left more Americans with jobs. Three-quarters of adults said they were “doing O.K.” or “living comfortably” when asked about their economic well-being, up from 63 percent in 2013.