Health savings accounts offer a rare, triple-tax benefit to those who are able to contribute and who qualify to save for future medical needs — which, among other things, means having a health insurance plan with a deductible of at least $1,300. Money goes into an HSA tax-free, grows tax-free and is withdrawn tax-free, if spent on eligible medical costs.

Yet some people find it difficult to commit to building up an HSA to save for health needs. At the end of last year, there were nearly 17 million accounts with balances totaling more than $30 billion, according to the HSA tracking firm Devenir. But most of the money sits in savings accounts, paying anemic interest rates; just 14 percent of the total was in investment accounts with more growth potential (and, of course, the possibility of loss).

HSAs have been around for more than 10 years, but many still confuse them with workplace flexible spending accounts, or FSAs, another tax-favored saving tool. FSAs are available only through employers. Workers can't take the money with them if they change jobs, and they can't invest the funds; the accounts are meant to be spent on current costs, and in some cases the funds are forfeited if they aren't spent by an annual deadline.

Some savers may not have the minimum balance needed to invest, or may need money now to pay for care; some may not like the investment options their HSA offers. But it's frustrating that many people aren't using the accounts to their full potential, said Laura Scharr-Bykowsky, a financial planner in Columbia, S.C.

"That money will never be taxed," she said. "Why wouldn't you want to max out that gift the IRS has given you?

The reasons are likely to include not only a lack of understanding about how the accounts work but also mental or emotional stumbling blocks. While saving for "retirement" in a 401(k) or an individual retirement account may evoke pleasant images of travel, hobbies and time spent with grandchildren, saving for medical costs might inspire a sense of dread, said Michael Herndon, vice president of financial resilience with AARP.

Marty Martin, a psychologist in Chicago who counsels clients of the Planning Center, a financial planning firm, said one factor in saving for the future was "hyperbolic discounting" — the tendency to favor smaller rewards now over potentially larger rewards in the future. "They'd rather spend money on what's here today," he said.

An individual's "perceived vulnerability," or perception of risk, comes into play, too: "You're less likely to save for something that you think won't happen," he said. Often, it's not until people have a health scare themselves, he said, or see a family member have one, that the possibility of future health costs hits home.

The uncertainty of just how much people may need to spend is another barrier.

"People don't feel like they can predict their health care needs," said Eric Dowley, of the HSA business at Fidelity.

Fidelity attempts each year to project health care costs in retirement, and the estimate can be daunting. Fidelity's latest estimate is that an average heterosexual couple retiring in 2015 at age 65 will need $245,000 to cover health costs in retirement, if they have health coverage under traditional Medicare. (The estimate assumes the man lives to age 85 and the woman to age 87; it doesn't include dental services or long-term care.) Other estimates of health costs in retirement are even higher.

To help consumers get an idea of how much they should target for savings long-term, financial advisers suggest two online calculators, the AARP health care costs calculator, prepared with OptumHealth Financial Services, and "Living to 100," a life expectancy tool.

A health savings account is available to employees and independent workers, and the money follows workers from one job to another. There's no "use it or lose it" deadline with an HSA and, while the money can be spent on current costs, it also may be saved for long-term expenses because it rolls over each year, an aspect that financial planners prefer.

However, only people with specific kinds of health insurance can contribute to an HSA. The accounts must be paired with health plans that meet strict criteria, including a high deductible (at least $1,300 for an individual and $2,600 for a family, in 2016), and an out-of-pocket maximum of no more than $6,550 for an individual and $13,100 for a family.

Limits on annual contributions to health savings accounts are relatively low. For 2016, the maximum contribution is $3,350 for an individual and $6,750 for a family. (People age 55 or older can add an extra $1,000 as a catch-up contribution.)

If HSA money is spent on nonhealth care needs before you turn 65, you'll pay a 20 percent penalty on the funds spent, in addition to regular income tax. But after age 65, the penalty goes away, and funds, then taxable, can be spent on nonhealth needs.

"If you look at estimates of retirement health care costs as being in the quarter-million-dollar range, it's hard to think you could oversave for that," said David Armes, a financial planner specialized in health care in Long Beach, Calif.

Freelance writer Ann Carrns covers personal finance for the New York Times.