The short answer
An HSA gets a triple tax advantage: money goes in pre-tax, grows tax-free, and comes out tax-free for medical costs at any age. If you can pay current medical bills from your paycheck or savings, investing the HSA and letting it grow for retirement gives you a tax-free fund for what is often one of the largest costs in retirement.
| HSA | Pre-tax 401(k) | Roth | |
|---|---|---|---|
| Money going in | Pre-tax | Pre-tax | After-tax |
| Growth | Tax-free | Tax-deferred | Tax-free |
| Withdrawals for medical costs | Tax-free | Taxed | Tax-free* |
| Other withdrawals after 65 | Taxed, no penalty | Taxed | Tax-free* |
| Required distributions | None | From 73 or 75 | None |
*Qualified Roth withdrawals. HSA withdrawals for non-medical costs before 65 are taxed plus a 20% penalty. Payroll HSA contributions also skip Social Security and Medicare taxes.
HSA limits for 2026 and 2027
| 2026 | 2027 | |
|---|---|---|
| Contribution limit, self-only | $4,400 | $4,500 |
| Contribution limit, family | $8,750 | $9,000 |
| Catch-up, age 55+ | $1,000 | $1,000 |
| Minimum plan deductible (self / family) | $1,700 / $3,400 | $1,750 / $3,500 |
| Out-of-pocket maximum (self / family) | $8,500 / $17,000 | $8,700 / $17,400 |
Sources: IRS Rev. Proc. 2025-19 (2026) and Rev. Proc. 2026-24 (2027). Employer contributions count toward the limit. Married couples with family coverage share the family limit; each spouse 55+ can add a catch-up to their own HSA.
Who can contribute
You need to be covered by a qualifying high-deductible health plan (HDHP) and have no other disqualifying health coverage, such as a spouse’s general-purpose FSA or Medicare, and not be claimed as someone else’s dependent. Starting in 2026, the 2025 tax law made more people eligible:
- Bronze and catastrophic marketplace plans now count as HSA-eligible, which matters for early retirees and the self-employed buying their own coverage.
- Direct primary care memberships of up to $150 a month ($300 for a family) no longer block contributions, and the fees can be paid from the HSA.
- Telehealth before the deductible is permanently allowed without losing eligibility.
How to invest an HSA for retirement
- Contribute the maximum through payroll if your employer offers it. Payroll contributions avoid the 7.65% Social Security and Medicare tax, which direct contributions do not.
- Keep a cash cushion equal to your deductible, or whatever minimum your provider requires before you can invest.
- Invest the rest for the long term. Money you won’t touch for 15 or 20 years can usually be invested much like the rest of your retirement savings, in low-cost diversified funds.
- Pay today’s medical bills out of pocket when you can, and save every receipt.
- Reimburse yourself later. There is no deadline: you can withdraw tax-free for qualified expenses from years ago, as long as they were incurred after the HSA was opened.
- Move to a better provider if your employer’s HSA has high fees or few funds. A trustee-to-trustee transfer is not taxed and doesn’t count against your limit.
A worked example
A married couple, both age 50, has family HDHP coverage and puts $8,750 a year into an HSA through payroll until 65. They pay their medical bills from cash flow and invest the HSA, earning a hypothetical 6% a year. They are in the 35% federal bracket now and expect 24% in retirement. Compare the same pre-tax dollars in three accounts:
| HSA | Pre-tax 401(k) | Roth | |
|---|---|---|---|
| Invested each year | $8,750 | $8,750 | $5,688 |
| Balance at 65 | $203,665 | $203,665 | $132,394 |
| Tax when spent on medical costs | $0 | $48,880 | $0 |
| Available for medical costs | $203,665 | $154,785 | $132,394 |
Hypothetical illustration only; not a projection of any investment. Assumes level contributions, a 6% annual return, no fees, 35% tax on Roth contributions and 24% on pre-tax withdrawals. Ignores state tax, catch-up contributions, and payroll tax savings, which would add to the HSA’s lead.
That $203,665 would not go unused. Fidelity’s 2026 estimate is that a 65-year-old retiring this year will spend about $185,500 on health care in retirement, or $371,000 for a couple, not counting long-term care.
Is your HSA sitting in cash?
We’ll look at your HSA, 401(k), and Roth together, decide how much to invest and where, and plan which account pays which retirement costs.
Plan my HSA →HSAs and Medicare: the six-month rule
You can’t contribute to an HSA once you are enrolled in any part of Medicare. If you start Social Security at or after 65, you are enrolled in Part A automatically. If you keep working past 65 and enroll in Medicare later, Part A coverage is backdated up to six months (but not before the month you turned 65). Contributions made during those months become excess contributions, subject to a 6% penalty each year until they are removed.
Plan the last contribution
Stop HSA contributions, including your employer’s, six months before you apply for Medicare or Social Security. In the year Medicare starts, your limit is prorated by the months you were eligible.
Once on Medicare, the HSA keeps working. You can use it tax-free for Part B, Part D, and Medicare Advantage premiums, deductibles, copays, dental, vision, hearing aids, and long-term care insurance premiums up to IRS age-based limits. Medicare supplement (Medigap) premiums are not eligible.
What happens to an HSA when you die
A spouse named as beneficiary simply takes over the HSA with the same tax benefits. Anyone else, including children, must report the entire balance as taxable income in the year you die, reduced only by your medical bills they pay within a year. Unlike an inherited IRA, there is no 10-year window to spread the tax out.
The practical result: an HSA is best spent during your lifetime, ideally by the surviving spouse. When you plan which accounts to draw down first, use the HSA for medical costs and leave Roth accounts, which heirs inherit tax-free, for last.
Using an IRA to fund an HSA, once
Once in your lifetime, you can move money from a traditional IRA directly into your HSA, up to that year’s contribution limit. It counts against that year’s limit, and you must stay HSA-eligible for the following 12 months. It turns taxable IRA dollars into tax-free medical dollars without a deduction, so it helps most when you can’t fund the HSA from cash.
Pennsylvania vs. New Jersey
Pennsylvania follows the federal rules. Contributions can be deducted on PA Schedule O, payroll contributions are excluded from PA wages, and withdrawals that are tax-free federally aren’t taxed by the state. See our Pennsylvania retirement tax guide for how PA treats other accounts.
New Jersey (like California) does not recognize HSAs. Contributions are included in New Jersey income, and interest, dividends, and gains in the account are taxed by the state each year. The federal advantage still applies, and for most families it far outweighs the state tax.
How Rubiq helps
An HSA works best as part of a whole retirement plan. We look at your HSA alongside your 401(k), IRAs, and Roth conversion plans, decide how to invest it, plan the last contribution before Medicare, and set a withdrawal order that keeps taxes and Medicare premiums low. See retirement planning at Rubiq, and our guide to the Rule of 55 if you plan to retire early.
Frequently asked questions
What is the HSA triple tax advantage?
Contributions are made pre-tax or are tax-deductible, the money grows without tax on interest, dividends, or gains, and withdrawals are tax-free when used for qualified medical expenses. Contributions made through payroll also avoid Social Security and Medicare taxes. No other account gets all three.
Can you invest money in an HSA?
Yes. Most HSA providers let you invest in mutual funds or ETFs once your cash balance passes a set minimum, often $1,000 to $2,000. If your employer’s HSA has limited or expensive investment choices, you can usually move money to another HSA provider through a trustee-to-trustee transfer while still contributing through payroll.
What are the HSA contribution limits for 2026 and 2027?
For 2026 the limit is $4,400 for self-only coverage and $8,750 for family coverage. For 2027 it rises to $4,500 and $9,000. People age 55 or older can add a $1,000 catch-up contribution each year. Employer contributions count toward the limit.
What happens to an HSA after age 65?
You can still use it tax-free for qualified medical expenses, including Medicare Part B, Part D, and Medicare Advantage premiums. Withdrawals for anything else are taxed as ordinary income, like a traditional IRA, but the 20% penalty that applies before 65 no longer does. HSAs have no required minimum distributions.
Can I contribute to an HSA while on Medicare?
No. Once you enroll in any part of Medicare, you can no longer contribute, although you can keep spending and investing the balance. If you enroll in Medicare after 65, Part A coverage can be backdated up to six months, so stop HSA contributions six months before you apply to avoid an excess contribution.
Is there a deadline to reimburse myself from an HSA?
No. You can reimburse yourself tax-free years later for qualified expenses incurred after the HSA was established, as long as you were not reimbursed elsewhere and did not deduct them. Keep receipts and records that show the expense, the date, and that it was paid out of pocket.
What happens to an HSA when you die?
If your spouse is the beneficiary, the account becomes your spouse’s HSA with the same tax benefits. Any other beneficiary must include the full value in taxable income for the year of death, reduced by your qualified medical expenses they pay within one year. For that reason, many families plan to spend the HSA during their own lifetimes.
Does Pennsylvania tax HSA contributions?
No. Pennsylvania follows the federal treatment: deductible contributions can be deducted on PA Schedule O, and withdrawals that are tax-free federally are not taxed by Pennsylvania. New Jersey and California do not follow the federal rules, so residents there pay state income tax on contributions and account earnings.