Skip to main content
TaxMath

HSA versus traditional 401(k) or IRA

Whether the same pre-tax money is worth more in a health savings account or a traditional 401(k) or IRA once it is spent in retirement, with the federal and state tax on the traditional withdrawal figured for your state.

Saving
Spending it
Sets the tax rate on a traditional withdrawal.
Tax in retirement
The year whose federal and state law the retirement tax is figured under.
SSA-1099 box 5. Up to 85% of it can be taxable federally.
Joint returns only.
A year in retirement, the HSA leaves you more by$1,871
Income kept after tax, the withdrawal from an HSA
$54,000
Income kept after tax, the withdrawal from a traditional plan
$52,129
Federal and state tax with the traditional withdrawal
$1,871
Either account in 25 years, before tax
$190,908.41
The same, in today’s dollars
$102,974.20
  • Assumed. The tax is figured on the first retirement year’s withdrawal and Social Security in today’s dollars, with no other income, under 2025 federal and state law, as if the brackets keep pace with inflation. Future law may differ.
  • Provisional. Some 2025 constants are provisional and may change.
  • Assumed. Both accounts get the same pre-tax money and the same return, so the difference is only the tax when it is spent. The tax each saves when it goes in is not compared: an HSA through payroll also avoids Social Security and Medicare tax, a 401(k) deferral does not, and a few states tax HSA contributions.
  • Assumed. A year in retirement is the withdrawal you enter and your Social Security, in today’s dollars: from an HSA spent on medical expenses the withdrawal is not taxed; from a traditional plan it is.

How it works

The same yearly amount goes into each account at the end of every year and grows at the same return, rounded to the cent; the balance is then put in today’s dollars by dividing by (1 + inflation) for each year.

For one year in retirement, the federal and state tax is figured by the Form 1040 engine and your state’s engine on your Social Security with the withdrawal taxed, as from a traditional plan, and without it, as from an HSA spent on qualified medical expenses; what you keep is that year’s income less each. From 65 an HSA spent on anything else is taxed like the traditional plan.

Nothing you enter leaves your browser, and nothing is stored. The same calculator is available to AI agents as the tool calc_hsa_vs_traditional, in the page through WebMCP and at https://taxmath.org/mcp.

Sources

Put this calculator on your site

Paste this where the calculator should appear. Our script draws the calculator above the credit line, which is a plain link in your page. It is free, needs no signup and keeps nothing your readers type. Please keep the credit line. The embed page lists the options it takes.

<!-- TaxMath hsa versus traditional 401(k) or ira -->
<div class="taxmath-embed" data-taxmath-calc="hsa-vs-traditional" data-taxmath-title="HSA versus traditional 401(k) or IRA" style="max-width:680px;margin:1.5rem auto">
  <p style="font:400 13px/1.4 system-ui,sans-serif;color:#4b4b5a;margin:.5rem 0 0">
    <a href="https://taxmath.org/calculators/hsa-vs-traditional/?utm_source=embed&amp;utm_medium=referral&amp;utm_campaign=calculator-widget">HSA versus traditional 401(k) or IRA</a> by <a href="https://taxmath.org/?utm_source=embed&amp;utm_medium=referral&amp;utm_campaign=calculator-widget">TaxMath</a>
  </p>
</div>
<script src="https://taxmath.org/embed.js" async></script>
Your site strips scripts? Use the iframe version
<!-- TaxMath hsa versus traditional 401(k) or ira -->
<div class="taxmath-embed" style="max-width:680px;margin:1.5rem auto">
  <iframe src="https://taxmath.org/embed/v3/hsa-vs-traditional/"
          title="TaxMath — HSA versus traditional 401(k) or IRA"
          width="100%" height="640" loading="lazy"
          style="width:100%;border:1px solid #d8dae6;border-radius:4px"></iframe>
  <p style="font:400 13px/1.4 system-ui,sans-serif;color:#4b4b5a;margin:.5rem 0 0">
    <a href="https://taxmath.org/calculators/hsa-vs-traditional/?utm_source=embed&amp;utm_medium=referral&amp;utm_campaign=calculator-widget">HSA versus traditional 401(k) or IRA</a> by <a href="https://taxmath.org/?utm_source=embed&amp;utm_medium=referral&amp;utm_campaign=calculator-widget">TaxMath</a>
  </p>
</div>
<script src="https://taxmath.org/embed.js" async></script>

Go further