Retirement is a scary prospect for seniors, namely because of the many unknown expenses it can bring about. And healthcare is certainly one of them.

Many seniors find that their out-of-pocket costs under Medicare ultimately come in much higher than expected, especially when we account for premiums, deductibles, copays, and the fact that a number of key health services, like dental and vision care, aren't covered. In fact, the average healthy 65-year-old couple today is likely to spend an almost alarming $387,644 on healthcare throughout retirement, according to cost-projection software provider HealthView Services.

If the idea of covering your senior living expenses, healthcare included, is causing you stress, then the solution could boil down to one important financial product: a health savings account.

Older man looking at documents


How health savings accounts work

Health savings accounts, or HSAs, allow you contribute money during your working years for immediate and future medical expenses. Any money you don't withdraw in the near term can be invested for added growth and used at a later point in time, including retirement.

HSAs are funded with pre-tax dollars, and gains on investments in an HSA are tax-free as well. Withdrawals are also tax-free, as long as they're used for qualified medical expenses.

To be eligible for an HSA, you must be enrolled in a high-deductible health insurance plan. Currently, that's defined as an individual deductible of at least $1,400, or a family deductible of $2,800 or more (keep in mind that the definition of a high deductible for HSA purposes can change from year to year).

If you qualify for an HSA, you can contribute up to $3,550 this year on your own behalf, or up to $7,100 on behalf of your family. And if you're 55 or older, you get a $1,000 catch-up contribution, similar to the catch-up provision you'll find in a 401(k) or IRA.

Now to make the most of your HSA, the key is to put in more money than you expect to need in the near term so you can invest that excess and grow it into a larger sum for retirement. Let's assume that over the next 25 years, you contribute $3,200 to your HSA annually, knowing that you only expect to need $2,000 of that for yearly medical bills. If you're able to then invest that extra $1,200 each year at an average annual 7% return (a common benchmark used for long-term investing), you'll wind up with about $76,000 in your HSA, which you can then use to cover your healthcare costs during retirement.

Of course, funding an HSA isn't the only thing you can do to make healthcare easier to manage when you're older. You can pad your IRA or 401(k) and use that money for any purpose, healthcare included. But if you're eligible to contribute to an HSA, it pays to take advantage. That way, you'll have dedicated healthcare funds to access later in life, and you'll have an easier time covering what could end up being your single greatest retirement expense.