HSA Compatibility Calculator

Elderly couple holding hands and dancing barefoot on a sandy beach with waves in the background.

Key takeaway: The moment you enroll in any part of Medicare — even free Part A — you can no longer contribute to a Health Savings Account, and claiming Social Security at 65 or later triggers automatic retroactive Medicare Part A enrollment that can create unexpected excess contributions subject to a 6% excise tax.

What this helps you decide

  • Whether you can keep contributing to your HSA while approaching or past age 65, and exactly when that ability ends
  • How to avoid the retroactive Part A trap that catches many people who claim Social Security and don't realize they've triggered Medicare enrollment up to 6 months in the past
  • Whether delaying Medicare — and Social Security — is worth it to maximize HSA contributions in your final working years
  • What to do if you've already enrolled in Medicare but your employer deducted HSA contributions after your effective Medicare date

Who this is for

  • Someone who is 65 or older, still working, has a high-deductible health plan (HDHP) with an HSA, and wants to keep contributing as long as possible
  • A person who recently started claiming Social Security and needs to know whether that automatically ended their HSA eligibility — possibly retroactively
  • Anyone who enrolled in Medicare Part A only (because it's free) while still working, not realizing it eliminates HSA eligibility entirely
  • A financial planner or HR professional helping a near-retirement employee understand the Medicare and HSA timing interaction

Example results

Example 1 — Delaying Medicare to maximize HSA contributions. James is 65, still working full-time, and covered by his employer's high-deductible health plan. He's not claiming Social Security yet and has not enrolled in Medicare. In this situation, James can keep contributing to his HSA at full 2026 limits: $4,400 for individual coverage plus the $1,000 catch-up contribution for people 55 and older, for a total of $5,400 per year in tax-advantaged savings. As long as he doesn't enroll in any part of Medicare — not Part A, not Part B, not Part C, not Part D — and doesn't claim Social Security, his HSA eligibility continues. Every year he delays is another $5,400 in tax-free medical savings he can carry into retirement. When James does eventually retire and enroll in Medicare, his HSA contributions stop as of his Medicare effective date. But he can still use his existing HSA balance to pay for Medicare premiums, deductibles, copays, and out-of-pocket costs tax-free for the rest of his life.

Example 2 — Claiming Social Security triggers retroactive Part A and excess HSA contributions. Linda is 66, still working and contributing to her HSA each year. In July 2026 she decides to start claiming Social Security benefits. What she doesn't realize is that claiming Social Security at 65 or older automatically enrolls you in Medicare Part A — and that enrollment is retroactive up to 6 months. So when Linda's Social Security application is processed in July 2026, her Part A effective date is set to January 2026, six months back. This means Linda has been technically ineligible to contribute to her HSA since January 2026. Any HSA contributions made from January through June 2026 — whether from her paycheck or her employer's contributions — are now classified as excess contributions. Excess HSA contributions are subject to a 6% excise tax each year they remain in the account. If her total excess contributions during those 6 months were $2,700 (half of the $5,400 annual max), she owes a $162 excise tax. To avoid the ongoing annual excise tax, she needs to withdraw the excess amount plus any earnings on it before she files her tax return. Linda could have avoided this entirely by filing for Social Security and Medicare enrollment at the same time and stopping HSA contributions immediately, or by claiming Social Security later so retroactive Part A didn't reach back into a period when she was contributing.

Example 3 — Part A is free, but it still ends your HSA eligibility. Thomas is 65, working part-time, and still on his employer's HDHP. His employer helps fund his HSA. A coworker tells him that Medicare Part A is free for most people and that he should sign up to get the hospital coverage without spending anything. Thomas enrolls in Part A. What his coworker didn't mention: enrolling in Part A — even though it costs $0 in premiums — makes Thomas immediately ineligible to contribute to his HSA or receive employer HSA contributions. The IRS doesn't make an exception for "free" Medicare. Any month Thomas has Part A is a month he cannot contribute to an HSA. His employer will need to stop depositing into his HSA as of his Part A effective date, and any contributions made after that date by Thomas or his employer are excess contributions subject to the 6% excise tax. This is one of the most common — and easily avoidable — HSA mistakes near retirement age.

Sample scenarios

Scenario Input Result
Age 65, still working, HDHP, no Medicare, no Social Security Delaying Medicare and Social Security to maximize HSA Fully eligible to contribute. 2026 limits: $4,400 individual + $1,000 catch-up = $5,400/yr tax-free.
Age 66, claims Social Security in July 2026 Part A retroactively effective January 2026 (6-month lookback) HSA ineligible since January 2026. Contributions made Jan–Jun 2026 are excess, subject to 6% excise tax. Must withdraw excess before tax filing deadline.
Age 65, enrolled in Part A only (free), still working Signed up for Part A while on employer HDHP HSA contributions ended as of Part A effective date. Employer must stop HSA deposits. Any contributions after Part A effective date are excess and subject to 6% excise tax.
Age 67, enrolled in Medicare Part A and B, has old HSA balance Retired, on Medicare, spending down prior HSA savings Cannot make new contributions, but existing balance can still be used tax-free for Medicare premiums, deductibles, copays, dental, vision, and other qualified expenses.

What to do next

  • If you're still working past 65 and contributing to an HSA, check right now whether you've enrolled in any part of Medicare or claimed Social Security. Either one ends your HSA eligibility, sometimes retroactively. If you've done neither, you may have more contribution runway than you think — but you need to actively delay both Medicare and Social Security to keep it.
  • If you're planning to claim Social Security in the next year or two, talk to a tax professional or benefits counselor before you file. Understand exactly when your Part A effective date will be and whether it reaches back into months when you've been contributing to your HSA. You may want to stop HSA contributions 6 months before you plan to file for Social Security to avoid any retroactive overlap.
  • If you've already discovered that you have excess HSA contributions because of retroactive Part A enrollment, act before your tax filing deadline. Withdraw the excess contributions and any earnings on them. Your HSA custodian can process this as a return of excess contribution. If you miss the deadline and leave excess funds in the account, the 6% excise tax applies again the following year — and every year — until you remove the excess.
  • Once you're on Medicare and can no longer contribute, remember that your existing HSA balance doesn't expire and remains yours to spend tax-free on qualified medical expenses. Medicare Part B premiums, Part D premiums, Medicare Advantage premiums, deductibles, copayments, and many out-of-pocket costs all qualify. Long-term care insurance premiums qualify up to IRS limits. This is one of the most tax-efficient ways to cover healthcare costs in retirement.

Key facts

  • Enrolling in any part of Medicare — including free Part A — disqualifies you from making Health Savings Account contributions as of your Medicare effective date. The IRS does not make an exception for Part A enrollment that costs nothing in premiums. The rule applies to all parts of Medicare: A, B, C (Medicare Advantage), and D.
  • Claiming Social Security benefits at age 65 or older automatically enrolls you in Medicare Part A, and that enrollment is retroactive up to 6 months. If you were contributing to an HSA during any of those retroactive months, those contributions are classified as excess and are subject to a 6% annual excise tax until withdrawn. Stopping HSA contributions at least 6 months before claiming Social Security prevents this problem.
  • If you want to maximize HSA contributions through your late 60s, you must delay both Medicare enrollment and Social Security benefits. Delaying Medicare alone is not enough if you claim Social Security, because Social Security triggers automatic Part A enrollment. Both decisions must be made together to preserve HSA eligibility.

Related decisions

Decision area Tool What it answers
Enrollment Initial Enrollment Period Calculator When your 7-month Medicare eligibility window begins and ends based on your 65th birthday
Enrollment When Should I Sign Up for Medicare? The best time to enroll based on your work status, other coverage, and age
Enrollment Special Enrollment Period Checker Whether a life event qualifies you for enrollment outside the standard windows
Enrollment Late Enrollment Penalty Checker How much extra you'll pay monthly if you missed your enrollment window
Enrollment Part B Penalty Calculator The exact 10%-per-year premium increase for delayed Part B enrollment
Enrollment Part D Penalty Calculator The 1%-per-month premium increase for gaps in creditable drug coverage
Costs Cost Scenario Planner Estimated annual spending across plan types at different health utilization levels
Costs Advantage vs. Medigap Cost Comparison True cost difference between Medicare Advantage and Original Medicare with Medigap
Costs IRMAA Calculator Whether your income triggers higher Part B and Part D premiums
Costs Part A Premium Estimator Your monthly Part A premium based on work history and quarters of coverage
Costs M3P Calculator How the Medicare Prescription Payment Plan smooths your drug costs into monthly payments
Coverage Doctor & Drug Assessment Whether your providers and prescriptions are covered by a specific plan
Coverage Part D Shopping Tool Which Part D plan has the lowest total annual cost for your specific medications
Coverage Travel & Network Risk Assessment How your coverage works outside your home area and which plan types travel best
Employer/COBRA COBRA vs. Medicare Why COBRA can trigger permanent Medicare penalties and how costs compare
Employer/COBRA Employer Coverage vs. Medicare Whether your employer plan or Medicare is primary and when to transition
Employer/COBRA HSA & Medicare Compatibility How Medicare enrollment affects HSA eligibility and what to do before enrolling
Planning Caregiver Readiness Checklist Whether you have everything in place to help a loved one with Medicare decisions
Planning Document Gatherer Which documents you need to have ready before enrolling or changing plans
Planning Medigap Fit Assessment Whether Medigap or Medicare Advantage is the better fit for how you use healthcare
Planning Medigap Open Enrollment Window Whether you're inside your one-time guaranteed issue window for Medigap
Planning Medicare Savings Program Eligibility Whether your income qualifies you for help paying Medicare premiums and cost-sharing

Not sure which plan is right for you?

Smiling elderly couple outdoors with lush green plants in the background, both wearing caps and glasses.

Last Updated: