A health savings account is one of the most tax-favored tools in retirement planning: money goes in untaxed, grows untaxed, and comes out untaxed when spent on medical costs. For workers who keep saving toward the health expenses that pile up later in life, it can be a quiet powerhouse. But there is a hard cutoff that catches many people by surprise. The day someone enrolls in Medicare, the door to putting new money into that account closes — and, because of how Medicare and Social Security are linked, it can close sooner than expected.
Why Medicare and HSA contributions cannot coexist
The rules that make health savings accounts so attractive also make them exclusive. To contribute, a person has to be covered by a qualifying high-deductible health plan and, critically, must have no other disqualifying health coverage on top of it. That second condition is where Medicare collides with the account.
According to the IRS guide to health savings accounts, Publication 969, enrollment in Medicare counts as disqualifying coverage. Once a person is enrolled in any part of Medicare — Part A hospital coverage, Part B, a Part C Advantage plan, or Part D drug coverage — new HSA contributions are no longer allowed. The money already in the account is untouched by this: it stays invested, keeps growing tax-free, and can still be spent tax-free on qualified medical expenses for the rest of the account holder’s life. What ends is the ability to add to it. For someone who reaches 65 and signs up for Medicare on schedule, that means the final chance to contribute is the period just before coverage begins.
Free for readers: Social Security and Medicare change every year, and nobody sends a memo. The free Retirement Shield newsletter breaks down what changed and what to do. Get it free in your inbox.
The Social Security connection at 65
The trap that snares the most people is not Medicare itself but its link to Social Security. Anyone already collecting Social Security when they turn 65 is automatically enrolled in Medicare Part A, and the government does not allow a person drawing Social Security benefits to decline that Part A coverage. The Social Security Administration’s information on how to sign up for Medicare reflects this automatic enrollment. The practical result is that claiming Social Security at or after 65 quietly ends HSA eligibility, even for someone who is still working, still covered by a qualifying workplace health plan, and fully intending to keep contributing. Many people who plan to keep funding an HSA past 65 do not realize that simply starting their retirement checks shuts it off.
The six-month retroactive trap
Timing carries a second hidden hazard. When a person enrolls in Medicare Part A after age 65 — or is swept into it by claiming Social Security late — the coverage does not necessarily start on the enrollment date. Medicare’s guidance on when coverage starts notes that Part A can be backdated by up to six months (though never earlier than the 65th birthday). Any HSA contributions made during those retroactively covered months become excess contributions, which can carry a tax penalty if they are not corrected. The safe practice for anyone approaching a late Medicare or Social Security start is to stop HSA contributions at least six months before the enrollment or claim takes effect, so no contribution lands inside the backdated window.
Staying eligible while working past 65
The rules do leave a clear path for people who want to keep contributing beyond 65. Someone who is still working, covered by a qualifying high-deductible plan through an employer, and who chooses to delay both Medicare and Social Security can generally keep funding an HSA until the moment Medicare coverage actually begins. Delaying Medicare in this situation is often allowed without a late-enrollment penalty for those with qualifying employer coverage, which makes the strategy workable rather than a gamble. One detail matters in the final year: the contribution limit for the year Medicare coverage starts is prorated to the months the person was eligible, so a full-year contribution is generally not permitted once Medicare kicks in partway through. Workers in this position benefit from confirming both the delay rules and the proration before making their last contributions.
The savings at stake explain why the timing is worth getting right. The years just before Medicare are often a person’s last chance to add tax-advantaged dollars earmarked for health care, and account holders who are 55 or older are allowed an additional $1,000 catch-up contribution on top of the regular annual limit — a final boost that disappears once Medicare enrollment begins. A worker who understands the cutoff can front-load those catch-up contributions in the last eligible years rather than leave the room unused. Missing that window cannot be undone later, because the option ends permanently at enrollment rather than pausing.
What the account can still do after enrollment
Losing the ability to contribute is not the same as losing the account’s value, and the tax advantages that remain are considerable. The balance keeps growing tax-free, and withdrawals for qualified medical expenses stay tax-free no matter how old the account holder gets. Importantly, those qualified expenses include most Medicare premiums — Part B, Part D, and Part C Advantage premiums can be paid from HSA funds tax-free, though premiums for Medigap supplement policies cannot. That turns a well-funded HSA into a ready source of tax-free cash for the very costs Medicare enrollees face. And once a person passes 65, even non-medical withdrawals no longer carry the early-withdrawal penalty that applies to younger account holders; such withdrawals are simply taxed as ordinary income, much like a traditional IRA. The contribution window may close at Medicare enrollment, but a health savings account can go on working for a retiree for decades afterward.
The account also rewards a longer-term habit many savers overlook: paying current medical bills out of pocket while leaving the HSA invested, then reimbursing those expenses tax-free years later. Because there is no deadline to reimburse a qualified expense, an account holder who keeps receipts can let the balance compound and still pull the money out tax-free whenever it is needed — a flexibility that survives Medicare enrollment even though new contributions do not. Kept that way, the account behaves less like a checking account for doctor visits and more like a dedicated, tax-free medical fund for the whole of retirement.
Free for readers: One number can cost or save hundreds a month in retirement. The free Retirement Shield newsletter surfaces the ones worth knowing. Sign up free.
This article was researched and drafted with AI assistance and reviewed against the linked primary sources.



