Health Savings Accounts (HSAs) are a great way to pay for medical expenses, and since unused funds roll over from year to year, the account can also provide a source of retirement funds in addition to other plans like 401(k)s or IRAs.

But be aware HSAs can also come with significant disadvantages and less flexibility when compared to other retirement investment tools.

The Good

HSAs work best when they are used for their designed purpose: to pay for qualified medical expenses. Neither your original contributions to an HSA nor your investment earnings are taxed when used this way.

This makes HSA funds valuable, given that medical costs are one of our largest expenses as we age. The Employee Benefit Research Institute estimates the average 65-year-old couple will need $264,000 to pay for medical care over the course of their retirement. Being able to cover that amount with pre-tax dollars greatly extends the value of retirement savings.

In addition, unlike other retirement plans, there is no required distribution of funds after you reach age 70½.

The Bad

First, you can only contribute to an HSA if you have a high-deductible health insurance plan. That means you will pay more out of pocket each year when you need to use health services, which could make it difficult to build a balance within your HSA.

Second, contributions are limited. Annual contributions to HSAs are limited to $3,400 a year for individuals and $6,750 a year for families. These limits get bumped up by $1,000 for people aged 55 and older. You also may only contribute to an HSA until your retirement age.

Finally, HSAs typically have fewer investment options compared with other investment tools, including 401(k)s and IRAs. The accounts often have high management and administrative fees. All this makes building HSA earnings tough to do.

The Ugly

Before you reach age 65, non-medical withdrawals from HSAs come with a whopping 20 percent penalty, plus they are taxed as income. Even after age 65, both contributions and earnings are taxed when they are withdrawn for non-medical expenses.

In this way, HSAs compare unfavorably with 401(k)s and IRAs, which end their early withdrawal period earlier, at age 59½, and also have lower early withdrawal penalties of just 10 percent.

HSAs are a powerful tool to help manage the ever-rising costs of health care. Knowing the rules and the costs associated with using these funds outside of medical expenses can help you position an HSA with your other retirement options.