Retirement planning

HSA and Medicare: When to Stop Contributing and What Your HSA Can Pay For

How an HSA and Medicare work together: when contributions must stop, the 6-month Part A look-back, and which Medicare premiums your HSA can pay.

A woman in her 60s reviewing blank papers with a calculator at a kitchen table while her husband reads by the window

Short answer: An HSA and Medicare don't mix on the contribution side. Once you're enrolled in any part of Medicare, your health savings account (HSA) contribution limit is zero, and that includes months of retroactive Medicare coverage. Because SSA backdates Part A up to 6 months when you apply after 65, Medicare.gov says to stop HSA contributions 6 months before you retire or apply for Social Security. The money already in the account stays there until you use it, and after 65 it can pay Medicare premiums tax-free, though not Medigap premiums.

For people working past 65, this is one of the easiest retirement details to get wrong, because the timing of three decisions (when you retire, when you claim Social Security and when you sign up for Medicare) all affects your HSA.

FinancialAdviser.com is not connected with or endorsed by the U.S. government or the federal Medicare program, and we don't sell Medicare plans. This guide is general education, not tax or coverage advice for your situation.

How Do an HSA and Medicare Work Together?

An HSA has two sides: putting money in and taking money out. Medicare affects them differently.

Before Medicare After you enroll in Medicare
New contributions Allowed if you're covered by a qualifying high-deductible health plan (HDHP) and meet the other IRS rules Not allowed: your limit is zero starting with the first month you're enrolled
Money already in the account Stays in the account until you use it Stays in the account until you use it
Paying Medicare premiums Not applicable Allowed once you're 65 or older (Medigap premiums excluded)
Withdrawals for non-medical costs Taxable, plus an additional 20% tax Taxable, but no additional 20% tax after you reach 65

IRS Publication 969 lists "You aren't enrolled in Medicare" as one of the requirements to contribute to an HSA. It also says that beginning with the first month you're enrolled in Medicare, your contribution limit is zero.

Can You Contribute to an HSA After 65?

The IRS ties HSA contributions to Medicare enrollment rather than to a birthday: Publication 969 lists not being enrolled in Medicare among the requirements to contribute. If you're 65 or older, still covered by a qualifying HDHP (for example, through your job) and not enrolled in Medicare, the Medicare rule doesn't stop your contributions, though the other eligibility requirements still apply.

The catch is that enrollment can happen automatically. SSA says that if you're age 65 or older and receive Social Security benefits, you'll be automatically enrolled in Part A. So if you start Social Security while you're still contributing to an HSA, your contributions have to stop too.

Medicare.gov says that if you don't have to pay a premium for Part A, you can choose to sign up when you turn 65 or anytime later. If you want to keep contributing while working past 65, that choice matters, because enrolling in Part A ends your contributions. Before you decide, check with your employer's benefits office how its plan works with Medicare, and read our guide to who qualifies for Medicare and when to sign up.

2027 limits, if you're still eligible: Rev. Proc. 2026-24 sets the 2027 HSA contribution limits at $4,500 for self-only coverage and $9,000 for family coverage. IRS Publication 969 adds a $1,000 catch-up contribution if you're 55 or older at the end of the tax year. Our guide to 2027 HSA contribution limits covers the HDHP rules and employer contributions.

What Is the HSA 6-Month Rule for Medicare?

The "6-month rule" isn't a separate law. It's the result of two rules working together:

  1. Part A can start before you apply. SSA says Part A coverage begins up to 6 months before the month you apply if you're over 65.
  2. Retroactive months count. IRS Publication 969 says the zero-contribution rule applies to periods of retroactive Medicare coverage too.

So if you apply for Medicare (or for Social Security, which brings Part A with it) after 65, some of the HSA contributions you made in the months before you applied could land in months when you're treated as enrolled. Medicare.gov's guidance for people working past 65 is that you and your employer should stop contributing to your HSA 6 months before you retire or apply for benefits from Social Security (or the Railroad Retirement Board), to avoid a tax penalty. SSA says contributing to an HSA after your Medicare coverage begins may result in additional taxes.

A simple way to plan it: pick the month you expect to apply for Medicare or Social Security, count back 6 months, and make that the last month of HSA contributions, including any your employer makes through payroll.

How Much Can You Contribute in the Year You Enroll?

You can contribute only for the months before Medicare starts. IRS Publication 969 gives this example: you turned 65 in July 2025 and enrolled in Medicare, and you had self-only HDHP coverage. Your contribution limit for 2025 is $2,650, which is $5,300 (the $4,300 self-only limit plus the $1,000 catch-up) × 6 ÷ 12.

If you also had retroactive Part A months, those months come out of the count as well.

Can You Use HSA Money to Pay Medicare Premiums?

Yes, after you turn 65, with one big exception. IRS Publication 969 says you generally can't use HSA money to pay insurance premiums, then lists the exceptions:

  • Long-term care insurance (subject to limits)
  • Health care continuation coverage, such as COBRA
  • Health care coverage while you're receiving unemployment compensation
  • Medicare and other health care coverage if you're 65 or older, other than premiums for a Medicare supplemental policy, such as Medigap

In practice, that means your HSA can help with Medicare premiums, while a Medigap premium has to come from other money. Our guide to the 2027 Part B premium shows the standard premium and the income-related amounts, which are worth knowing if you plan to draw on your HSA for them.

Beyond premiums, IRS Publication 969 says you can receive tax-free distributions from your HSA to pay or be reimbursed for qualified medical expenses you incur after you establish the HSA. Our guide to what Medicare covers explains which costs Original Medicare leaves to you.

What Happens to Non-Medical HSA Withdrawals After 65?

Before 65, money you take out for anything other than qualified medical expenses is taxed and hit with an additional 20% tax. IRS Publication 969 says there is no additional tax on distributions made after the date you are disabled, reach age 65, or die.

That doesn't make non-medical withdrawals tax-free. The 20% additional tax goes away, but Publication 969 says that if you don't use a distribution for qualified medical expenses, you must pay tax on it. So after 65, HSA money is tax-free for qualified medical expenses and eligible premiums, and taxable (without the extra penalty) for anything else. Our retirement savings calculator can help you see how an HSA balance fits with your other savings.

What If You Contributed After Medicare Started?

Contributions for months you were enrolled in Medicare, including retroactive months, are excess contributions. IRS Publication 969 says excess contributions are subject to a 6% excise tax each year they stay in the account. You can avoid the tax by withdrawing the excess, plus any earnings on it, by the due date of your tax return, including extensions.

If you realize this has happened, contact your HSA custodian about removing the excess contribution, and consider asking a tax professional how to report it.

What About Your Spouse?

There's no such thing as a joint HSA. IRS Publication 969 says each spouse who is an eligible individual and wants an HSA must open a separate HSA.

Two points to plan around:

  • Name a beneficiary. IRS Publication 969 says you should choose a beneficiary when you set up your HSA, because what happens to the account when you die depends on whom you name.
  • Check the rules before contributing for a spouse. If one of you is on Medicare and the other isn't, read Publication 969 or ask a tax professional before either of you contributes.

A Retirement Checklist for HSA Owners Approaching Medicare

  • Decide your Medicare and Social Security dates together. Starting Social Security at 65 or later brings automatic Part A enrollment.
  • Stop contributions 6 months early. Count back 6 months from the month you'll apply, and tell payroll to stop employer and employee deposits.
  • Use the 8-month window if you're working past 65. Medicare.gov says an 8-month Special Enrollment Period starts when you stop working (or lose insurance), even if you choose COBRA or other coverage that isn't Medicare.
  • Keep receipts. Record the medical expenses and Medicare premiums you pay from the account.
  • Don't count on HSA money for Medigap premiums. Plan to pay those from other savings.

For questions about your own Medicare coverage, call 1-800-MEDICARE (1-800-633-4227).

Bottom Line

You can keep an HSA after you go on Medicare, but you can't keep adding to it. Your contribution limit drops to zero from the first month you're enrolled, and because SSA backdates Part A up to 6 months for people who apply after 65, Medicare.gov says to stop contributing 6 months before you retire or apply for Social Security. After 65, the balance can pay Medicare premiums and qualified medical costs tax-free, but not Medigap premiums, and the extra 20% tax on other withdrawals no longer applies.

Frequently asked questions

Can I contribute to an HSA after 65?

The IRS ties HSA contributions to Medicare enrollment rather than to a birthday. IRS Publication 969 lists not being enrolled in Medicare among the requirements to contribute, and says your contribution limit is zero beginning with the first month you're enrolled. If you're 65 or older, covered by a qualifying high-deductible health plan and not enrolled in Medicare, the Medicare rule doesn't stop you; the other eligibility requirements still apply.

Can HSA funds be used for Medicare premiums?

Yes, once you're 65 or older. IRS Publication 969 lists Medicare and other health care coverage for people 65 or older as an exception to the rule that HSA money can't pay insurance premiums. Premiums for a Medicare supplemental policy, such as Medigap, are not included.

What is the HSA 6-month rule for Medicare?

It comes from how Part A starts. SSA says Part A coverage begins up to 6 months before the month you apply if you're over 65, and your HSA limit is zero for any month you're enrolled in Medicare, including retroactive months. Medicare.gov says you and your employer should stop contributing 6 months before you retire or apply for Social Security to avoid a tax penalty.

Do I lose my HSA when I go on Medicare?

No. You can't add new money once you're enrolled, but IRS Publication 969 says contributions remain in your account until you use them, and that you can receive tax-free distributions to pay or be reimbursed for qualified medical expenses you incur after you establish the HSA. After 65, the additional 20% tax on withdrawals for other purposes doesn't apply.

What if I contributed to my HSA after Medicare started?

Contributions for months you were enrolled in Medicare, including retroactive months, count as excess contributions. IRS Publication 969 says excess contributions are subject to a 6% excise tax unless you withdraw them, and any earnings on them, by the due date of your tax return, including extensions.

Sources

  1. IRS: Publication 969 (2025), Health Savings Accounts and Other Tax-Favored Health Plans
  2. IRS: Rev. Proc. 2026-24 (2027 HSA limits)
  3. SSA: When to Sign Up for Medicare
  4. Medicare.gov: Working Past 65

This guide is general information, not personal advice. Your situation may differ, so consider talking with a qualified professional, such as a fiduciary financial adviser, CPA or licensed agent, before making a decision.