HSA vs. 401(k): Which Account Should Get Your Next Dollar

One account is funded straight from payroll up to an IRS cap; the other first requires a qualifying health plan — and only one of them can pay a doctor tax-free.

By Desmond Okafor · Oct 06, 2026 · 9 min read

Featured image for "HSA vs. 401(k): Which Account Should Get Your Next Dollar"

An HSA and a 401(k) both shelter money from tax, but they are gated differently: the 401(k) needs an employer plan, and the HSA needs you to be covered by a high-deductible health plan and off Medicare. Each has its own IRS contribution cap for the year, its own penalty for taking money out early, and its own deadline that closes for good on December 31.

This guide lays out what each account does to your taxes going in and coming out, what the 2025 limits are, what it costs to pull money back out, and which reader traits — age, employment status, filing status, expected bracket later — point to one over the other.

Why This Decision Is Hard to Reverse

The part you cannot undo is the calendar. Both accounts have an annual cap set by the IRS, and an unused year is gone — there is no mechanism to go back in 2027 and fill in the 2025 room you skipped.

For 2025, self-only high-deductible health plan (HDHP) coverage allows up to $4,300 into an HSA, and family coverage allows up to $8,550 (Internal Revenue Service, 2025). The 401(k) elective deferral limit for 2025 is $23,500 (Internal Revenue Service, 2025), and 401(k) deferrals have to come out of a paycheck issued during the plan year — you cannot write a check in April to catch up the way you can with an IRA.

HSA eligibility is the tighter of the two gates, and it can close permanently. To contribute you must be covered by an HDHP, have no other disqualifying coverage, not be enrolled in Medicare, and not be claimable as a dependent on someone else's 2025 return (Internal Revenue Service, 2025). Health plan elections usually happen once a year at open enrollment, so choosing a non-HDHP plan for 2025 typically forecloses HSA contributions for the whole year. If you are 55 or older, each skipped year also skips the extra $1,000 the IRS allows at that age (Internal Revenue Service, 2025).

Taking money back out is where the arithmetic bites. Pull $4,000 out of an HSA at age 45 for something that is not a qualified medical expense and the IRS treats it as income and adds a 20% additional tax — $800 on top of whatever your ordinary income tax on the $4,000 comes to (Internal Revenue Service, 2025). Pull $4,000 out of a pretax 401(k) before age 59½ and the usual result is a 10% early distribution penalty — $400 — plus ordinary income tax on the full amount (NerdWallet). The HSA penalty is twice as steep, but it disappears entirely after disability, age 65, or death (Internal Revenue Service, 2025), while the 401(k) penalty persists until 59½.

So the irreversible decisions are: which health plan you elect for the year, and how much of this year's paycheck you route to each cap before December 31. The choice of investments inside either account is not irreversible. The year is.

Side-by-Side

Pretax and Roth are labelled separately below, because the 401(k) column changes completely depending on which one your plan offers and which you elect.

RuleHSATraditional 401(k) (pretax)Roth 401(k) (after-tax)
ContributionsDeductible even if you do not itemize on Schedule A; employer contributions, including through a cafeteria plan, are excluded from gross income (Internal Revenue Service, 2025)Deferred from pay before federal income tax, lowering this year's taxable wagesWithheld from pay after federal income tax; no deduction this year
GrowthInterest and other earnings on HSA assets are tax free (Internal Revenue Service, 2025)No tax inside the plan; tax is deferred to distributionNo tax inside the plan
WithdrawalsTax free for qualified medical expenses incurred after the HSA was established (Internal Revenue Service, 2025)Taxed as ordinary income in the year receivedQualified distributions are tax free once the IRS age and holding-period conditions are met; confirm both with your plan administrator before relying on it
2025 annual limit$4,300 self-only HDHP coverage, $8,550 family coverage (Internal Revenue Service, 2025)$23,500 elective deferral, shared across all 401(k) plans you participate in (Internal Revenue Service, 2025)Same $23,500 ceiling, shared with any pretax deferrals
Age-based extraPlus $1,000 if you are 55 or older at the end of the tax year (Internal Revenue Service, 2025)$7,500 catch-up at age 50 and over for 2025 (CNBC, November 2024); for 2026 the standard catch-up is $8,000 and the limit for ages 60-63 is $11,250 (Internal Revenue Service)Same catch-up amounts if your plan accepts Roth catch-up
Early withdrawalNon-medical distributions are taxed as income plus an additional 20% tax; the 20% does not apply after disability, age 65, or death (Internal Revenue Service, 2025)Generally a 10% early distribution penalty before age 59½, plus income tax on the whole amount (NerdWallet)Earnings in a non-qualified distribution are taxable and generally face the same 10% early distribution tax before age 59½
Eligibility gate2025 HDHP minimum deductible of $1,650 self-only or $3,300 family, with out-of-pocket maximums of $8,300 and $16,600; no Medicare enrollment; not a dependent on another 2025 return (Internal Revenue Service, 2025)Your employer must sponsor a plan, and the plan document sets entry dates and vestingOnly available if your employer has added a Roth option to the plan
OwnershipYours regardless of employer; each spouse who wants one must open a separate HSA, since a joint HSA is not allowed (Internal Revenue Service, 2025)Held inside the employer's plan until you roll it outHeld inside the employer's plan
Who sets the ruleIRS sets the limits and the 20% tax; your custodian sets the investment menu and any cash balance required before investingIRS sets the $23,500 cap; the employer plan sets the match formula, loans, and vestingIRS sets the tax rules; the employer plan decides whether Roth exists at all

One note on preventive care: an HDHP may cover preventive benefits without a deductible, or with one below the plan's minimum (Internal Revenue Service, 2025), so a high deductible does not mean every visit is out of pocket. And if your small employer offers a SIMPLE plan rather than a 401(k), the 2025 elective deferral limit is $16,500 (Internal Revenue Service, 2025) — a different number to plan around.

Who Should Choose Each

The next dollar points to the HSA if:

  • You are covered by a qualifying HDHP for the full year, are under 65, and are not enrolled in Medicare — the four eligibility conditions in the 2025 IRS rules are all met (Internal Revenue Service, 2025).
  • You are 55 or older at year end and still working under HDHP coverage, so the limit rises by $1,000 (Internal Revenue Service, 2025) for however many years remain before Medicare enrollment ends your eligibility.
  • You are self-employed with no employer plan and no match to capture: the HSA deduction is available even if you do not itemize on Schedule A (Internal Revenue Service, 2025).
  • You are married filing jointly with family HDHP coverage and both spouses are 55 or older — each needs a separate HSA to claim their own $1,000 addition, because joint HSAs are not allowed (Internal Revenue Service, 2025).
  • You can pay routine medical costs from current cash flow, so the balance stays invested and the tax-free earnings (Internal Revenue Service, 2025) have time to matter.

The next dollar points to the 401(k) if:

  • Your employer offers a match and you are not yet contributing enough to receive all of it. The match is set by the plan document, not the IRS, so the only place to read the formula is your summary plan description.
  • You are 50 or over and behind on retirement savings: the 2025 catch-up is $7,500 (CNBC, November 2024), and if you turn 60, 61, 62, or 63 in the year, SECURE 2.0 allows a higher limit starting in 2025 — $11,250 for 2026 (Internal Revenue Service).
  • You are in a high marginal bracket this year and expect a lower one when you withdraw: that is the case for pretax deferrals, which cut taxable wages now and are taxed as ordinary income later.
  • You expect your bracket in retirement to be the same or higher, and your employer has added a Roth 401(k): contributions are after-tax now, with qualified distributions tax free later.
  • You are not HDHP-covered at all in 2025 — no HSA contribution is permitted, so the comparison does not arise.

Frequently asked questions

What happens to my HSA if I change jobs next year?

The HSA is yours, not your employer's — it stays open and the balance stays invested no matter where you work. What stops is eligibility to add new money, which depends on being covered by a qualifying HDHP (Internal Revenue Service, 2025). If your new employer's plan is not an HDHP, you can still spend the balance tax free on qualified medical expenses but cannot contribute. Before your last day, log into the custodian's site, confirm your personal email and address are on file, and check whether the account carries a monthly fee once an employer stops subsidising it.

I'm about to turn 65 and sign up for Medicare — can I keep contributing?

No. Enrollment in Medicare ends HSA contribution eligibility (Internal Revenue Service, 2025), and the limit is prorated by the months you were eligible. The flip side is that after age 65 the additional 20% tax on non-medical distributions no longer applies, though income tax still does (Internal Revenue Service, 2025). Count the eligible months in your final year, tell payroll the exact month to stop HSA deductions, and ask your HSA custodian to confirm the prorated maximum before you over-contribute.

Should I really skip some of my 401(k) match to fund the HSA?

A match is a plan feature written in your employer's plan document, not an IRS rule, so there is no general answer until you read the formula — how much your employer puts in, what percentage of pay you must defer to get it, and whether a vesting schedule applies. Nothing in the HSA tax rules replicates money your employer adds. Pull up your summary plan description, find the match formula and vesting schedule, and work out the deferral percentage that captures the full match before you decide what the leftover dollars should do.

I paid medical bills out of pocket and didn't keep the receipts — did I lose that money?

You can take tax-free HSA distributions to pay or reimburse yourself for qualified medical expenses incurred after the HSA was established (Internal Revenue Service, 2025), but if you are audited the documentation is on you, and an unsubstantiated distribution can be treated as non-medical — income tax plus the additional 20% tax before age 65 (Internal Revenue Service, 2025). Start a dated folder today, scan every explanation of benefits and pharmacy receipt into it, and note which ones you have already reimbursed.

Sources

  1. Internal Revenue Service — Publication 969 (2025), Health Savings Accounts and Other Tax-Favored Health Plans (2025)
  2. Internal Revenue Service — Retirement topics - Contributions (2025)

Written by

Desmond Okafor

Desmond covers personal finance with an eye for the small decisions that compound into big outcomes. He's drawn to budgeting tools, debt payoff strategies, and the psychology behind spending. He writes for readers who feel behind and want a clear next step.

More in Retirement & Investing

Featured image for "The Required Minimum Distribution Rule Retirees Need to Know"
Retirement & Investing

The Required Minimum Distribution Rule Retirees Need to Know

A required minimum distribution (RMD) is the amount the IRS makes you pull out of your pretax retirement savings each year once you hit a set age. For most people saving now, that age is 73 (Internal Revenue Service, 2024-12-10). Miss the withdrawal and the shortfall can face a 25% excise tax, cut to 10% if you fix it within two years (Internal Revenue Service, 2024-12-10).

Priya Chandrasekaran · 8 min read

Featured image for "Backdoor Roth vs. Mega Backdoor Roth: Which Strategy Fits Your Situation"
Retirement & Investing

Backdoor Roth vs. Mega Backdoor Roth: Which Strategy Fits Your Situation

Both strategies put after-tax dollars into a Roth account when your income is too high to contribute to a Roth IRA directly. The backdoor Roth runs through a traditional IRA you open yourself. The mega backdoor Roth runs through after-tax contributions inside your employer's 401(k), and only works if the plan document allows it.

Priya Chandrasekaran · 8 min read

Featured image for "Traditional IRA vs. Roth IRA: Which Is Right for You"
Retirement & Investing

Traditional IRA vs. Roth IRA: Which Is Right for You

A Traditional IRA and a Roth IRA hold the same investments and share the same annual dollar cap, but they tax you at opposite ends: one may cut your taxable income this year, the other never does. Which one fits turns on four specific things — your modified adjusted gross income, your filing status, whether you or your spouse is covered by a retirement plan at work, and whether you expect your taxable income in retirement to be higher or lower than it is now.

Tobias Lindqvist · 9 min read

Featured image for "Should You Choose a Roth 401(k) or a Traditional 401(k)"
Retirement & Investing

Should You Choose a Roth 401(k) or a Traditional 401(k)

A Roth 401(k) and a traditional 401(k) usually sit inside the same employer plan, share the same annual IRS deferral limit, and can hold the same investments. The difference is timing: Roth contributions are after-tax going in and can come out tax-free if you meet the rules, while traditional contributions are pretax going in and every dollar out is ordinary income.

Marisol Ferreira · 9 min read