At NerdWallet, we adhere to strict standards of editorial integrity to help you make decisions with confidence. Many or all of the products featured here are from our partners. Here’s how we make money.

While health savings accounts (HSAs) provide an easy way to lower your tax bill and save money for medical expenses, you can only reap the benefits if you follow certain HSA rules. It’s important to know these five limitations if you want to enjoy the tax advantages of an HSA.

1. You need a high-deductible health insurance plan to qualify.

You are eligible to have an HSA only if you are on a high-deductible health insurance plan (HDHP). The definition of a HDHP is determined each year by the IRS. For 2017, an individual plan must have an annual deductible no less than $1,300, and a family plan must have a deductible no less than $2,600 to be considered a high-deductible policy. If your plan’s deductible is too low to qualify for an HSA and you receive your health insurance through your job, consider signing up for a flexible spending account (FSA) instead.

» MORE: HSA and FSA: How to know the difference

2. An HSA can be used only for eligible medical expenses.

You can use your HSA money only for eligible medical purchases, which generally include payments for doctors or dentists, prescription medications, health insurance deductibles and most medical supplies and equipment.

Unfortunately, there are many general health-related expenses that don’t qualify. For example, you can’t use HSA money on vitamins, elective cosmetic surgery, funeral costs, teeth whitening or maternity clothes. Health insurance premiums also don’t qualify unless you meet certain criteria. If you are having trouble determining whether an expense is eligible, seek legal or tax advice before you spend the money.

If you spend your HSA money on non-qualified expenses, you have to report it on your annual tax return and pay income tax on it. On top of that, if you are under age 65, you must also pay a 20% penalty on the amount you spend.

» COMPARE: Health insurance quotes

3. You can’t make contributions past Medicare eligibility.

Once you are eligible for Medicare, which is age 65 for most Americans, you can no longer contribute to your HSA. If you already have an HSA, however, you can continue to use the money tax-free on eligible medical expenses. You do still have to pay income tax on non-qualified purchases, but you won’t be charged a penalty.

4. You can’t exceed contribution limits.

Due to the major tax benefits of an HSA, you can contribute only a limited amount to your account each year. In 2017, the limit is $3,400 for an individual and $6,750 for a family. People over age 55 are allowed to contribute $1,000 more.

5. If you want to invest your HSA, you may face steep minimum requirements.

If you don’t readily need your HSA dollars, you can help the account grow by investing in mutual funds, stocks or other investment tools. According to Matt Irvine, vice president of sales and marketing at Health Savings Administrators, a company that helps consumers invest HSAs, an HSA is an ideal investment option for medical costs and even retirement.

However, Irvine warns that the majority of HSA administrators require the accountholder to have a steep minimum amount in their HSA before they can open up an investment account. Then, some require a minimum balance to be maintained on the HSA debit account. Consumers may be better off with a firm that allows consumers to invest in mutual funds without requiring a debit bank account (or a minimum balance).

Health expenses illustration via Shutterstock.