HSA vs 401(k) Optimizer

Decide where your next retirement dollar belongs. Capture your full employer 401(k) match first, then this tool shows how much more an HSA earns than a traditional 401(k) for medical-earmarked dollars.

Worked Example

Sample input: Annual amount beyond the match ($): 4400, Employer 401(k) match (% of contribution): 50, Your marginal tax rate (%): 30, Expected annual return (%): 7, Years until you spend it: 30

HSA edge over 401(k): 12610 (HSA wins big after the match)

Fund your 401(k) up to the employer match first — at a 50% match that is about $2,200 of free money per year you should never skip. For dollars beyond the match that you can earmark for medical, the HSA beats a traditional 401(k) by roughly $12,610 over 30 years, because the HSA avoids both the withdrawal tax and (on payroll) the 7.65% FICA the 401(k) does not. (Grows 7.61x.)

Helpful tools & resources

$50 Off Research funds with Morningstar →

Morningstar — professional fund & portfolio research · $50 off annual

Free File your taxes free →

FileYourTaxes.com — IRS Free File partner

Free Plan Track investments with TradingView →

TradingView — professional-grade charts, real-time data · used by 50M+ traders

Affiliate link — Investor Sam may earn a commission. It does not affect our analysis.

Frequently Asked Questions

Should I fund my 401(k) or HSA first?

Contribute to your 401(k) up to the full employer match first — that match is an instant guaranteed return no other account offers. After the match, the HSA is usually the next-best home for dollars you can earmark for medical costs, because of its triple-tax-advantage (IRS Publication 969).

How does the HSA beat a traditional 401(k)?

Both are pre-tax going in, but a traditional 401(k) is taxed on withdrawal while an HSA spent on qualified medical is tax-free. A payroll HSA also avoids the 7.65% FICA tax that a 401(k) does not. This tool values both of those edges over your time horizon.

Does this assume the HSA is used for medical?

Yes. The tax-free withdrawal applies to qualified medical expenses. After 65 a non-medical HSA withdrawal is taxed as ordinary income like a Traditional IRA, so earmark the HSA for healthcare to keep the full advantage (IRS Publication 969).

What is the 2026 HSA limit?

For 2026 you can contribute $4,400 self-only or $8,750 family to an HSA, plus $1,000 catch-up at 55 or older. You must be enrolled in an HSA-eligible high-deductible health plan to contribute.

Related tools

💎
InvestorSam.com
Stock analysis, market insights & portfolio research — free
Ready to put these numbers to work?
Get stock picks, earnings analysis, and market commentary from Investor Sam.
Visit InvestorSam.com →