Enrolling in Medicare ends your ability to contribute to a Health Savings Account, but it does not touch the balance you have already built. The money stays yours, keeps growing tax-free, and can pay most Medicare costs without tax. The trouble with HSAs and Medicare is almost entirely about timing: sign up a month too early, or apply for Social Security without accounting for retroactive Part A, and you can turn a year of tax-deductible contributions into excess subject to a 6% annual penalty.
Eligibility Ends at Enrollment, Not at Age 65
Turning 65 does not, by itself, end your HSA eligibility. The statute cuts off contributions starting with the first month you are entitled to Medicare benefits, and “entitled” means enrolled.1Office of the Law Revision Counsel. 26 USC 223 – Health Savings Accounts If you are 67, still working, still covered by an employer HDHP, and have not filed for Medicare or Social Security, your HSA contributions remain fully deductible.
The one case where you lose that choice: if you are already collecting Social Security when you turn 65, Social Security enrolls you in premium-free Part A automatically. You cannot opt out. Contribution eligibility ends on the first day of the month you turn 65.2Social Security Administration. When to Sign Up for Medicare
One more calendar quirk matters if your birthday sits at the start of a month. When your 65th birthday falls on the first of a month, Medicare Part A starts the first day of the previous month. A December 1 birthday produces a November 1 effective date.3Centers for Medicare & Medicaid Services. Original Medicare (Part A and B) Eligibility and Enrollment Confirm your effective date with Social Security before making contributions in the months around your birthday.
The Six-Month Backdating Trap
This is the single most expensive mistake at the HSA-to-Medicare transition. If you delayed Medicare past 65 and later apply for Social Security retirement benefits, Social Security automatically enrolls you in premium-free Part A and backdates that enrollment up to six months from your application date, though never earlier than the month you turned 65.2Social Security Administration. When to Sign Up for Medicare
The backdating wipes out HSA eligibility for those retroactive months. Every contribution you or your employer made during the window becomes excess, and the IRS charges 6% per year for every year the excess sits uncorrected.4Internal Revenue Service. Publication 969 (2025), Health Savings Accounts and Other Tax-Favored Health Plans Apply for Social Security in November and your Part A effective date lands on May 1. Every dollar contributed May through November is excess.
The rule of thumb: stop all HSA contributions at least six months before the month you plan to apply for Social Security or Medicare Part A.2Social Security Administration. When to Sign Up for Medicare
Skip the Last-Month Rule
The IRS last-month rule lets someone eligible on December 1 contribute a full year’s amount, but only if they stay eligible through the end of the following December. Fail the testing period and you owe income tax plus a 10% penalty on the excess.4Internal Revenue Service. Publication 969 (2025), Health Savings Accounts and Other Tax-Favored Health Plans If Medicare is anywhere within the next 13 months, do not use it. Pro-rate instead.
Pro-Rating Your Contribution in the Year You Enroll
In the year Medicare starts, your contribution limit is the full annual limit divided by 12, multiplied by the number of months you were still eligible. The $1,000 catch-up for those 55 and older is pro-rated the same way.5Internal Revenue Service. Publication 969 Health Savings Accounts and Other Tax-Favored Health Plans
Say you have self-only HDHP coverage in 2026 and your Part A effective date is July 1. You were eligible for six months, January through June. Your limit is $4,400 × 6 ÷ 12 = $2,200. If you are 55 or older, add $500 in catch-up for a total of $2,700.5Internal Revenue Service. Publication 969 Health Savings Accounts and Other Tax-Favored Health Plans For reference, the 2026 annual limits are $4,400 self-only and $8,750 family.6IRS.gov. Expanded Availability of Health Savings Accounts Under the One, Big, Beautiful Bill Act (OBBBA) Notice 2026-5
The month Medicare begins counts as a month of ineligibility, not eligibility. If Medicare starts July 1, July is out.
What Your HSA Still Pays for After Medicare Starts
Losing the right to contribute does not touch what is already in the account. Existing funds keep growing tax-free and can be withdrawn tax-free for qualified medical expenses for the rest of your life, including Part A and Part B deductibles, copays, and coinsurance.
Once you are 65, HSA funds can also pay certain insurance premiums tax-free:
- Medicare Part B and Part D premiums are fully qualified.
- Medicare Advantage (Part C) premiums are qualified, along with out-of-pocket costs under the plan.
- Long-term care insurance premiums are qualified up to the IRS’s age-based annual limits.
- COBRA continuation premiums are qualified.
- Medigap premiums are not qualified. Publication 969 specifically excludes premiums for a Medicare supplemental policy from qualified medical expenses. Pay Medigap premiums from your HSA and the distribution is taxable income.4Internal Revenue Service. Publication 969 (2025), Health Savings Accounts and Other Tax-Favored Health Plans
For non-medical spending, the 20% additional tax on HSA withdrawals disappears at 65.1Office of the Law Revision Counsel. 26 USC 223 – Health Savings Accounts You still owe ordinary income tax on non-medical withdrawals, which puts the account in roughly the same tax position as a traditional IRA for that use. Medical withdrawals stay fully tax-free.
Fixing Excess Contributions Before the Penalty Compounds
If contributions landed in your HSA during months you were actually on Medicare, they are excess. The 6% excise tax applies every year the excess remains in the account.4Internal Revenue Service. Publication 969 (2025), Health Savings Accounts and Other Tax-Favored Health Plans
Withdraw the excess plus any earnings on it before your tax filing deadline, including extensions. You cannot deduct the withdrawn amount, and the earnings go on your return as other income for the year the contribution was made.7Internal Revenue Service. Instructions for Form 8889 (2025)
Already filed without fixing it? You still have a window: withdraw the excess within six months after the original due date (not counting extensions) and file an amended return with “Filed pursuant to section 301.9100-2” written at the top.7Internal Revenue Service. Instructions for Form 8889 (2025)
Two forms do the work. Form 8889 reports contributions, calculates your deduction, and identifies excess; line 14b is where you report excess (and earnings) withdrawn before the deadline.7Internal Revenue Service. Instructions for Form 8889 (2025) Form 5329 calculates the 6% excise tax on any excess still in the account at year-end.4Internal Revenue Service. Publication 969 (2025), Health Savings Accounts and Other Tax-Favored Health Plans
Employer contributions caught by retroactive Medicare enrollment are also excess. The employer can request the money back from the HSA or treat the excess as a post-tax bonus. If the amounts appeared on your W-2 as HSA contributions, you will need a corrected W-2. Either way, the 6% penalty falls on you as the account holder if nothing is reversed.
When Only One Spouse Enrolls in Medicare
One spouse’s Medicare enrollment does not affect the other spouse’s HSA eligibility.1Office of the Law Revision Counsel. 26 USC 223 – Health Savings Accounts If the younger spouse carries family HDHP coverage, that spouse can contribute up to the full 2026 family limit of $8,750 in their own HSA.6IRS.gov. Expanded Availability of Health Savings Accounts Under the One, Big, Beautiful Bill Act (OBBBA) Notice 2026-5 The rule allowing spouses to split a family limit differently applies only when both spouses are eligible individuals, so a Medicare-enrolled spouse gets zero and the eligible spouse gets the whole family amount in their own account. The catch-up contribution stays with each individual’s own HSA, so the Medicare spouse cannot use the younger spouse’s account for their $1,000.
Undoing a Premature Part A Enrollment
People who signed up for Part A without realizing it would end HSA eligibility sometimes have a way out. You can withdraw your Part A enrollment through the Social Security Administration as long as you have not cashed any Social Security retirement checks. You will need to repay any Medicare benefits received during the enrollment period. Once Part A is terminated, HSA contributions can resume the first day of the following month, provided you still have qualifying HDHP coverage. If you are already collecting Social Security, you generally cannot drop Part A without giving up Social Security itself.