Insurance & Risk Management Health Insurance IRC §223 — health savings accounts

HSA Long-Term Value and Triple Tax Advantage Calculator

A health savings account is the only account in the US tax code that is untaxed at all three points: the money goes in without income tax and, through a payroll deduction, without Social Security and Medicare tax; it grows without tax; and it comes out without tax when spent on qualified medical costs. This calculator projects the balance when contributions are invested rather than spent, then prices the advantage explicitly against the two obvious alternatives — a taxable brokerage account and a 401(k) — using the same gross compensation for all three.

Calculator

This calculator runs in your browser. Enable JavaScript for live results — the inputs, formula and worked example below remain fully readable without it.

Inputs this calculator takes, with typical values
InputWhat to enterExample
Your annual contributionWhat you put in each year. The IRS sets a statutory maximum that changes annually — check the current figure before contributing.5000 $
Employer contributionAnything your employer puts in. It counts against the same statutory limit as your own contribution.1000 $
Years investedHow long the account grows before you start drawing on it.25 yr
Expected annual returnReturn on the invested balance. Most HSAs require a cash threshold before investing, so this applies to the invested portion.7 %
Marginal income tax rateFederal plus state marginal rate. California and New Jersey do not follow the federal HSA treatment for state tax.24 %
Payroll tax rateSocial Security and Medicare on the employee side. Contributions made through a cafeteria plan avoid it; direct contributions do not.7.65 %
Capital gains tax rateLong-term rate applied to the taxable-account comparison when the balance is liquidated.15 %
Annual medical costs paid from cashQualified expenses you pay out of pocket and keep receipts for, leaving the account invested. These stay reimbursable indefinitely.1500 $

It returns

  • Projected HSA balance — Contributions invested at the assumed return, with no tax at any point.
  • Total contributed
  • Growth never taxed
  • Tax avoided on the way in — Income plus payroll tax that would have been withheld on the same gross pay.
  • Taxable account net value
  • Advantage over a taxable account
  • Advantage over a 401(k)
  • Receipts still reimbursable — Qualified costs paid from cash over the period, withdrawable tax-free at any future date.

The formula

B=C(1+r)n1r(1+r)
B401k=C(1p)s(1t)

In plain text: Balance = C × [((1 + r)^n − 1) ÷ r] × (1 + r), with no tax on the contribution, the growth, or a qualified withdrawal

  • BHSA balance after n years ($)
  • CTotal annual contribution, yours plus your employer's ($)
  • rAnnual return on the invested balance (decimal)
  • nYears invested (years)

Contributions are treated as an annuity due — paid at the start of each year — which slightly favours the account against mid-year payroll deductions. All three comparison routes use the same convention, so the difference between them is unaffected.

Updated Category Health Insurance Verified against published test cases Reading time 12 min

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.

  1. Annuity due factor. 1.0725 = 5.4274326, so [(5.4274326 − 1) ÷ 0.07] × 1.07 = 63.2490 × 1.07 = 67.676470.
  2. HSA balance. $6,000 × 67.676470 = $406,059.
  3. Total contributed. $6,000 × 25 = $150,000. So $256,059 of the balance is growth that is never taxed.
  4. Tax avoided on the way in. $150,000 × (24% + 7.65%) = $150,000 × 31.65% = $47,475.
  5. 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.
  6. 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.
  7. The advantages. Over the 401(k): $406,059 − $284,996 = $121,062. Over the taxable account: $406,059 − $251,289 = $154,770.
  8. 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

At a 7% return, 24% marginal rate, 7.65% payroll tax and 15% capital gains. Each column starts from the same gross compensation and ends at money available to pay a medical bill.
YearsHSA401(k) after taxTaxable after taxHSA ÷ 401(k)HSA ÷ taxable
10$88,702$62,256$57,6851.4251.538
20$263,191$184,723$165,2101.4251.593
30$606,438$425,635$370,7801.4251.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.

Frequently asked questions

What is the triple tax advantage of an HSA?

Contributions are excluded from income tax and, when made through an employer cafeteria plan, from Social Security and Medicare tax; investment growth inside the account is never taxed; and withdrawals for qualified medical expenses are tax-free. No other account in the US tax code is untaxed at all three points. A 401(k) matches the second but taxes the third; a Roth matches the second and third but taxes the first.

Is an HSA better than a 401(k)?

For money you will spend on healthcare, yes, and by a fixed proportion. The ratio is 1 ÷ [(1 − payroll rate)(1 − marginal rate)], which at 7.65% and 24% is 1.425 — the HSA finishes 42.5% ahead at any horizon. The usual caveat is that a 401(k) employer match is an immediate return no tax treatment beats, so capture the match first, then fill the HSA, then go back to the 401(k).

Can I invest my HSA balance?

Most administrators allow it, usually once the cash balance exceeds a threshold of around $1,000 to $2,000, and often with a monthly fee on the invested portion. Both the threshold and the fee reduce your effective return below what this calculator assumes. If your employer's administrator has poor investment options, you can transfer the balance to a different HSA custodian — the account is yours, not the employer's.

Is there a deadline to reimburse myself for a medical expense?

No. A qualified expense incurred after the account was established stays reimbursable indefinitely, provided it has not been reimbursed from another source or deducted on a tax return. This is what makes the pay-from-cash strategy work: the money compounds untouched while you accumulate documented claims against it. The obligation is entirely on you to keep records — the administrator does not track your receipts.

What happens to my HSA at 65?

Two things change. You can no longer contribute once you enrol in Medicare, and Part A can be backdated up to six months when you claim Social Security, which can create excess contributions retroactively. But the 20% penalty on non-qualified withdrawals disappears, so from 65 an HSA behaves like a traditional retirement account for non-medical spending — taxable as ordinary income, no penalty. Medical withdrawals stay tax-free, and Medicare Part B and Part D premiums become qualified expenses.

Does the HSA advantage depend on my tax rate in retirement?

No, which is unusual. The 401(k) comparison does depend on it — a lower rate in retirement narrows the gap and a higher one widens it — because the 401(k) is taxed on withdrawal. Qualified HSA withdrawals are not taxed at any rate, so the account's value does not rest on a forecast of future tax law or future income. That certainty is worth something the arithmetic does not show.

Can I contribute to an HSA if my spouse has a health FSA?

Generally not, if it is a general-purpose FSA, because it is treated as disqualifying coverage for you even though it is in your spouse's name. A limited-purpose FSA covering only dental and vision does not disqualify you, and neither does a post-deductible FSA. This is one of the most common causes of accidental excess contributions, and it carries a 6% excise tax for every year the excess remains in the account.

Are health insurance premiums a qualified expense?

Usually not, with four exceptions: COBRA continuation coverage, coverage bought while you are receiving unemployment compensation, Medicare premiums other than Medigap once you reach 65, and qualified long-term care insurance up to an age-based dollar limit. The Medicare exception is substantial — Part B and Part D premiums for the rest of your life become a tax-free withdrawal, which is why the account works well as a retirement healthcare fund.

References