HSA vs 401(k): Which Should You Max Out First?
A practical order of operations for prioritizing tax-advantaged accounts when you can't max out both.
The real question isn't "HSA or 401(k)" — it's what order
Most people don't get to max out every tax-advantaged account they're eligible for in the same year. Between a high-deductible health plan's Health Savings Account (HSA) and a workplace 401(k), the honest question is which dollar goes in first when money is limited. The two accounts aren't competitors — they solve different problems — but because contribution room is finite, the order you fund them in changes how much you keep over a working lifetime.
This guide walks through the decision in the order that actually matters: employer match first, then the account with the rarer tax treatment, then whichever has room left. None of this is investment advice — it's arithmetic about tax rules that apply whether markets go up or down.
HSA Calculator: 2026 Contribution Limits & FICA Savings
Estimate how much a payroll HSA contribution actually saves you after taxes.
Why the HSA gets called "triple tax-advantaged"
A 401(k) and a traditional IRA each give you one tax break: money goes in pre-tax (or grows tax-deferred), and you pay ordinary income tax when you withdraw it in retirement. A Roth account flips that — you pay tax going in, and withdrawals are tax-free. Either way, you get exactly one favorable tax event.
An HSA is the only account type that stacks three:
- Contributions are pre-tax (or tax-deductible if you contribute outside payroll).
- Growth inside the account is tax-free — dividends, interest, and capital gains are never taxed as long as the money stays in the HSA.
- Withdrawals are tax-free too, as long as they're used for qualified medical expenses — at any age, not just after 65.
That third point is what makes an HSA structurally better than a 401(k) or IRA for the specific dollars you'll spend on healthcare. There's no other account in the U.S. tax code that lets money go in untaxed, grow untaxed, and come out untaxed for its intended purpose. After age 65, an HSA even behaves like a traditional IRA for non-medical withdrawals — you just pay ordinary income tax, with no penalty — so the downside case isn't much worse than a 401(k) either.
The catch is eligibility. You can only contribute to an HSA if you're enrolled in a qualifying high-deductible health plan (HDHP). If your employer only offers a traditional PPO or HMO, this entire conversation is moot for you — you don't have access to an HSA, and the choice becomes 401(k) versus taxable savings instead.
Step one, always: capture the employer match
Before comparing HSA and 401(k) tax treatment, there's a step that comes first regardless of account type: any 401(k) contribution your employer matches dollar-for- dollar (or fifty cents on the dollar, or whatever your plan offers) is an immediate, guaranteed return that no HSA, IRA, or brokerage account can compete with. If your employer matches the first 4% of pay and you contribute 0%, you're leaving free money on the table before any tax-optimization discussion is even relevant.
This is the one universal rule in account-prioritization advice: contribute enough to your 401(k) to get the full match first, then move to the next decision. Skipping this step to fund an HSA "more efficiently" almost never wins — a guaranteed 50–100% return on the matched dollars outperforms the marginal tax benefit of routing that same dollar elsewhere.
401(k) Retirement Calculator
See how employer-match dollars compound over your remaining working years.
After the match: HSA next, if you're HDHP-eligible
Once you've captured the match, the HSA usually earns the next dollar — again, only if you're eligible for one. For 2026, the contribution limits are $4400 for self-only HDHP coverage and $8750 for family coverage, with an additional $1000 catch-up contribution allowed once you turn 55. These limits apply per household, not per employer, so if you and a spouse both have HDHP coverage the family limit is a combined cap, not a per-person one.
Why the HSA ranks above additional 401(k) contributions (beyond the match) for most households: the triple-tax-advantage structure described above simply isn't available anywhere else. A traditional 401(k) contribution defers tax once; an HSA contribution used for medical expenses skips tax at every stage. Even if you never spend a dollar of it on healthcare, you can invest an HSA balance the same way you'd invest a 401(k), and after 65 the account behaves like a traditional IRA for any purpose — so there's no real scenario where over-funding an HSA "traps" the money badly.
One more reason the HSA earns priority: unlike a Flexible Spending Account, HSA balances roll over every year and are yours permanently, even if you change jobs or health plans. There's no "use it or lose it" deadline.
Payroll contributions save FICA too — a detail 401(k) contributions don't get
Here's a wrinkle that specifically favors funding an HSA through payroll deduction (a "cafeteria plan" or Section 125 arrangement) rather than writing a check to the HSA provider directly: payroll HSA contributions are typically exempt from Social Security and Medicare tax as well as federal income tax, while a traditional 401(k) contribution only avoids federal (and usually state) income tax — FICA still applies.
Concretely, FICA is 6.2% for Social Security and 1.45% for Medicare, a combined 7.65% employee-side tax that a payroll HSA contribution sidesteps but a 401(k) contribution does not. On a $5,000 annual HSA contribution made through payroll, that's real money — roughly $5,000 × 7.65% in avoided FICA tax, on top of the income tax savings both accounts already provide. If your payroll system lets you elect HSA contributions as a payroll deduction rather than an after-tax transfer, that option is almost always worth taking.
Once the HSA is funded: back to the 401(k)
After you've captured the match and funded your HSA to the level you're comfortable with, additional dollars typically go back to the 401(k) — especially if you're not yet at the plan's elective deferral limit. For 2026, employees can defer up to $24,500 of their own pay into a 401(k), separate from any employer match or profit-sharing contribution, which doesn't count against that employee limit.
If your 401(k) offers a Roth option and you're early in your career (likely in a lower tax bracket now than in retirement), a Roth 401(k) contribution can make more sense than a traditional pre-tax one — you pay tax on the contribution now, at what may be a lower rate than you'll face later, in exchange for tax-free withdrawals down the road.
Traditional vs Roth IRA Calculator
Compare paying tax now versus later once your 401(k) match and HSA are covered.
Putting the order of operations together
For most people with access to both an HSA-eligible HDHP and a 401(k) with an employer match, a reasonable funding order looks like this:
- Contribute enough to the 401(k) to capture the full employer match.
- Fund the HSA — ideally through payroll deduction to also save on FICA — up to your comfort level, potentially the full annual limit if cash flow allows.
- Return to the 401(k) and increase contributions toward the annual elective deferral limit, choosing traditional or Roth based on your current versus expected future tax bracket.
- If there's still room after all of that, a taxable brokerage account or an IRA outside your workplace plan can absorb additional savings.
This order isn't a rigid law — someone with high, predictable medical expenses might prioritize the HSA differently than someone who's rarely sick and views it purely as a retirement wrapper. But the sequencing above reflects the actual tax mechanics of each account, not a rule of thumb detached from how the accounts are taxed. When cash is tight, funding in this order captures the largest guaranteed and structural advantages first, and leaves the more discretionary decisions — Roth versus traditional, how much to hold in cash versus invest — for the dollars that come after.