Medicare and Your HSA: The Enrollment Trap That Costs Thousands
Medicare enrollment ends HSA contribution eligibility — and in many cases, retroactively. The 6-month Social Security lookback catches people off guard every year. Here's what it means and what you can do.
The core rule
Under IRC § 223(b)(7), you cannot contribute to a Health Savings Account once you are enrolled in any part of Medicare.1 Not Part B only. Not Part D only. Any part — including Part A, which most people receive automatically and for free.
The rule applies even if you're still working, still covered by an employer's HDHP, and have never used Medicare for a single claim. Enrollment is enrollment.
Which Medicare parts trigger the ban
| Medicare Part | Triggers HSA ban? | Notes |
|---|---|---|
| Part A (Hospital) | Yes | Often automatic and free; most workers get this without realizing it |
| Part B (Medical) | Yes | Monthly premium; you elect this; easier to track |
| Part C (Medicare Advantage) | Yes | Requires A + B enrollment, so same effect |
| Part D (Prescription) | Yes | Stand-alone drug plan enrollment triggers ban |
| Medigap (Supplement) | No (but requires Part B) | Medigap enrollment itself isn't Medicare — but Part B is required first |
Most people focus on Part B because it has a premium and a decision point. Part A is the silent killer: it's free for most workers (with 40+ quarters), it often enrolls automatically, and it backdates.
The Social Security retroactive enrollment trap
Here's where expensive mistakes happen.
When you apply for Social Security retirement benefits at age 65 or older, SSA automatically enrolls you in Medicare Part A — and Part A coverage is backdated up to six months before your application date, but no earlier than the month you turned 65.2
This means: if you delayed claiming Social Security to increase your benefit (a smart strategy), your Part A coverage can reach back six months before you even filed.
Worked example: Ellen, 67, has been on her employer's HDHP and contributing $5,400/year to her HSA ($4,400 + $1,000 catch-up). She files for Social Security in October 2026 to start benefits in November. SSA automatically enrolls her in Medicare Part A and backdates it to May 2026 — six months prior. Ellen contributed $4,500 to her HSA between May and October (7 months × $450/month). Those contributions are now excess contributions subject to a 6% excise tax under IRC § 4973 for each year they remain in the account.3
Ellen has until her tax-filing deadline (plus extensions) to withdraw the excess contributions and allocable earnings to avoid the penalty. But many people don't catch this until their tax preparer flags it — sometimes after the deadline has passed.
The Social Security trigger and Part A: four scenarios
- Claim SS at exactly 65: Part A starts the month you turn 65, no backdating. No trap.
- Claim SS at 65 but more than 6 months after your 65th birthday: Part A backdates to your 65th birthday month (that's the floor). Monitor whether this creates excess contribution overlap.
- Claim SS at 66 or older (the common delay strategy): Part A backdates up to 6 months before your application. This is where the trap bites.
- Still working, have not filed for SS: No automatic enrollment. You can delay Medicare Part A enrollment and continue HSA contributions — but only if you deliberately do not sign up. The moment you apply for SS, Part A starts (and backdates).
How to protect HSA contributions: the timing strategy
If you plan to delay Social Security to 67, 68, or 70 to maximize your benefit, you must also plan your Medicare Part A enrollment separately — otherwise the retroactive enrollment retroactively invalidates your HSA contributions.
Option A: Enroll in Medicare Part A voluntarily at 65 (accepting the HSA ban from 65 forward) and collect Part A benefits for zero premium. This is the straightforward path. You stop HSA contributions at 65 but pay no retroactive excise tax.
Option B: Delay both SS and Medicare enrollment while covered by employer insurance. Under this approach, you continue HSA contributions through your employer HDHP after 65. When employer coverage ends (not when you retire — when the coverage actually ends), you have an 8-month Special Enrollment Period to sign up for Medicare without penalty.4 Stop HSA contributions before enrolling.
The key rule with Option B: Stop HSA contributions at least 6 months before you plan to apply for Social Security. This gives Part A's retroactive window a clean landing zone — no HSA contributions to contaminate.
Example: Robert, 69, plans to claim SS at 70 (January 2027). He should stop HSA contributions no later than July 2026, so that Part A's 6-month backdating (to July 2026) finds zero contributions in that window.
The partial-year contribution rule
If you enroll in Medicare partway through the year, your annual HSA contribution limit is prorated for the months you were not on Medicare.1 Count only the months (including the month of eligibility through the month before Medicare enrollment started). A September 1st enrollment means January through August = 8 eligible months.
2026 maximum for 8 months (self-only, age 60): $4,400 × 8/12 = $2,933
2026 maximum for 8 months (self-only, age 55+, with catch-up): $5,400 × 8/12 = $3,600
Contributions above the prorated limit are excess contributions. Withdraw them (plus allocable earnings) by the tax-filing deadline to avoid the 6% annual excise tax.
What to do with your existing HSA after Medicare enrollment
Once you're enrolled in Medicare, you can no longer contribute to your HSA — but the funds already in the account remain yours and stay tax-advantaged for life. The strategic question is how to deploy them.
What your HSA can pay (tax-free) after Medicare
Under IRS Publication 969 and IRC § 213(d), HSA funds can be withdrawn tax-free to pay for any qualified medical expense, which after age 65 includes:5
- Medicare Part B premiums: $202.90–$737.90/month in 2026 depending on IRMAA tier. Using HSA funds converts what would otherwise be after-tax dollars into pre-tax dollars — effectively making Part B premiums tax-deductible at your marginal rate.
- Medicare Part D premiums: standalone drug plan or IRMAA surcharge on Part D.
- Medicare Advantage (Part C) premiums.
- Qualified out-of-pocket medical costs: deductibles, copays, dental, vision, hearing aids, and most prescription costs.
- Long-term care insurance premiums (up to age-based IRS limits).
What your HSA cannot pay (tax-free)
- Medigap (Medicare Supplement) premiums: IRS explicitly excludes supplemental policies from qualified HSA expenses. You'll pay Medigap premiums with after-tax dollars.
This creates a planning asymmetry. If you are choosing between Original Medicare + Medigap and Medicare Advantage, one factor is that MA premiums can be paid from HSA tax-free; Medigap premiums cannot. For someone with a large HSA, this difference can be meaningful over a 20-year retirement.
The unlimited lookback rule
There is no time limit for reimbursing yourself from an HSA for past qualified expenses — as long as the expense occurred after the HSA was opened and you haven't already claimed it. If you've been paying Medicare Part B premiums out of pocket for three years and have receipts, you can withdraw those dollars tax-free today. Advisors who specialize in this area use this rule to build tax-free income streams from accumulated HSA balances in retirement.5
When to talk to an advisor
The HSA–Medicare intersection gets complicated when you're also managing Roth conversions, IRMAA brackets, RMDs, and a delayed Social Security decision simultaneously. The 6-month retroactive trap is the most common costly mistake, but it's far from the only one. A fee-only advisor who models Medicare alongside your retirement income plan catches these interactions before they become tax penalties.
Related reading
Get your HSA and Medicare timing modeled
Specialist advisor runs your actual scenario — HSA balance, expected SS claim age, IRMAA bracket, employer coverage end date. Free match.
Sources
- IRS Publication 969 — Health Savings Accounts and Other Tax-Favored Health Plans. HSA eligibility rules, contribution limits, and qualified expenses. 2026 limits: $4,400 (self-only) / $8,750 (family) / $1,000 catch-up age 55+ per IRS Rev. Proc. 2025-19.
- Medicare.gov — When does Medicare coverage start? Retroactive Part A enrollment up to 6 months before application date. Cross-checked with CMS Original Medicare Eligibility and Enrollment.
- IRC § 4973 — Tax on Excess Contributions to HSAs and Other Tax-Favored Accounts. 6% annual excise on excess HSA contributions remaining at end of tax year.
- Medicare.gov — Special Enrollment Period (8-month window after employer coverage ends).
- IRS Publication 969 — Qualified Medical Expenses and HSA Distributions. Part B, D, and MA premiums are qualified expenses after age 65; Medigap premiums are not. Unlimited lookback rule for reimbursements.
HSA contribution limits and Medicare premium figures verified against IRS and CMS 2026 publications. Retroactive enrollment rules per Medicare.gov and CMS.