Quick answer: You cannot contribute to a health savings account (HSA) for any month you are enrolled in Medicare. If you sign up for Part A, or for Social Security, more than six months after the month you turn 65, Part A is backdated six months, so contributions for those months become excess. Your yearly limit is 1/12 of the annual amount for each month before Medicare starts: for 2027, that is $458.33 a month on the $5,500 self-only limit at 55 or older.
Data as of November 18, 2026, from 26 U.S.C. 223 and 4973, IRS Rev. Proc. 2026-24, Publication 969 and 42 CFR 406.6. Examples are hypothetical, assume a calendar tax year and ignore state tax.
Why contributions stop when Medicare starts
The tax code sets the HSA limit month by month. Under 26 U.S.C. 223(b)(2), each month’s limit is 1/12 of the annual amount, and section 223(b)(7) sets that monthly limit at zero starting with the first month you are entitled to Medicare benefits. Publication 969 puts it this way: “Beginning with the first month you are enrolled in Medicare, your contribution limit is zero.”
Two details matter:
- Enrollment, not age. IRS Notice 2004-50 says that being eligible for Medicare at 65 does not end HSA eligibility; being enrolled does. A 66-year-old who is still on an employer’s high deductible health plan (HDHP) and has not enrolled in any part of Medicare can keep contributing, including the $1,000 catch-up.
- Any part counts. The same notice says a person with Part B only is not eligible, and Notice 2008-59 says the same for Part D.
Social Security is the usual trap. Under 42 CFR 406.6(b), someone who is receiving monthly Social Security benefits at 65, or who starts them after 65, does not file a separate Part A application; Part A comes with the benefits. Notice 2004-50 gives the example of a person who turns 65, starts Social Security and “is automatically enrolled in Medicare.”
Where the six months come from
Medicare rules, not tax rules, create the lookback. Under 42 CFR 406.6(d)(4), a Part A application filed within six months after your first month of eligibility is retroactive to that first month. If it is “filed more than 6 months after that first month, it is retroactive to the 6th month before the month of filing.” Social Security retirement applications can reach back in a similar way: 20 CFR 404.621 allows benefits for up to six months before the month of filing.
The IRS applies the HSA rule to those backdated months. Publication 969 says the zero limit “applies to periods of retroactive Medicare coverage,” and a 2016 IRS Chief Counsel letter adds: “There are no exceptions to this rule.” So:
- Apply in July 2027 at age 66 or older, and Part A starts January 1, 2027.
- Apply four months after the month you turned 65, and Part A starts in the month you turned 65. Coverage never reaches back before that month.
That is why Medicare.gov tells people working past 65 to stop HSA contributions six months before they retire or apply for benefits.
2027 limits, pro-rated by month
Rev. Proc. 2026-24 sets the 2027 limits at $4,500 for self-only HDHP coverage and $9,000 for family coverage. The statute adds $1,000 at age 55 or older, so anyone near Medicare age is working with $5,500 or $10,000. (The full list is in our 2027 HSA contribution limits guide.) Publication 969’s own example pro-rates the whole amount, catch-up included: limit × eligible months ÷ 12. Employer contributions count toward the result.
| Part A starts | Filing month that reaches back to it (late applicants) | Eligible months in 2027 | Self-only ($5,500) | Family ($10,000) |
|---|---|---|---|---|
| January 2027 | July 2027 | 0 | $0.00 | $0.00 |
| February 2027 | August 2027 | 1 | $458.33 | $833.33 |
| March 2027 | September 2027 | 2 | $916.67 | $1,666.67 |
| April 2027 | October 2027 | 3 | $1,375.00 | $2,500.00 |
| May 2027 | November 2027 | 4 | $1,833.33 | $3,333.33 |
| June 2027 | December 2027 | 5 | $2,291.67 | $4,166.67 |
| July 2027 | January 2028 | 6 | $2,750.00 | $5,000.00 |
| August 2027 | February 2028 | 7 | $3,208.33 | $5,833.33 |
| September 2027 | March 2028 | 8 | $3,666.67 | $6,666.67 |
| October 2027 | April 2028 | 9 | $4,125.00 | $7,500.00 |
| November 2027 | May 2028 | 10 | $4,583.33 | $8,333.33 |
| December 2027 | June 2028 | 11 | $5,041.67 | $9,166.67 |
| Not in 2027 | July 2028 or later | 12 | $5,500.00 | $10,000.00 |
The second column applies to people filing more than six months after turning 65. Note the last rows: an application filed in early 2028 can still cut your 2027 limit.
Three worked examples
1. Retiring and applying in July 2027
Dana is 67, has self-only HDHP coverage, and puts $2,750 into her HSA through payroll from January through June 2027. She retires and files for Medicare in July. Part A is retroactive to the sixth month before July, which is January 2027. Eligible months: 0. Allowed contribution: $5,500 × 0 ÷ 12 = $0. The full $2,750 is an excess contribution. With family coverage the answer is the same: $10,000 × 0 ÷ 12 = $0.
2. Stopping six months ahead
Lee is 68 and plans to retire and file in October 2027. Part A will reach back to April 2027, so Lee’s last eligible month is March. Eligible months: 3. Allowed contribution: $5,500 × 3 ÷ 12 = $1,375 self-only, or $10,000 × 3 ÷ 12 = $2,500 with family coverage. Lee contributes $458.33 a month for January through March ($1,374.99) and stops. No excess.
3. Turning 65 mid-year and enrolling on time
Sam turns 65 on August 20, 2027, and signs up for Medicare that month. Part A starts August 1. Eligible months: 7 (January through July). Allowed contribution: $5,500 × 7 ÷ 12 = $3,208.33 self-only, or $10,000 × 7 ÷ 12 = $5,833.33 family. If Sam had waited until December to apply, the answer would not change: an application filed within six months is retroactive to the first month of eligibility, here August.
If you already contributed too much
Publication 969 says excess contributions are not deductible and generally carry a 6% excise tax, which 26 U.S.C. 4973 imposes for each tax year the excess stays in the account. In example 1, that is $2,750 × 6% = $165 for 2027, and again for each later year the excess is left in the account.
You avoid the tax by withdrawing the excess, plus any income it earned, by the due date of your 2027 return, including extensions. You cannot deduct the withdrawn contributions, and the earnings are reported as other income for the year you withdraw them. Excess that went in pre-tax through an employer has to be included in income as well. Ask your HSA custodian for a “removal of excess contribution” so it is coded correctly.
You can still spend the HSA, and a spouse may still contribute
Medicare ends contributions, not the account. Withdrawals for qualified medical expenses stay tax-free. Once the account holder is 65, section 223(d)(2)(C) also lets the HSA pay health insurance premiums “other than a medicare supplemental policy.” Publication 969 lists Medicare premiums as allowed and Medigap premiums as not allowed; Notice 2008-59 confirms Part D premiums, and Notice 2004-50 says you can reimburse yourself for Medicare premiums deducted from your Social Security payment. See our 2027 Medicare Part B premium page for the amount. After 65, non-medical withdrawals are taxed as income but no longer carry the 20% additional tax.
Your Medicare enrollment does not end your spouse’s eligibility. Notice 2008-59 says an eligible person with family HDHP coverage can contribute the full family limit even if the spouse covered by the plan has Medicare. The money must go into the eligible spouse’s own HSA, since Publication 969 says there is no joint HSA.
Common mistakes
- Contributing right up to the retirement date, then applying for Medicare or Social Security after 65½.
- Front-loading the full annual amount in January of the year Medicare starts.
- Forgetting that starting Social Security after 65 brings Part A with it, backdated up to six months.
- Letting employer contributions continue. They count toward the pro-rated limit.
- Counting on the December 1 “last-month rule.” It needs eligibility on December 1, which Medicare enrollees do not have.
- Leaving excess in the account. The 6% tax repeats every year.
- Paying Medigap premiums from the HSA and treating them as qualified.
Frequently asked questions
Can I contribute to an HSA after 65?
Yes, if you have HDHP coverage and are not enrolled in any part of Medicare. Age alone does not end eligibility.
When exactly should I stop contributing?
If you will apply more than six months after turning 65, treat the sixth month before your filing month as your first Medicare month. Your limit for the year is 1/12 of the annual amount for each month before it.
Can I turn down the retroactive Part A coverage?
The IRS letter says there are no exceptions on the tax side. The practical fix is to stop contributions ahead of time or remove the excess by the return due date.
Can I pay my spouse’s Medicare premiums from my HSA?
Only if you, the account holder, are 65 or older. Notice 2008-59 says that if you are under 65, a spouse’s Medicare premiums are generally not qualified expenses.
Sources
- 26 U.S.C. 223, Health savings accounts: https://www.law.cornell.edu/uscode/text/26/223
- 26 U.S.C. 4973, Tax on excess contributions: https://www.law.cornell.edu/uscode/text/26/4973
- IRS, Rev. Proc. 2026-24, 2027 HSA amounts, section 3.01: https://www.irs.gov/pub/irs-drop/rp-26-24.pdf
- IRS, Publication 969, Health Savings Accounts and Other Tax-Favored Health Plans: https://www.irs.gov/publications/p969
- IRS, Instructions for Form 8889: https://www.irs.gov/instructions/i8889
- 42 CFR 406.6, Application or enrollment for hospital insurance: https://www.law.cornell.edu/cfr/text/42/406.6
- 20 CFR 404.621, retroactive effect of a Social Security application: https://www.law.cornell.edu/cfr/text/20/404.621
- IRS Office of Chief Counsel, letter 2016-0082, retroactive Medicare and HSA contributions: https://www.irs.gov/pub/irs-wd/16-0082.pdf
- IRS, Notice 2004-50, Q&A 2, 4 and 45: https://www.irs.gov/pub/irs-drop/n-04-50.pdf
- IRS, Notice 2008-59, Q&A 6, 16, 29 and 30: https://www.irs.gov/pub/irs-drop/n-08-59.pdf
- Medicare.gov, Working past 65: https://www.medicare.gov/basics/get-started-with-medicare/medicare-basics/working-past-65
General information, not financial or tax advice. Confirm your Medicare start date with Social Security before making or removing HSA contributions.