The three advantages, separately
People say an HSA is triple tax advantaged and then leave it there. The three advantages are different sizes, they matter at different horizons, and only one of them is unique to this account.
1. The contribution goes in untaxed. A 401(k) deferral does the same for income tax but not for Social Security and Medicare tax — FICA is computed on gross pay including the deferral. An HSA contribution made through an employer cafeteria plan escapes both. On the default figures that is 24% + 7.65% = 31.65% of every dollar contributed, against 24% for a 401(k). The payroll piece is the part nobody mentions, and it is worth 7.65 cents on the dollar with no lock-up, no growth assumption and no risk.
2. The growth is never taxed. Shared with a 401(k) and a Roth, and it is the advantage that compounds — so it dominates at long horizons and is close to irrelevant at short ones. On the default projection $256,059 of the $406,059 balance is growth that is never taxed.
3. Qualified withdrawals come out untaxed. Shared with a Roth, not with a 401(k). This is what makes the account genuinely unique when combined with advantage 1: money that is untaxed both entering and leaving.
What makes the account worth using as an investment at all is that qualified medical expenses have no reimbursement deadline. Pay a $600 bill from your current account today, keep the receipt, and you can reimburse yourself from the HSA in twenty years — tax-free — while the money compounds in the meantime. The expense must have been incurred after the account was established, and it must not have been reimbursed from anywhere else or deducted on a tax return.
How the three routes are compared on equal terms
A fair comparison starts from the same gross compensation and follows each dollar to the point where it can be spent on a medical bill. Starting from the same contribution instead would quietly hand the sheltered accounts the tax saving twice.
The HSA route. The full amount goes in. It grows at the assumed return. It comes out for a qualified expense. Nothing is deducted anywhere, so the spendable value is the balance itself.
The 401(k) route. Payroll tax applies to the compensation whether or not it is deferred, so the amount available to invest is C(1 − payroll). It grows tax-free. The withdrawal is ordinary income, so the spendable value is the balance times (1 − marginal rate).
The taxable route. Both payroll and income tax apply first, leaving C(1 − payroll − marginal) to invest. Growth is taxed at liquidation at the capital gains rate. This is the most favourable possible treatment of a taxable account — it assumes no dividends, no rebalancing and no realised gains along the way — so the advantage shown against it is conservative.
Why the 401(k) gap is a constant proportion. The HSA-to-401(k) ratio is 1 ÷ [(1 − payroll)(1 − marginal)], which contains no term in r or n. At 7.65% and 24% that is 1 ÷ (0.9235 × 0.76) = 1.4247, so the HSA finishes 42.5% ahead of the 401(k) at every horizon. Check it against the reference table: the ratio is 1.425 at 10, 20 and 30 years alike. The taxable comparison does not behave that way, because the tax on growth accumulates — the ratio there rises from 1.538 at ten years to 1.636 at thirty.
One assumption to be honest about. This uses one marginal rate for the contribution and the withdrawal. If your rate in retirement will be lower than it is now, the 401(k) closes some of the gap; if higher, it widens. The HSA comparison is unaffected either way, which is itself a point in its favour: it does not depend on a forecast of future tax rates.
Worked example: $6,000 a year for 25 years
You contribute $5,000 a year and your employer adds $1,000, for $6,000 total. You invest it at 7%, you are in a 24% marginal bracket with 7.65% employee payroll tax, and you would pay 15% on long-term capital gains. You leave the account invested for 25 years and pay $1,500 a year of qualified costs from cash.
- Annuity due factor. 1.0725 = 5.4274326, so [(5.4274326 − 1) ÷ 0.07] × 1.07 = 63.2490 × 1.07 = 67.676470.
- HSA balance. $6,000 × 67.676470 = $406,059.
- Total contributed. $6,000 × 25 = $150,000. So $256,059 of the balance is growth that is never taxed.
- Tax avoided on the way in. $150,000 × (24% + 7.65%) = $150,000 × 31.65% = $47,475.
- The 401(k) route. $6,000 × (1 − 0.0765) = $5,541 invested each year, growing to $5,541 × 67.676470 = $374,995. Taxed at 24% on withdrawal: $374,995 × 0.76 = $284,996.
- The taxable route. $6,000 × (1 − 0.3165) = $4,101 invested each year, growing to $4,101 × 67.676470 = $277,541. Basis is $4,101 × 25 = $102,525, so the gain is $175,016, and 15% of that is $26,252. Net: $251,289.
- The advantages. Over the 401(k): $406,059 − $284,996 = $121,062. Over the taxable account: $406,059 − $251,289 = $154,770.
- Receipts banked. $1,500 × 25 = $37,500 of qualified expenses paid from cash, still reimbursable tax-free whenever you choose.
Sanity-check the 401(k) figure against the algebra: $406,059 ÷ $284,996 = 1.4248, and 1 ÷ (0.9235 × 0.76) = 1.4247. The small difference is rounding in the intermediate figures, not a modelling choice.
How to read the result
The projection is only reachable if you do not spend the account. That is the whole premise, and it is the assumption most likely to fail. An HSA used as a spending account — money in, medical bills out, balance near zero — still gets advantage 1 and advantage 3 on every dollar, which is worth 31.65% at the default rates and is not nothing. But it gets none of advantage 2, and advantage 2 is $256,059 of the $406,059 above. Investing the balance requires paying current medical costs from cash, which requires having cash.
The receipts figure is a real, if unusual, asset. $37,500 of documented qualified expenses is $37,500 you can withdraw tax-free at any point, for any reason, with no age restriction. It functions as an emergency reserve sitting behind the investment account. Its value depends entirely on the documentation surviving, so keep the receipts and the explanation-of-benefits statements somewhere durable and organised by year.
After 65 the account stops being medical-only. Non-qualified withdrawals before 65 attract a 20% penalty on top of ordinary income tax. From 65 the penalty disappears and a non-qualified withdrawal is simply taxed as ordinary income — the same treatment as a traditional 401(k). So the downside case for over-funding an HSA is that it becomes a 401(k), which is a mild downside.
Two state exceptions and one Medicare rule matter. California and New Jersey do not conform to the federal treatment, so HSA contributions are taxable and the earnings are taxable for state purposes there — set the marginal rate to the federal figure alone if you live in either. And you cannot contribute to an HSA once you are enrolled in Medicare, which for people claiming Social Security at 65 means the contribution window closes then, with a six-month retroactive enrolment rule that can create excess contributions if you are not watching for it.
Net spendable value from $6,000 of gross pay a year, three ways
| Years | HSA | 401(k) after tax | Taxable after tax | HSA ÷ 401(k) | HSA ÷ taxable |
|---|---|---|---|---|---|
| 10 | $88,702 | $62,256 | $57,685 | 1.425 | 1.538 |
| 20 | $263,191 | $184,723 | $165,210 | 1.425 | 1.593 |
| 30 | $606,438 | $425,635 | $370,780 | 1.425 | 1.636 |
The 401(k) ratio is constant because it is 1 ÷ [(1 − 0.0765)(1 − 0.24)] = 1.4247 regardless of horizon. The taxable ratio rises with time because the tax on growth compounds against you.
Rules and traps around the account
- Eligibility depends on the plan, not the account. You may contribute only while covered by a qualifying high-deductible health plan with no disqualifying other coverage — including a general-purpose health FSA, which your spouse's plan can create without you realising.
- The statutory contribution limit changes every year. The IRS publishes it in an annual revenue procedure, with separate self-only and family figures and a catch-up amount from age 55. Excess contributions attract a 6% excise tax for each year they remain.
- Contribute through payroll where you can. A direct contribution is deductible against income tax but does not avoid payroll tax, so routing the same money through a cafeteria plan is worth 7.65% of it with no other change.
- Medicare closes the window. Enrolment in any part of Medicare ends eligibility, and Part A can be applied retroactively for up to six months when you claim Social Security — which can turn contributions you have already made into excess contributions.
- Non-qualified withdrawals before 65 cost 20% plus income tax. After 65 the penalty is gone and the withdrawal is simply ordinary income.
- An HSA is not a use-it-or-lose-it account. That is a health FSA. HSA balances roll over indefinitely and the account is yours when you change jobs.
- Investment thresholds cost you growth. Many providers require a cash balance of $1,000 to $2,000 before you can invest, and charge a monthly fee on invested balances. Both reduce the effective return this calculator assumes.
What counts as a qualified medical expense
The definition comes from section 213(d) of the tax code, and IRS Publication 502 lists what qualifies. It is broader than people expect — dental, vision, hearing aids, prescription drugs, mental health treatment, and travel for medical care all count — and narrower in places that surprise people, since cosmetic procedures and general health items usually do not. Over-the-counter drugs and menstrual care products became qualified expenses under the CARES Act. Health insurance premiums are generally not qualified expenses, with four exceptions: COBRA continuation coverage, coverage while receiving unemployment compensation, Medicare premiums other than Medigap once you turn 65, and long-term care insurance up to an age-based limit. That Medicare exception is what makes an HSA a genuinely effective retirement healthcare vehicle — Part B and Part D premiums for the rest of your life become a tax-free withdrawal.
Where the HSA fits in the order of savings
The usual sequence is: contribute enough to a 401(k) to capture the full employer match, because that is an immediate return no tax treatment can beat; then fill the HSA; then return to the 401(k) or an IRA. The HSA sits second because the payroll tax advantage and the tax-free withdrawal together beat both of the retirement accounts on the arithmetic above — but only after a match is a certain return and the HSA's advantage is not.
The prior decision is whether the high-deductible plan itself is the right plan. An HSA is only available with one, and a plan with a large deductible is a genuine cost if you use a lot of care. Work the health plan comparison first with the total annual cost calculator and the HDHP versus PPO comparison, then treat any employer HSA contribution as a direct reduction in the high-deductible plan's cost. It frequently reverses the ranking. The HSA contribution limit calculator handles the statutory maximum, including the proration rules that apply when you are eligible for only part of the year.
Late in the plan, the account's job changes again. Medicare premiums and long-term care premiums are qualified expenses, so an HSA becomes the natural funding source for exactly the costs that rise fastest in retirement — the ones the retirement healthcare cost calculator projects and the IRMAA surcharge calculator can inflate. Because HSA withdrawals are not income, they also do not push you into a higher IRMAA bracket, which is a fourth advantage that does not fit the triple-tax slogan and is worth real money to a household near a bracket threshold.
