In this article 9 sections
- Why Medicare stops HSA contributions
- When to make your last HSA contribution
- HSA contribution limits for 2026 and 2027
- The year you start Medicare: prorating your limit
- Worked example: the 6-month lookback
- How to use your HSA after you have Medicare
- A checklist for HSA holders approaching Medicare
- About this guide
- Sources and check dates
Key points
- Once you are enrolled in Medicare, you can no longer contribute to a health savings account (HSA). That includes Part A alone.
- Premium-free Part A is usually backdated up to 6 months when you sign up late. If you sign up 6 or more months after turning 65, Medicare’s handbook says to stop contributions 6 months before the month you apply for Medicare to avoid a tax penalty.
- Applying for Social Security at 65 or older enrolls you in Part A, and you cannot turn it down while you get benefits.
- You can keep spending the HSA tax-free on medical costs after you have Medicare, including Medicare premiums once you are 65, but not Medigap premiums.
An HSA and Medicare do not mix for contributions. The tax law sets your HSA contribution limit to zero for every month you are entitled to Medicare. For people who work past 65 with a high deductible health plan (HDHP), the hard part is timing. Medicare coverage can be backdated, and contributions made during the backdated months become excess contributions.
The good news is the money already in the account stays yours. After 65 you can spend it on medical costs tax-free, and on anything else without the 20% penalty that applies before 65, though those withdrawals are taxable income.
This guide is part of our Medicare costs and IRMAA guide. It covers federal tax and Medicare rules only. We checked every figure against IRS, Medicare.gov, CMS and Social Security sources on November 4, 2026. They are listed at the end.
Why Medicare stops HSA contributions
To contribute to an HSA, you must be covered by an HDHP, have no other health coverage except what the rules allow, not be enrolled in Medicare, and not be someone else’s dependent.
The law is blunt about Medicare. Section 223 of the tax code says your contribution limit is zero “for the first month such individual is entitled to benefits under title XVIII of the Social Security Act and for each month thereafter.” Title XVIII is Medicare. Part A alone is enough, even if you keep your employer HDHP.
Two Medicare rules make this easy to trip over:
- Social Security brings Part A with it. If you already get Social Security or Railroad Retirement benefits, in most cases you are enrolled in Part A and Part B automatically from the month you turn 65. Social Security’s rules say people entitled to monthly benefits may not waive Part A. The only way out is to withdraw your benefit application and repay all the benefits you were paid.
- Part A can be backdated. If you are 65 or older and sign up late, premium-free Part A goes back up to 6 months from when you sign up for Part A or apply for Social Security or Railroad Retirement benefits. It never goes back before the first month you were eligible for Medicare.
The IRS treats backdated Medicare the same as any other Medicare month. If your enrollment is backdated, contributions you made during the backdated months are excess contributions.
Medicare’s enrollment booklet puts it plainly: “If you’d like to continue contributing to your HSA, you shouldn’t apply for Medicare, Social Security, or Railroad Retirement Board (RRB) benefits.”
When to make your last HSA contribution
Medicare & You 2027 gives this timing chart for avoiding a tax penalty:
| When you sign up for Medicare | What the chart says |
|---|---|
| During your Initial Enrollment Period | Make your last HSA contribution the month before you turn 65 |
| During your Initial Enrollment Period, with a birthday on the 1st of the month | Make your last HSA contribution 2 months before you turn 65 (coverage generally starts the month before your birthday month) |
| Less than 6 months after you turn 65 | Stop HSA contributions the month before you turn 65 |
| 6 or more months after you turn 65 | Stop HSA contributions 6 months before the month you apply for Medicare |
The rule behind the chart is the sentence above it in the handbook: make your last contribution the month before your Part A coverage begins. With a late sign-up, Part A can start 6 months before the month you apply. So someone who applies in October 2027 makes their last contribution in March 2027, as in the worked example below.
The same rule applies to your employer’s contributions. Medicare.gov says you and your employer should stop contributing 6 months before you retire or apply for Social Security or Railroad Retirement benefits. Tell your payroll or benefits office in time.
Delaying Part B while you keep an HSA. If your HDHP comes from your own or your spouse’s current employment, you may qualify for a Special Enrollment Period to sign up for Part B later without a lifetime late penalty. Retiree coverage does not count as current employment. Our guide on whether you need Medicare if you have employer insurance covers who can delay, and our guide to when to apply for Medicare covers the enrollment windows.
HSA contribution limits for 2026 and 2027
| HSA amount | 2026 | 2027 |
|---|---|---|
| Contribution limit, self-only HDHP | $4,400 | $4,500 |
| Contribution limit, family HDHP | $8,750 | $9,000 |
| Extra contribution at 55 or older | $1,000 | $1,000 |
| HDHP minimum deductible (self-only / family) | $1,700 / $3,400 | $1,750 / $3,500 |
| HDHP out-of-pocket maximum (self-only / family) | $8,500 / $17,000 | $8,700 / $17,400 |
The 2027 amounts are official: the IRS published them in Revenue Procedure 2026-24. The $1,000 extra amount at 55 or older is written into the law as a flat figure and is not adjusted for inflation.
The year you start Medicare: prorating your limit
Your yearly limit is built month by month. Each month counts only if you are eligible on the first day of that month. The IRS “last-month rule,” which can allow a full year’s contribution for someone eligible on December 1, does not help in the year Medicare starts, because you are not eligible on December 1.
The IRS’s own example: you turn 65 in July 2025 and enroll in Medicare, with self-only coverage and the $1,000 extra amount. Your limit is $5,300 × 6 ÷ 12 = $2,650.
Worked example 1 (hypothetical): Medicare at 65. Someone with a self-only HDHP turns 65 in July 2026, and Medicare starts July 1. January to June count. Their 2026 limit is ($4,400 + $1,000) × 6 ÷ 12 = $2,700.00.
Worked example 2 (hypothetical): family coverage. A 66-year-old with a family HDHP starts Medicare in July 2027. Their limit is ($9,000 + $1,000) × 6 ÷ 12 = $5,000.00. This assumes a spouse is not also contributing to an HSA: when both spouses are eligible, the IRS splits the family limit between them unless they agree on a different division.
Worked example: the 6-month lookback
All people and dates here are hypothetical.
A 67-year-old still works with a self-only HDHP and has not claimed Social Security. They retire and apply for Social Security in October 2027, and also sign up for Part B. Premium-free Part A is backdated 6 months, to April 2027.
- Months that count: January, February and March 2027.
- Their 2027 limit: ($4,500 + $1,000) × 3 ÷ 12 = $1,375.00.
- If they had already contributed the full $5,500 through payroll, $4,125.00 is excess.
What the excess costs. Excess contributions are not deductible. If they stay in the account, the IRS generally charges a 6% excise tax every year: here, $247.50 a year until it is fixed. To avoid the tax, withdraw the excess and any earnings on it by your tax filing due date, including extensions, and report the earnings as other income.
If they had followed Medicare’s chart and made their last contribution in March 2027, there would be nothing to fix. That is the point of the 6-month rule.
How to use your HSA after you have Medicare
The money in your HSA stays yours after Medicare starts, and it keeps its tax advantages. Medicare.gov says you can withdraw it to help pay your share of costs, like deductibles, premiums, coinsurance or copayments.
Tax-free uses. Withdrawals for qualified medical expenses are tax-free, whether you pay the bill directly from the HSA or reimburse yourself later. The IRS counts only expenses you incur after you establish the HSA.
Premiums. HSA money generally cannot pay insurance premiums, with exceptions. Two matter most after 65:
- Premiums for “Medicare and other health care coverage” if you are 65 or older, in the IRS’s words. That covers what you pay for Medicare itself, such as the Part B premium.
- Long-term care insurance premiums, up to age-based limits that change each year.
The IRS carves out Medigap (Medicare supplement) premiums: they do not count. Also, if you are under 65, Medicare premiums for your spouse who is 65 or older generally do not count.
Worked example 3 (hypothetical). A full year of the 2026 standard Part B premium is $202.90 × 12 = $2,434.80. An account holder who is 65 or older can pay that from the HSA, or take it out to reimburse themselves for premiums deducted from their Social Security. You can pay a Medicare premium bill with an HSA card through your online Medicare account. Our guide to Medicare deducted from Social Security explains the deduction.
Non-medical withdrawals. Money you take out for anything else is taxable income. Before 65 it may also owe an additional 20% tax. After you reach 65, become disabled or die, the 20% does not apply.
No double benefit. If you pay a medical cost with a tax-free HSA withdrawal, you cannot also count it as an itemized medical expense deduction.
A Medicare relative. Medicare offers a Medical Savings Account (MSA) Plan, which Medicare says is similar to an HSA. The IRS calls the account a Medicare Advantage MSA, and only Medicare can put money into it.
A checklist for HSA holders approaching Medicare
- Decide when you will claim Social Security and sign up for Medicare. They are linked: claiming Social Security after 65 brings Part A, and it can be backdated.
- Find the month your Part A will start: 6 months before the month you will apply, but no earlier than the month you turn 65 (the month before, if your birthday is on the 1st). Make your last HSA contribution the month before that.
- Stop employer and payroll contributions too. Tell your benefits office.
- Work out your prorated limit for the year, and check that your total contributions are not above it.
- If you went over, withdraw the excess and its earnings by your tax filing due date.
- Keep receipts. After 65 you can reimburse yourself tax-free for Medicare premiums and other qualified costs.
Your HSA custodian and your employer’s benefits office can confirm the details of your own account and plan.
For what else Medicare will cost you once you enroll, see our guide to how much Medicare costs.
About this guide
Written by the Diversify Guy editorial desk. Diversify Guy is a pen name. It is the byline of our editorial team, not a single individual. We do not publish personal trading records or claim to be your adviser. We tell you where every figure came from so you can check it yourself. How we work and how we get paid.
This guide explains federal Medicare and tax rules as published by the IRS, Medicare.gov, CMS and Social Security. It is not personalized insurance, tax or legal advice. Diversify Guy earns affiliate commissions and advertising fees from companies featured elsewhere on the site. This page carries no ads and no affiliate links.
Sources and check dates
All sources were fetched and checked on November 4, 2026.
- 26 U.S.C. 223, Health savings accounts (govinfo, most recent edition): https://www.govinfo.gov/link/uscode/26/223?type=usc&year=mostrecent&link-type=html
- IRS Publication 969 (2025), Health Savings Accounts and Other Tax-Favored Health Plans: https://www.irs.gov/pub/irs-pdf/p969.pdf
- IRS Instructions for Form 8889 (2025): https://www.irs.gov/pub/irs-pdf/i8889.pdf
- IRS Revenue Procedure 2025-19 (2026 HSA amounts): https://www.irs.gov/pub/irs-drop/rp-25-19.pdf and Revenue Procedure 2026-24 (2027 HSA amounts): https://www.irs.gov/pub/irs-drop/rp-26-24.pdf
- IRS Publication 502 (2025), Medical and Dental Expenses: https://www.irs.gov/pub/irs-pdf/p502.pdf
- Medicare & You 2027, the official Medicare handbook: https://www.medicare.gov/publications/10050-medicare-and-you.pdf
- Medicare.gov, Enrolling in Medicare Part A and Part B (publication 11036): https://www.medicare.gov/publications/11036-enrolling-medicare-part-a-part-b.pdf
- Medicare.gov, Working past 65: https://www.medicare.gov/basics/get-started-with-medicare/medicare-basics/working-past-65
- Medicare.gov, How to pay Part A and Part B premiums: https://www.medicare.gov/basics/costs/pay-premiums
- CMS fact sheet, 2026 Medicare Parts A and B Premiums and Deductibles (November 14, 2025): https://www.cms.gov/newsroom/fact-sheets/2026-medicare-parts-b-premiums-deductibles
- SSA Program Operations Manual System, HI 00801.002, waiver of Part A entitlement by a monthly beneficiary: https://secure.ssa.gov/poms.nsf/lnx/0600801002
About this byline
Diversify Guy is the pen name of our editorial desk, not a person. We do not claim a personal investment track record, we are not advisers, and every claim about a company comes from a source you can check. Who writes this
Spotted an error? Tell us. We fix pages in place and say what changed.

