Money in the accounts can be used for current health and medical expenses, or invested for care in the future. According to Fidelity Investments, a couple who are 65 years old and retiring in 2018 may need about $280,000 to cover health costs in retirement, and funding an H.S.A. can help with that burden.

But most H.S.A. holders don’t appear to be saving for the long term, according to findings from the Employee Benefit Research Institute, which analyzed a database of about six million accounts. Most account holders, the institute reported in October, appear to be using H.S.A.s as “specialized checking accounts,” not investment accounts.

People generally use the money to cover current costs, like deductibles and co-payments, rather than contributing as much as possible and investing for the future. Over all, two-thirds of account holders withdrew funds — an average of $1,725 — in 2017. Just 5 percent of account holders had investments other than cash.

That may be because most people simply can’t afford to pay for health care out of pocket and need the cash in the accounts for medical bills, said Paul Fronstin, director of the institute’s health research and education program. Or, he said, it could be that people still think of H.S.A.s as flexible health spending accounts, a different sort of workplace account with fewer perks. Unlike those accounts, H.S.A.s are portable, so you can take yours with you if you change jobs.

Over time, however, H.S.A. holders appear to become more comfortable with investing. In 2017, for instance, 10 percent of accounts that had been opened a decade earlier had investments other than cash, compared with just 2 percent of those opened in 2017, the institute found.