If you’re worried about medical expenses during your retirement, you’re not alone. According to the latest Retirement Confidence Survey from the Employee Benefit Research Institute, 45 percent of American workers don’t feel confident that they will have enough money to take care of their medical expenses when they retire.

The good news is that you may be able to do something on top of socking away money into your 401(k) or IRA to plan ahead for your medical bills during retirement. Let’s review what a health savings account (HSA) is and how it can help your retirement planning. (See also: How an HSA Saves You Money)

What is an HSA?

An HSA is a tax-advantaged medical savings account available only to people who are enrolled in high-deductible health plans (HDHPs). An HDHP is health insurance that has a lower monthly premium, but a high deductible. A deductible is the amount you must pay out of pocket for medical expenses before your health insurance kicks in.

An HSA helps you pay for qualified medical expenses such as doctors’ visits and prescriptions that are not reimbursed by your HDHP. The beauty of an HSA is that you can contribute to it with pretax dollars by setting aside a portion of every paycheck, allowing you to reduce your taxable income. Depending on where you set up your HSA, you may be able to invest the money in mutual funds or other investments to help the funds grow faster. Whatever money you don’t use during the year rolls over into the following year, meaning you could have a nice amount built up by the time you retire.

For your insurance plan to qualify as an HDHP — one that allows you to use an HSA — the HDHP must have a deductible of at least $1,300 for self-coverage or $2,600 for family coverage (as of May 2017). You can only use the money in the account…