HSA vs. 401(k): Which Should You Fund First?

An HSA beats a 401(k) on taxes but loses on flexibility and size. Here's the funding order that actually makes sense for most people.

"Max your HSA before your 401(k)" is advice you'll see repeated confidently across personal finance forums. It's directionally right and wrong often enough to be worth examining properly, because the answer depends on details that the slogan skips.

Here's the honest comparison.

The tax math genuinely favors the HSA

A traditional 401(k) is taxed once. Contributions go in pre-tax, growth is deferred, and withdrawals in retirement are taxed as ordinary income. It's a deferral, not an exemption.

A Roth 401(k) is also taxed once, at the other end — after-tax contributions, tax-free withdrawals.

An HSA used for medical expenses is taxed zero times:

  1. Contributions are deductible (and via payroll deferral, exempt from FICA too)
  2. Growth is untaxed
  3. Withdrawals for qualified medical expenses are untaxed

No other account does all three. That's the triple tax advantage, and it isn't marketing — it's structurally unmatched.

The FICA point deserves emphasis because it's routinely omitted. Contributing through your employer's payroll deduction avoids Social Security and Medicare tax — an extra 7.65% saved that a 401(k) contribution does not give you. Contributing to an HSA directly from your bank account gets you the income tax deduction but not the FICA savings. If you have payroll access, use it.

And after 65, an HSA's worst case is a traditional 401(k)'s normal case: the 20% penalty disappears and non-medical withdrawals are simply taxed as income. So the HSA does everything a 401(k) does, plus it has a tax-free lane on top. On tax treatment alone, it is strictly superior.

But the 401(k) wins on the things that constrain you

Contribution limits aren't close. For 2026 an HSA caps at $4,400 self-only or $8,750 family. A 401(k) allows well over $23,000 in employee deferrals. If you're trying to save $30,000 a year for retirement, the HSA physically cannot hold it. It's a supplement, not a foundation.

The employer match is free money. A 50% or 100% match on your 401(k) contributions is an instant guaranteed return that no tax advantage can compete with. Nothing in the HSA's favor overcomes leaving a match unclaimed.

Eligibility is conditional. You can only contribute to an HSA while covered by a qualifying HDHP. Change to a PPO, or enroll in Medicare, and contributions stop — see what happens at 65 for how abruptly that arrives. Your 401(k) eligibility just depends on having a job.

HSA money has strings. Tax-free withdrawals require qualified medical expenses and documentation to prove it. 401(k) withdrawals in retirement require nothing but being old enough.

The funding order that actually works

For most people with access to both, this sequence holds up:

1. 401(k) up to the full employer match. A guaranteed 50–100% return beats every tax consideration. Never skip this step.

2. Max the HSA. Best tax treatment available, and the limit is small enough to be achievable. Contribute via payroll for the FICA savings.

3. Back to the 401(k), toward the annual limit. This is where the bulk of retirement savings has to live, simply because of the size of the limit.

4. IRA, taxable brokerage, and so on.

The logic: capture the match because it's free, then fill the most tax-efficient bucket, then use the largest bucket for volume.

Where the order should change

You can't afford to leave the HSA invested. The whole argument for prioritizing an HSA assumes the money compounds for decades. If you're going to spend the balance on this year's medical bills, the growth advantage never materializes. You still get the deduction — that's real — but there's no reason to prioritize it over a 401(k). Our post on investing your HSA balance covers what leaving it in cash actually costs.

Your HSA provider is bad. Many custodians charge monthly maintenance fees, require a $1,000–$2,000 cash minimum before you can invest anything, and offer a narrow fund menu with high expense ratios. A 0.75% expense ratio and a $4/month fee can eat a meaningful share of a small balance. Check your provider's actual terms before assuming the theoretical advantage survives contact with reality. You can usually transfer to a better custodian — see rollovers vs. transfers.

You're close to 65 and healthy with a small balance. Less runway means less compounding, and the HSA's edge shrinks toward the 401(k)'s.

Cash flow is tight. Prioritizing an HSA means paying medical bills out of pocket while the balance stays invested. If that would mean carrying credit card debt, stop — 22% interest destroys any tax arbitrage you're protecting.

The state tax footnote

HSA contributions are deductible federally in every state, but California and New Jersey do not conform — they tax HSA contributions and earnings at the state level. If you live in either, the HSA is a strong federal play and a mediocre state one. It doesn't reverse the ordering, but it narrows the gap enough to matter if you're on the fence.

Why "both" is usually the right answer

Framing this as a competition is slightly misleading. These accounts are complementary, and there's an argument for the HSA that has nothing to do with tax rates.

Healthcare is the single largest and least predictable expense category in retirement. An HSA is the only account purpose-built for it, with no required minimum distributions, no withdrawal deadline, and — if you've kept your receipts — a stack of documented expenses you can convert to tax-free cash at any time.

That last part is the piece people underestimate. A 401(k) balance is worth what it's worth. An HSA balance backed by twenty years of organized receipts is worth more than the same balance with no records, because the receipts are what determine whether withdrawals come out tax-free or as ordinary income.

Same dollars. Different outcome. Decided entirely by documentation — which is the specific problem SaveMyHSA solves.

This is general information, not investment or tax advice. Your circumstances differ — talk to a qualified advisor before restructuring your savings.

Related