Home > Resources > HSA vs 401(k) vs Roth IRA investment calculator
First published: July 21, 2023 / Last updated: Last updated: February 6, 2026
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.
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.
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:
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:
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.
To avoid speculative assumptions, this calculator does not currently model:
If you receive employer contributions, they can be combined with your own contributions and entered as a single annual amount.
Annual contribution limits vary by account type and filing status. In general:
These limits are set by the IRS and can significantly affect long-term tax-advantaged growth.
An HSA is unique because it receives favorable tax treatment at every stage:
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.
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.
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.
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.
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.
Yes, HSA contributions reduce taxable income when made directly or through payroll deductions, subject to IRS contribution limits.
After age 65, non-medical HSA withdrawals are taxed as ordinary income, similar to a traditional retirement account.
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
HSA Eligibility Guides
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 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 are a popular fitness tracker, but their HSA eligibility is tricky. We break down the medical requirements for reimbursement.
HSA Essentials
Financial Planning
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.
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.