An HSA is open only to someone who is not on Medicare: the tax code sets the contribution limit to zero for the first month you are entitled to Medicare and every month after it (26 U.S.C. 223(b)(7)). The rule people trip over is not the age-65 one. It is that Part A, the premium-free hospital coverage, starts up to 6 months before the month you sign up for it or apply for Social Security, so waiting to apply does not buy 6 more months of HSA contributions. The figures below come from the engine behind the HSA contribution limit calculator, which reproduces the examples in IRS Publication 969, with the 2027 amounts for a self-only plan and the $1,000 catch-up for people 55 and older: $5,500 a year, $458.33 for each month before Medicare starts.
The year you turn 65: your birth month sets the limit
For someone who is on Medicare from the month of their 65th birthday (Medicare counts you as 65 the day before the birthday, so a birthday on the 1st counts as the month before), the 2027 limit is one twelfth for each month before it. The last-month rule is no help here, because it needs you to be eligible on December 1 and you are not.
| Born in 1962, in | Medicare starts | Self-only | Family |
|---|---|---|---|
| January | January 2027 | $0 | $0 |
| February | February 2027 | $458.33 | $833.33 |
| March | March 2027 | $916.67 | $1,666.67 |
| April | April 2027 | $1,375 | $2,500 |
| May | May 2027 | $1,833.33 | $3,333.33 |
| June | June 2027 | $2,291.67 | $4,166.67 |
| July | July 2027 | $2,750 | $5,000 |
| August | August 2027 | $3,208.33 | $5,833.33 |
| September | September 2027 | $3,666.67 | $6,666.67 |
| October | October 2027 | $4,125 | $7,500 |
| November | November 2027 | $4,583.33 | $8,333.33 |
| December | December 2027 | $5,041.67 | $9,166.67 |
Example from IRS Publication 969: turned 65 in July, self-only, with the catch-up: $5,300 × 6 ÷ 12 = $2,650 (2025 amounts). If you are on Medicare and your spouse is not, they are not held to a shared split: the married-people rules apply only when both spouses are eligible (Publication 969).
Applying later does not buy more months
Premium-free Part A starts 6 months back from when you sign up or apply for Social Security benefits, and can't start before the month you turned 65 (Medicare.gov; 42 CFR 406.6(d)(4)). IRS Publication 969 says contributions for months of retroactive coverage are excess contributions. For a person born in June 1962, who turns 65 in June 2027:
| Apply in | Part A starts | Last HSA month | 2027 limit | Excess if $5,500 went in |
|---|---|---|---|---|
| June to December 2027 | June 2027 | May 2027 | $2,291.67 | $3,208.33 (6% = $192.50 a year) |
| January 2028 | July 2027 | June 2027 | $2,750 | $2,750 (6% = $165 a year) |
| February 2028 | August 2027 | July 2027 | $3,208.33 | $2,291.67 (6% = $137.50 a year) |
| March 2028 | September 2027 | August 2027 | $3,666.67 | $1,833.33 (6% = $110 a year) |
| April 2028 | October 2027 | September 2027 | $4,125 | $1,375 (6% = $82.50 a year) |
| May 2028 | November 2027 | October 2027 | $4,583.33 | $916.67 (6% = $55 a year) |
| June 2028 | December 2027 | November 2027 | $5,041.67 | $458.33 (6% = $27.50 a year) |
| July 2028 | January 2028 | December 2027 | $5,500 | none |
Read it from the top: applying anywhere from June to December 2027 gives the same Part A start (June 2027), so the 2027 limit is $2,291.67, and the first 6 months of waiting add nothing. Each month of delay after that gives back one month of eligibility ($458.33). A person who applied in December 2027 after putting in the whole $5,500 would have $3,208.33 over the limit, taxed at 6% ($192.50) for each year it stays in. Withdrawing the excess and its earnings by the due date of the return (with extensions) avoids the tax, and the earnings are taxed as other income (Form 8889 instructions).
Medicare.gov gives the same practical advice: if you have an HSA, you and your employer should stop contributing 6 months before you retire or apply for Social Security (or Railroad Retirement) benefits. The same look-back applies when you apply for Social Security itself, because that application also starts Part A. This table assumes premium-free Part A; if you have to buy Part A, the rules differ and are not modelled here.
Starting an HSA at 64: the last-month rule can backfire
The last-month rule lets you contribute the full-year amount if you are eligible on December 1, but you must stay eligible through December 31 of the following year, 13 months (26 U.S.C. 223(b)(8)). Medicare entitlement ends eligibility, so if Medicare starts inside that period the contributions that were possible only because of the rule become income. A worked case, from the engine: a person born in June 1962 who starts a self-only HDHP on December 1, 2026 can put in $5,400 for 2026 (the $4,400 limit plus the $1,000 catch-up). Medicare starts in June 2027, inside the testing period, so what counts as 2026 eligibility is one month: $450. The other $4,950 is added to 2027 income, plus a 10% additional tax of $495.
The IRS publications do not print a Medicare example of the testing period. The conclusion rests on the statute's own words: failing to be an eligible individual in any month of the period counts, except for death or disability, and a person entitled to Medicare is not eligible. Whether an HSA is worth opening at 64 for other reasons is a separate question; this only shows what the last-month rule costs if Medicare is coming.
What this does not cover
It is the arithmetic of the rule, not advice on when to sign up for Medicare or stop contributing. It assumes one person with a self-only plan (the calculator handles family coverage, employer contributions and spouses), 2027 amounts and a birth year of 1962 for the tables (the answer depends only on the birth month and the application month), and premium-free Part A. It does not model Part A that is bought, Medicare based on disability or kidney failure, someone already on Medicare for another reason, or a spouse's own timing. The statute and the Form 8889 instructions speak of any entitlement to or enrollment in Medicare; this guide follows the Part A start date because that is the one with the retroactive rule. Confirm your own dates with Social Security and your HSA custodian.
Sources
- 26 U.S. Code § 223(b)(7) and (b)(8) — the HSA limit is zero from the first month of Medicare entitlement; the last-month rule and its testing period
- Medicare.gov — When does Medicare coverage start?: signing up for premium-free Part A later, coverage starts 6 months back from when you sign up or apply for Social Security, and cannot start earlier than the month you turned 65
- Medicare.gov — Working past 65: stop contributing to an HSA 6 months before you retire or apply for Social Security, to avoid a tax penalty
- 42 CFR § 406.6(d)(4) — an application for premium-free hospital insurance based on Social Security eligibility is retroactive to the 6th month before the month it is filed
- IRS Publication 969 (2025) — Medicare and the HSA limit (the age-65-in-July example), retroactive coverage and excess contributions, the last-month rule and testing period examples
- IRS Instructions for Form 8889 (2025) — the Line 3 Limitation Chart and Worksheet (a Medicare month earns nothing), Part III, the 6% tax on excess contributions (Form 5329)
- IRS Rev. Proc. 2025-19 (2026: $4,400 / $8,750) and Rev. Proc. 2026-24 (2027: $4,500 / $9,000)
- 42 CFR § 407.10 — a person attains age 65 on the day before the 65th birthday (so a birthday on the 1st counts as the month before)