Home > Resources > HSA vs 401(k) vs Roth IRA investment calculator

First published: July 21, 2023 / Last updated: Last updated: February 6, 2026

HSA vs 401(k) vs Roth IRA investment calculator

Health Savings Accounts (HSAs) are often described as the most tax-advantaged account available. Contributions are made with pre-tax dollars, investments grow tax-free, and withdrawals for qualified medical expenses are also tax-free.

This unique combination of benefits is commonly referred to as the HSA triple tax advantage. When used strategically, an HSA can outperform traditional retirement accounts such as a 401(k) or Roth IRA on an after-tax basis.

Despite this, many people treat their HSA as a short-term spending account and never invest the balance.

This calculator compares the potential tax outcomes of investing in an HSA vs a 401(k) vs a Roth IRA using the same income and contribution assumptions. It is designed to show how differences in tax treatment alone can affect long-term results.

This calculator focuses on tax treatment only and does not attempt to predict investment performance.

$
$
years
%
$
%

HSA vs 401(k) vs Roth IRA calculator (2026 tax comparison)

This calculator compares the tax advantages of a Health Savings Account (HSA), a traditional 401(k), and a Roth IRA using current federal tax rules. It is designed to show how each account performs at its most basic level, using the same annual contribution and income assumptions for each option.

Rather than modeling an entire retirement plan, the goal is to isolate how tax timing affects outcomes. This makes it easier to understand why HSAs are often described as having a "triple tax advantage" and how that compares to more traditional retirement accounts.


How this HSA vs 401(k) calculator works

To keep the comparison clear and consistent, this calculator assumes that each account exists in isolation. While most people will have multiple income sources in retirement (such as Social Security or additional investment accounts), modeling a single account at a time avoids introducing unnecessary assumptions.

All calculations are based on the same inputs:

  • Annual income
  • Filing status
  • Annual contribution amount
  • Marginal federal income tax rates

Assumptions and methodology used in this calculator

Important: This calculator is intended for educational and planning purposes only. It simplifies certain variables to highlight tax treatment differences, not to predict future investment performance.

How taxes are calculated

Taxes on contributions and withdrawals are estimated using federal marginal income tax brackets based on filing status. Because Roth IRA contributions are made with after-tax dollars, their tax treatment is more complex than pre-tax accounts.

To estimate Roth IRA taxes fairly, the calculator:

  • Calculates total federal income tax based on income and filing status
  • Determines the effective tax rate for that income level
  • Applies that effective rate only to the portion of income used for Roth IRA contributions

This approach is not perfect, but it provides a reasonable estimate of the real tax cost of Roth contributions without requiring a full multi-year tax projection.

What this calculator does not account for

To avoid speculative assumptions, this calculator does not currently model:

  • Inflation or changes in purchasing power
  • Salary growth over time
  • Future changes to tax law
  • Employer matching or profit-sharing contributions

If you receive employer contributions, they can be combined with your own contributions and entered as a single annual amount.

Contribution limits and account differences

Annual contribution limits vary by account type and filing status. In general:

  • HSAs often have the lowest contribution limits for single filers
  • Roth IRAs can become the limiting factor for married filers
  • 401(k) plans typically allow the highest annual contributions

These limits are set by the IRS and can significantly affect long-term tax-advantaged growth.


Why an HSA often outperforms retirement accounts

An HSA is unique because it receives favorable tax treatment at every stage:

  • Contributions are tax-deductible (or made pre-tax via payroll)
  • Growth is tax-free
  • Withdrawals for qualified medical expenses are tax-free

Neither a traditional 401(k) nor a Roth IRA offers this combination. This calculator highlights how that difference can compound over time, especially when funds are ultimately used for healthcare expenses.


Frequently asked questions

Is an HSA better than a 401(k)?

It depends on how the money is ultimately used. When HSA funds are spent on qualified medical expenses, an HSA is generally more tax-efficient than a 401(k). However, 401(k)s often allow higher contributions and employer matching.

Is an HSA better than a Roth IRA?

For medical spending, an HSA is typically more tax-advantaged than a Roth IRA. Roth IRAs can still be valuable for non-medical retirement income due to their tax-free withdrawals.

Can I use an HSA like a retirement account?

Yes, if HSA funds are not used for medical expenses, withdrawals after age 65 are taxed like a traditional IRA. There is no penalty at that age.

Why does this calculator assume only one account?

Modeling multiple accounts introduces assumptions about withdrawal order, tax stacking, and future income. This calculator focuses on isolating tax treatment differences to keep comparisons clear.

Does an HSA reduce taxable income?

Yes, HSA contributions reduce taxable income when made directly or through payroll deductions, subject to IRS contribution limits.

What happens if I never use my HSA for medical expenses?

After age 65, non-medical HSA withdrawals are taxed as ordinary income, similar to a traditional retirement account.


Related HSA resources

Disclaimer

This page is for educational purposes only and is not tax or legal advice. Check with your HSA administrator or a qualified tax or legal professional if you have questions about your specific situation.

As seen in

New York Times


HSA Eligibility Guides

🚫
The "No" List: Common Ineligible Expenses

Are you accidentally using your HSA for items the IRS doesn't cover? Avoid penalties with our 2026 guide to commonly confused expenses like mattresses and hygiene products.



Apple Watches

Apple Watches get more HSA questions than almost any other item. Learn the specific rules for using your HSA and when you might need a Letter of Medical Necessity.


💍
Oura Rings

Oura Rings are a popular fitness tracker, but their HSA eligibility is tricky. We break down the medical requirements for reimbursement.


HSA Essentials


Financial Planning

📈
HSA Investment Calculator

Compare how an investment grows in an HSA vs traditional retirement accounts like a 401(k) and Roth IRA to maximize your long-term savings.


⚠️
HSA Early Withdrawal Penalty Calculator

Using HSA funds for non-medical expenses before age 65 triggers a steep 20% IRS penalty plus income tax. Use this tool to calculate the true cost of an early withdrawal before you tap into your savings.