Money

More Americans are using this 'loophole' to save more for retirement—here's how it works

More and more Americans are using a health savings account (HSA) to supplement their retirement savings: As of January 2017, 21.8 million people had opened a HSA, a 9 percent increase in enrollment from 2016.

"It's kind of like this retirement loophole trick," certified financial planner at Betterment Nick Holeman tells CNBC Make It.

While HSAs are not intended to be used for retirement — they're designed for you to use to pay for qualifying healthcare expenses — they're a tax-friendly investment vehicle and can act as a powerful retirement-savings tool if you let your balance compound over years.

In fact, depending on your situation, some financial planners advise maximizing contributions to your HSA even before maxing out your 401(k) plan.

Here's everything you need to know about an HSA.

You have to have a high-deductible health care plan (HDHP)

The main requirement for opening an HSA is having a high-deductible health care plan (HDHP), one that has a lower premium (the amount you pay per month to have health insurance) and a higher deductible (the amount you pay upfront for your medical care before insurance kicks in).

And not all HDHPs are HSA qualified. The IRS sets certain requirements: HSA qualified HDHPs must have a minimum deductible of $1,350 for individuals, or $2,700 for families. An HDHP's total out-of-pocket expenses can't exceed $6,650 for an individual or $13,300 for a family.

HDHPs aren't for everyone, Holeman notes: "If you are on medications, have a chronic illness or if you're older — anything where you might be going to the doctor a lot — then having a high-deductible will probably be very expensive for you. Typically, it only makes sense if you're healthy and you don't use the doctor very often."

Before signing up for an HDHP, you'll want to sit down and ask yourself a few questions, says Holeman: "How often do you go to the doctor? Do you have a safety net that's large enough so that if you do need to pay the high deductible, you can pay that out of pocket without having to eat rice and beans for a month?"

If you're generally healthy, can afford to pay your deductible upfront and have the means to contribute to an HSA, an HDHP may be right for you.

There's a contribution limit

Like all tax-advantaged accounts, there's a cap on how much you can contribute each year. The HSA contribution limit for 2018 is $3,450 per year if you're single, up from $3,400 in 2017, and $6,900 per year if you have a family, up from $6,750 in 2017. But if you're 55 or older, you can make an additional $1,000 "catch up" contribution.

"It's less money that you can put into that account [than other retirement savings vehicles]," says Holeman. "So this account alone is not going to be nearly enough for you to save for your retirement, but it can be a nice addition to your normal retirement savings."

With a 401(k) plan, the contribution limit is $18,500 per year if you're under age 50 and $24,500 if you're 50 or older. For traditional and Roth IRAs, the maximum yearly contribution is $5,500, or $6,500 for people age 50 or older.

You deposit pre-tax dollars

Like an IRA or 401(k), you contribute pre-tax dollars and let that money grow tax-deferred over time. You'll pay taxes only when you withdraw the money.

If you're withdrawing the funds for qualified medical expenses, you get to take it out, tax-free.

If you withdraw early, you could incur a penalty

You can withdraw funds tax-free at any time for qualified medical expenses, but if you use the funds for non-healthcare expenses before age 65, you'll owe a 20 percent penalty.

After age 65, you can make withdrawals to cover non-medical expenses. As with an IRA, the money will be taxed as income.

Fees and investment options matter

If you're using an HSA to save for retirement, fees and investment options matter, so you'll want to shop around. "HSAs should be treated no differently from other retirement funds in terms of investing," certified financial planner Rose Swanger told CNBC's Tom Anderson.

Since your HSA is not tied to your employer like a 401(k), you can choose whatever provider you want. When shopping around, pay attention to account fees and note that some accounts will require a minimum balance.

HSASearch lets you compare more than 400 providers.

This is an update of a previously published story.

Don't miss: 1 in 3 Americans have less than $5,000 saved for retirement—here's why so many people can't save

Like this story? Subscribe to CNBC Make It on YouTube!