If you delay Medicare past age 65 and keep contributing to your HSA, there's a quiet trap waiting for you. When you finally do enroll in Medicare or claim Social Security, Part A enrollment is automatically backdated up to six months. Any HSA contributions you made during that backdated window become excess — taxed as income plus a 6% excise tax for every year they sit there.
Here's how the rule actually works and exactly when to stop contributing.
How the Lookback Works
Once you turn 65, Medicare Part A is available to you free of charge. If you sign up for Social Security at any point after that, the SSA automatically enrolls you in Part A — and per Medicare rules, that enrollment is backdated to whichever is later: your 65th birthday or six months before you applied. A few specifics:
- The backdating only applies if you enrolled after turning 65. If you take Medicare on time, no lookback applies.
- The maximum lookback is 6 months — you can't be retroactively enrolled before age 65.
- Once Medicare kicks in (even retroactively), you can no longer contribute to an HSA. Spending is fine forever; new deposits stop.
The Trap, Illustrated
Suppose you turn 65 in January 2026, keep working, and stay on your employer's HDHP. You contribute the family max — $8,750 — through payroll all year. In December 2026 you decide to retire and apply for Social Security. Part A is backdated to July 2026 (6 months earlier).
Now: every contribution you made July through December 2026 is an "excess" contribution. You owe income tax on those amounts plus a 6% excise tax until the excess is withdrawn. On a $4,375 half-year contribution, that's potentially $1,000+ in unexpected tax — and more for every year the excess sits there.
The Fix: Stop 6 Months Before
The clean rule: stop HSA contributions at least six months before you plan to enroll in Medicare or apply for Social Security. Concretely:
- Planning to enroll on January 1? Stop contributing the previous July.
- Planning to apply for Social Security in May? Stop contributing the previous November.
- Planning to keep working past 65 indefinitely? You can keep contributing — just don't enroll in any part of Medicare and don't claim Social Security.
If your contributions are payroll-deducted, change your election with HR. If you contribute personally, just stop the deposits.
What Doesn't Trigger the Lookback
- Turning 65 alone. If you don't enroll in Medicare or Social Security, the lookback never kicks in.
- Spending HSA funds after Medicare. Medicare blocks new contributions, not withdrawals. Existing balances stay tax-free for qualified expenses forever.
- Medicare premiums themselves. Part B, Part D, and Medicare Advantage premiums are HSA-eligible expenses (Medigap is not).
Common Scenarios
| Situation | HSA Contribution Stop Date |
|---|---|
| Enrolling in Medicare at 65 | The month you turn 65 (no lookback if on time) |
| Applying for SS at 67 | 6 months before applying (so age 66.5) |
| Working past 65 with HDHP, no Medicare | Keep contributing — until you enroll |
| Already on Social Security at 65 | Stop contributing immediately (Part A is automatic) |
Already Made Excess Contributions?
If you find out after the fact, withdraw the excess (plus earnings on it) before your tax filing deadline to avoid the 6% excise tax. Your HSA custodian has a "removal of excess contribution" form. The earnings come out as taxable income, but the penalty stops accruing.
The Bottom Line
The 6-month lookback is the most-missed HSA rule for people approaching retirement. If you're 64 and planning your transition, mark your calendar six months before whichever Medicare or Social Security event comes first, and stop contributions then. For the broader retirement-era HSA strategy, see HSA as a stealth retirement account and HSA strategy by decade. And if you're still confirming eligibility today, run the HDHP rule checklist.