One of the best places to accumulate assets for retirement is a health savings account, or HSA. But many Americans aren't getting the message.

HSA account holders have accumulated over $51 billion in these special saving plans -- a 20.4 percent increase since last year. And the number of HSAs has grown over 11 percent, totaling 23.4 million accounts, according to the 2018 Midyear Devenir HSA Market Survey.

But the study indicates that many people who do have HSAs aren't taking advantage of the account's long-term benefits. Through the first half of 2018, total HSA contributions were about $19.8 million, while withdrawals totaled over $13.7 million. That means most people use their HSA as a pass-through and are getting only the advantage of a tax-free way to pay for out-of-pocket medical costs.

Get Breaking News Delivered to Your Inbox

The study also indicates that over 80 percent of HSA assets aren't invested in any of a wide range of available investments. Invested HSA assets total only $10 billion, less than 20 percent of the total. The average HSA balance is about $2,200, but HSAs with invested assets have an average balance of more than $16,000, or over seven times higher.

What does all this mean? Most HSA holders are missing out on these accounts' most valuable feature: tax-free growth of invested HSA assets over long periods of time.

HSAs are so valuable that most people are best served by making the maximum contribution to an HSA before saving money in another account or retirement plan (other than taking advantage of the matching contribution in their employer's 401(k) plan).

That's because the money you contribute to an HSA is tax-free on the way in, it grows tax-free in the account and it's tax-free when you take it out to pay for qualified medical costs. No other account for long-term savings allows this triple tax-free benefit.

To contribute to an HSA, you must be covered under a health insurance plan with an annual deductible of at least $1,350 for an individual and $2,700 for a family. The maximum annual HSA contribution for 2018 is $3,450 for individuals and $6,900 for a family. Anyone age 55 and older can contribute an additional $1,000.

The tax advantage is a powerful feature of HSAs. But for withdrawals from an HSA to be tax-free, the money must be used as reimbursement for qualified medical expenses you've incurred.

But you have lots of flexibility here. There are no time limits as to when money in an HSA must be used. If you had an HSA established at the time a qualifying medical expense was incurred, and you have receipts as proof that you weren't reimbursed, you can wait until many years later to take the money out of your HSA, tax-free. Also, there's no age at which you must begin taking HSA withdrawals, as there is for IRAs.

Because of these valuable features, using an HSA to accumulate savings and putting it into long-term investments allows your money to grow for use later in retirement. HSA savers should resist taking withdrawals and instead use current cash flow or other savings for current out-of-pocket medical expenses.

What if you're eligible to contribute to an HSA but don't have the cash for it? One option is to use money in an IRA that came from a 401(k) rollover. The rules allow for a one-time transfer of IRA assets to fund an HSA. The amount transferred can't exceed the annual contribution limits, and the transfer, while not taxable, is also not tax-deductible (because it's from pretax money).

If you faithfully contribute to an HSA over 20 years, you could contribute as much as $75,000 to $140,000 (single or family coverage), and over that time, investment returns could bring these accounts to double that amount, assuming an average annual 5 percent gain.

If you have money in an HSA at your death and your spouse is the named beneficiary, the spouse becomes the account owner and gets to use it.

If HSAs have any downside, it's when the beneficiary isn't your spouse. In this case, the account is fully paid out and is taxable as income to the nonspouse beneficiary.