I've been working for a long time at this point, and thankfully, I've made an effort to save for retirement throughout my career. When I was younger, I contributed to the 401(k) plan my employer sponsored at the time. I then switched over to an IRA when I became self-employed.

These days, I actually save for retirement in a solo 401(k), which is a 401(k) plan that self-employed individuals manage themselves. It offers higher contribution limits than the 401(k) plans you'll see offered at workplaces, which I like.

But I also recently started saving for retirement in a health savings account (HSA). And I sorely regret not doing so sooner.

A smiling person at a laptop.

Image source: Getty Images.

A really versatile plan

An HSA isn't strictly a retirement plan. Rather, it's a plan that allows you to set aside money for current and future healthcare needs.

What I love about HSAs is that they offer three distinct tax breaks. Not only are contributions tax-free, but investment gains are tax-free as well. Withdrawals are also tax-free when used to pay for qualifying medical expenses.

Some people will tell you that an HSA is not a retirement plan, but a healthcare savings plan. But here's the thing -- for many people, healthcare is their single largest expense once their careers wrap up.

A lot of people manage to enter retirement with a paid-off mortgage. That doesn't mean housing costs nothing in retirement. But between Medicare expenses and an uptick in health issues that age inevitably tends to produce, many seniors wind up spending more money on healthcare than any other individual expense. So it's easy to argue that having funds in an HSA is a good means of saving for retirement.

Not only that, but HSAs are extremely flexible in that once you turn 65, they effectively work the same way as a traditional 401(k) or IRA. Before age 65, there's a costly penalty for taking an HSA withdrawal for non-medical purposes. But come age 65, you can withdraw funds from an HSA for any reason without penalty.

Now in that case, a nonmedical withdrawal won't enjoy tax-free treatment. So you'll face a tax bill if you're 67 years old and you remove funds from your HSA to fix up your house, buy a car, or take a vacation. But still, it's nice to have that option.

Fund an HSA if you're eligible

HSAs may not be as well-known as IRAs and 401(k)s. And many people don't associate them with retirement. But it pays to fund an HSA if you're eligible to do so, and reserve that money for your senior years, when you may end up needing it the most.

Eligibility hinges on being enrolled in a high-deductible health insurance plan and having your plan meet other requirements. It pays to see if your plan is compatible with an HSA and start socking money away. The more time you give the funds in your HSA to grow, the more options you're apt to have once retirement rolls around.