If you're eligible to contribute to a health savings account, you have a solid opportunity to sock away funds to cover medical care in retirement. Health savings accounts, or HSAs, allow you to contribute money in a tax-free fashion to cover eligible healthcare expenses. You're allowed to use that money as you need it to pay for things like doctor visits, prescriptions, and medical equipment. Whatever money you don't use right away, however, can be invested for added growth.

Here's why that's important: When you invest money in a traditional brokerage account, you're liable for taxes on whatever gains your investments produce. When you invest money in an HSA, your gains are tax-free. In fact, you won't pay any taxes on the money you put into an HSA, including withdrawals from that account, provided you use those funds for eligible medical expenses.

Doctor taking blood pressure of male adult.

IMAGE SOURCE: GETTY IMAGES.

Not everyone is allowed to contribute to an HSA. To qualify, you'll need to be on a high-deductible health insurance plan, defined as $1,350 or more if you have coverage only for yourself or $2,700 or more if you have family coverage. You also must have an annual out-of-pocket maximum of $6,750 as an individual or $13,500 as a family.

Many people who are eligible to fund an HSA opt not to do so, either because they don't have the money or don't understand how these plans work. Just as problematically, many people who are saving in an HSA aren't making the most of it.

HSAs: A valuable retirement savings tool

Though HSAs are a great way to pay for immediate healthcare expenses, they offer even more value when they're used as a retirement savings tool. In fact, the point of an HSA is to contribute more money than you think you need in a given year so that you have excess funds to invest. Over time, you could accrue enough money to cover a large chunk of your healthcare expenses during retirement.

But most people who have an HSA don't use it as a long-term savings account. An estimated 65% of Americans use their HSAs for current healthcare needs only, according to consulting firm Willis Towers Watson. In fact, only 8% focus on accruing funds in their HSAs for the future. And because so many HSA participants use their accounts to pay for immediate medical needs without contributing excess funds, most people with HSAs have less than $5,000 saved in those accounts.

If you've been neglecting the opportunity to put extra money into your HSA, it's time to rethink that strategy. Currently, you can contribute up to $3,500 a year to an HSA for individual coverage or up to $7,000 a year for family coverage. If you're 55 or older, you get a $1,000 catch-up contribution on top of whatever previous limit you fall into.

Some employers contribute to HSAs on employees' behalf, and that money counts toward the aforementioned limits. But many employers don't come close to contributing the maximum amount allowed, and if that's the scenario you're looking at, it pays to ramp up contributions on your own end. That way, you'll benefit from the aforementioned tax-free growth on your invested HSA funds and you'll be less burdened with paying for healthcare once you're older.

It's estimated that the average healthy 65-year-old couple today will spend $387,644 on healthcare throughout retirement when we account for expenses like Medicare premiums, deductibles, and copays. If you'd rather not have to stress about covering that cost on a fixed income when you're older, aim to max out your HSA. The more money you put into your account, the less of your earnings the IRS can tax you on, so it really is a win-win.