Facts checked against primary sources · Last updated August 26, 2026
HSA and Medicare: The 6-Month Lookback That Catches Diligent Savers
The people this rule bites are the responsible ones: still working at 66, maxing the HSA, payroll deduction on autopilot. Then they file for Medicare or Social Security, the start date reaches backward, and months of contributions retroactively become a tax problem.
The basic rule
You can only contribute to a health savings account while you’re covered by a high-deductible health plan and, among other conditions, not enrolled in Medicare. Any part of Medicare counts, including premium-free Part A. Spending the money you’ve already saved is completely unaffected; it’s new contributions that stop. The cutoff is monthly, not yearly: contributions for months before your Medicare enrollment are fine, and the annual limit prorates.
The lookback trap
The trap is that “the first month you are enrolled” may not be the month you think. If you kept working past 65 and sign up for Part A later, or you file for Social Security benefits (which brings Part A with it), your Part A start date is set up to 6 months in the past. Publication 969 closes the loop explicitly: “This rule applies to periods of retroactive Medicare coverage. So if you delayed applying for Medicare and later your enrollment is backdated, any contributions to your HSA made during the period of retroactive coverage are considered excess.”
The practical rule of thumb follows directly: stop HSA contributions 6 months before you plan to apply for Medicare or for Social Security benefits. If you’re past 65 and the application is coming up sooner than that, stop now.
What excess contributions cost, and the exit
- The proration: in the year Medicare starts, your limit is the annual limit times the number of eligible months over 12. Publication 969’s own example: turn 65 in July, enroll in Medicare, and your limit for the year is half the full amount.
- The penalty: excess contributions are generally subject to a 6% excise tax, and it applies again each tax year the excess stays in the account.
- The exit: withdraw the excess (plus the earnings on it) by your tax return’s due date, including extensions, for the year you contributed, and the excise tax on the withdrawn amount goes away. Your HSA custodian will have an “excess contribution removal” form for exactly this.
Still working at 65: the coordination question
If you have coverage from a current employer (yours or your spouse’s, generally 20 or more employees), you can delay Medicare enrollment, keep the HDHP, and keep contributing to the HSA. Two cautions. First, don’t file for Social Security in the meantime, because premium-free Part A comes with it and backdates. Second, when the job or the coverage does end, a different clock starts: the 8-month Special Enrollment Period for Part B, which COBRA does not extend. That trap has its own guide: COBRA and Medicare.
What your HSA is still good for after 65
The account itself gets more useful in retirement, not less. Publication 969 lists, among qualified expenses, “Medicare and other health care coverage if you were 65 or older (other than premiums for a Medicare supplemental policy, such as Medigap).” In practice that means you can pay Part B premiums (including the IRMAA surcharges covered in our IRMAA guide), Part D premiums, and Medicare Advantage premiums from the HSA tax-free, along with deductibles, copays, dental, vision, and hearing costs. The one premium the IRS singles out as not qualified is Medigap.
Not sure which rules apply to you?
Three questions, two minutes, no sign-up. See the deadlines and California rules for your situation.
Sources
- IRS Publication 969: HSAs (the zero-limit rule, retroactive coverage, proration example, excess contributions, and qualified expenses after 65)
- Medicare.gov: When does Medicare coverage start (Part A backdating up to 6 months for post-65 sign-ups)
This guide is educational only, not insurance, legal, tax, or financial advice. Verify anything that matters for your situation at Medicare.gov, with the Social Security Administration, or with California’s free HICAP counselors at 1-800-434-0222.