You did everything right. You kept working past 65, stayed on your employer's high-deductible health plan, and kept funding your Health Savings Account month after month. Then you applied for Social Security — and without warning, Medicare backdated your Part A coverage by six months. Every HSA contribution you made during those six months just became an excess contribution, subject to a 6% excise tax for every year it sits uncorrected in your account.
Nobody sent you a warning letter. The trap is built into how Medicare enrollment works, and it catches working owners and employees past 65 every year. Here's how the rule works, how to compute exactly what you were allowed to contribute, and how to shut your HSA down cleanly before Medicare enrollment turns routine contributions into a tax problem.
Why Medicare and HSA Contributions Cannot Coexist
To put money into an HSA, the IRS requires you to be an "eligible individual" in any given month. That means three things: you are covered by a qualifying high-deductible health plan (HDHP), you have no disqualifying other health coverage, and — the one that matters here — you are not enrolled in Medicare.
Enrollment in any part of Medicare disqualifies you, including premium-free Part A alone. You do not need to be using Medicare as your primary insurance. You do not even need to have signed up for Part B. The month your Part A coverage begins, your HSA eligibility ends.
This is the piece most people miss: they assume eligibility ends when they "switch to Medicare." In reality, it ends when Part A coverage begins — and Part A coverage can begin months before you ever file an application.
The Six-Month Retroactive Rule, Explained
When you apply for premium-free Medicare Part A more than six months after turning 65, your coverage does not start on your application date. It is backdated up to six months from the month you apply — stopping no earlier than the first month you were eligible for Medicare (generally the month you turned 65).
Two triggers catch people off guard:
- Applying for Medicare late. Enroll at 68, and Part A is typically backdated six full months.
- Applying for Social Security after 65. Claiming Social Security benefits automatically enrolls you in Part A, and that automatic enrollment carries the same retroactive coverage. Many people discover this only when the award letter arrives with an effective date half a year in the past.
A concrete example
Say you turned 65 in March 2025, kept working, and stayed on your employer's HDHP. In November 2026, at 66, you apply for Social Security. Your Part A coverage is backdated to May 2026 — six months before your November application. Every HSA contribution attributable to May through October 2026 is now excess, even though each one was perfectly legal on the day you made it.
Note the asymmetry: if you enroll right at 65, there is no lookback before your 65th birthday, so there is no retroactive period to worry about. The six-month trap exists specifically for people who delay enrollment past 65.
How Your Contribution Limit Gets Prorated
Your HSA limit for the year you enroll in Medicare is not all-or-nothing. It is prorated by eligible months: one-twelfth of the annual limit for each month you were an eligible individual on the first day of the month.
For 2026, the IRS limits are $4,400 for self-only HDHP coverage and $8,750 for family coverage, plus a $1,000 catch-up contribution if you are 55 or older and not yet on Medicare. That puts the 55-plus maximums at $5,400 (self-only) and $9,750 (family).
Worked example
Take the worker above: self-only coverage, over 55, with Part A backdated to May 2026. She was HSA-eligible for four months (January through April), so her 2026 limit is:
$5,400 ÷ 12 × 4 = $1,800
If her payroll deductions put $3,600 into the HSA through October, she has $1,800 of excess contributions to deal with — even though she never exceeded the $5,400 annual cap on paper.
One caveat worth knowing: the "last-month rule" lets someone who is eligible on December 1 count as eligible for the whole year — but it comes with a testing period requiring you to stay eligible through the end of the following year, or the extra amount becomes taxable income plus a 10% additional tax. If you are enrolling in Medicare mid-year, assume prorating applies and plan around it.
The 6% Excise Tax Compounds Until You Fix It
Excess HSA contributions left in the account at year-end are hit with a 6% excise tax, reported on Form 5329 — and unlike a one-time penalty, it applies each year the excess remains in the account. A $1,800 excess costs $108 the first year, another $108 the next year, and so on until the excess is withdrawn or absorbed by a future year's unused limit (which, once you are on Medicare, you will never have, since your future limit is zero).
For a business owner who kept maxing out a family-level HSA for months after retroactive Part A began, the excess can easily run into the thousands — and the meter keeps running until the money comes out.
How to Fix Excess Contributions
The good news: you can unwind the damage if you act before your tax filing deadline, including extensions.
- Stop contributions immediately. Contact payroll the day you learn about the retroactive coverage. Every additional contribution just grows the excess.
- Compute your prorated limit. Count your eligible months (months before retroactive Part A began) and multiply one-twelfth of your annual limit — including the $1,000 catch-up if you qualify.
- Ask your HSA custodian for a return of excess contributions plus earnings. This is a specific transaction type, not an ordinary withdrawal. The custodian calculates the earnings attributable to the excess and issues a corrected Form 5498-SA so the contribution total matches your eligible amount.
- Report it correctly. Withdrawn pre-tax contributions you already deducted or excluded from wages go back into income as "Other income" for the contribution year. The earnings are "Other income" in the year you withdraw them. Handled this way, the withdrawn amount is treated as if it was never contributed — no 6% tax.
- If you miss the deadline, the excess stays in, you owe the 6% excise tax on Form 5329 for that year, and you must withdraw the excess (without deducting it) to stop future years' tax.
If you already spent the money on qualified medical expenses before the deadline, the IRS generally treats the funds as removed from the account — but expect the custodian to ask for transaction proof before correcting the 5498-SA.
The Six-Months-Ahead Shutdown Plan
The cleanest fix is prevention, and the rule of thumb is simple: stop all HSA contributions at least six months before you enroll in Medicare or apply for Social Security. That includes employer contributions and payroll deductions, not just your own deposits — every dollar counts toward the same cap.
A practical timeline for a planned enrollment:
- Six-plus months out: Tell payroll to zero out your HSA deductions and confirm any employer seed contributions stop too. Calendar the date.
- Before applying: Verify your last contribution month leaves a full six-month buffer ahead of your expected application month, not your expected coverage month — the lookback runs from the application.
- At application: Keep the Medicare award letter showing your Part A effective date. You will need it to compute your prorated limit at tax time.
- At tax time: File Form 8889 with the prorated limit, and reconcile your W-2 Box 12 Code W amount against what you were actually eligible to contribute. If payroll ran even one extra deduction, that is your excess to withdraw.
One more wrinkle for small-business owners: if your company has fewer than 20 employees, Medicare generally pays primary once you turn 65, and most advisors recommend enrolling in Parts A and B at 65 rather than delaying. The delay-and-keep-funding strategy mainly works when your employer's plan is large enough to pay primary. Confirm which side of that line you are on before building a plan around delayed enrollment.
What You Can Still Do With Your HSA After 65
Losing eligibility to contribute is not the same as losing the account. Your HSA stays yours, and it remains one of the most flexible retirement healthcare tools you have:
- Keep spending the balance on qualified medical expenses tax-free, at any age.
- Pay Medicare premiums from the HSA — Part B, Part D, and Medicare Advantage premiums all qualify. (Medicare supplement/Medigap premiums do not.)
- Take non-medical withdrawals without the 20% penalty once you are 65 — they are taxed as ordinary income, like a traditional IRA distribution, but the penalty is gone.
- Let a younger spouse keep contributing. If your spouse is under 65, not on Medicare, and covered by your family HDHP, they can open their own HSA and contribute up to the full family limit. There is no such thing as a joint HSA, so the contributions simply move from your account to theirs — and spouses can spend from each other's accounts freely.
Keep a Paper Trail Your Future Self Can Reconcile
HSA-and-Medicare mistakes are bookkeeping failures as much as tax failures: contributions flow automatically through payroll, the retroactive coverage date arrives in a letter months later, and nobody connects the two until the return is already filed. A little record-keeping discipline prevents the whole mess.
- Track HSA contributions against your prorated limit in real time, not at tax time. Log each payroll deduction and employer deposit in your books the month it posts, with a running total next to your computed ceiling.
- File the Medicare award letter with your tax records the day it arrives, and note the Part A effective date next to your HSA ledger entries for that year.
- Reconcile three forms every spring: your W-2 Box 12 Code W total, the custodian's Form 5498-SA, and your Form 8889. If the first two exceed your prorated limit on the third, you have an excess to withdraw before the filing deadline.
- If you run payroll for others, flag employees approaching 65 who carry HSA deductions — a one-line reminder six months before their planned Social Security claim saves them from the same trap.
Keep Your Health and Tax Records Organized Together
Coordinating HSA shutdown timing, payroll deductions, Medicare effective dates, and prorated limits is exactly the kind of multi-year record-keeping that falls apart in a shoebox of letters and pay stubs. Beancount.io provides plain-text accounting that gives you complete transparency and control over your financial data — no black boxes, no vendor lock-in. Get started for free and see why developers and finance professionals are switching to plain-text accounting.





