The primary purpose of an HSA is to enjoy some tax savings in the course of saving for healthcare expenses. An HSA isn't a retirement plan in the same sense that an IRA or 401(k) plan is because you can take a withdrawal at age 25, 35, or 45 to pay for medical costs. With an IRA or 401(k), there are penalties for touching your money before age 59 1/2.

But actually, retirement is the perfect time to have access to an HSA. So if you're able to fund one of these accounts during your working years and reserve most or all of that money for retirement, you'll likely end up thankful for it. That's because you might get to enjoy these valuable benefits.

Two smiling people at a laptop.

Image source: Getty Images.

1. Tax-free withdrawals for qualified medical expenses

Healthcare costs can be a burden in retirement, especially if you happen to have a number of medical issues. That's why it can be really helpful to have access to tax-free funds to use for qualified medical expenses.

You may have money set aside in a traditional IRA or 401(k) plan that you can withdraw for any purpose, including healthcare costs. But those withdrawals will be subject to taxes, whereas HSA withdrawals for medical bills won't be.

2. No required minimum distributions

If you have your retirement savings in a Roth IRA, you won't be subject to required minimum distributions (RMDs). And beginning in 2024, Roth 401(k)s won't impose RMDs, either.

But let's say you don't have a Roth account for retirement. In that case, you'll generally be forced to remove a portion of your savings balance each year or face steep penalties. HSAs, however, don't force you to spend a portion of your balance every year. That gives you a lot more leeway with your money -- namely, to keep it invested.

3. Penalty-free withdrawals once you turn 65

If you take an HSA withdrawal for non-medical purposes, you'll generally have to pay a 20% penalty on the sum you remove. That's twice the penalty you'll face for tapping an IRA or 401(k) plan prior to age 59 1/2.

But once you turn 65, you're allowed to access your HSA funds penalty-free, no matter what. If you need to repair your roof or buy a new car, you can pull the money from your HSA without fearing a penalty.

In that case, however, you will be taxed on your withdrawal, whereas for a medical expense, you won't be. But then you're no worse off than if you took a withdrawal from a traditional IRA or 401(k) plan.

If you have an HSA now, it can be tempting to remove funds from that account to cover your near-term medical expenses. But a better bet may be to reserve that money for your senior years, when you might need it the most. If you like the idea of enjoying these HSA benefits in retirement, then do what you can to leave your HSA untouched for as long as possible.