There's a good chance healthcare will end up being one of your largest expenses in retirement -- if not your largest expense. And so it's important to save for it accordingly.

You have several options in that regard. You could pad an existing IRA or 401(k) plan, or you could fund a health savings account, or HSA.

The beauty of HSAs is that they offer more tax benefits than IRAs and 401(k)s. With a traditional IRA or 401(k), your contributions go in on a pre-tax basis, but investment gains are taxed eventually, and withdrawals are subject to taxes as well. With an HSA, your contributions are made with pre-tax dollars, and gains in your account are tax-free, as well as withdrawals, provided that money is used for qualified healthcare expenses.

A doctor standing over a seated person.

Image source: Getty Images.

Recently, HSA investment consultant firm Devenir reported that HSA balances had reached $100 billion. At the same time, only 7% of HSAs had at least some of their funds invested. And that means that most HSA holders are missing out on a prime opportunity to benefit the most from their accounts.

The best way to use an HSA

HSAs are extremely flexible in that they allow savers to access funds for near-term medical bills, or carry that money forward indefinitely. In this regard, they're far more flexible than flexible spending accounts, which require savers to deplete their plan balances year after year or risk forfeiting that money.

Meanwhile, HSAs offer the same tax-free investment growth Roth account holders can benefit from. But based on the data above, it's clear that most users aren't treating their HSAs as a long-term savings and investment account. Rather, it appears as though they're using their HSAs for near-term expenses, thereby losing out on a major tax break.

Furthermore, savers who don't carry HSA funds into retirement risk falling short when it comes to healthcare spending. HealthView Services recently reported that the average healthy 65-year-old couple retiring in 2021 could spend as much as $662,156 on healthcare throughout their senior years. And so spending down HSA funds rather than investing them is a move many are likely to regret.

Now the annual contribution limits for HSAs change from year to year, as does eligibility. That's because HSA participation hinges on being enrolled in a high-deductible health insurance plan, and the criteria for that can evolve, the same way IRA and 401(k) annual contribution limits can change from one year to the next.

But someone who contributes $300 a month to an HSA over 36 years and invests that money at an average annual 8% return (which is a bit below the stock market's average) could end up with about $674,000. That covers the $662,156 per-couple projection above.

Don't enter retirement unprepared

Healthcare costs have risen exponentially over the past number of years, and they're expected to continue going up. Investing an HSA and taking advantage of tax-free gains is a great way to cover senior medical costs -- and avoid a scenario where money is perpetually tight.