Do you pay taxes on HSA investments? Federally, no. Interest, dividends, and capital gains inside a Health Savings Account grow without any federal tax, and the IRS treats the account itself as tax-exempt as long as the money stays inside or goes toward qualified medical expenses.1Office of the Law Revision Counsel. 26 USC 223 – Health Savings Accounts Two states break from that treatment, and a handful of situations can turn otherwise-protected gains into taxable income even at the federal level.
What the Federal Exemption Actually Covers
Sell a mutual fund at a profit inside your HSA and the gain stays in the account untaxed. Holdings that pay dividends don’t put those dividends on your return. Interest from bond funds or money market positions is treated the same way. The exemption applies regardless of how large the gains get, as long as the money doesn’t leave the account for non-medical purposes.1Office of the Law Revision Counsel. 26 USC 223 – Health Savings Accounts
In an ordinary brokerage account, you’d owe capital gains tax every time you rebalanced or sold at a profit. That friction disappears inside an HSA. The exemption also keeps HSA earnings out of the 3.8% Net Investment Income Tax that applies to higher earners on regular investment accounts; because the statute exempts the HSA as a whole, neither the growth nor qualified distributions count toward that surtax calculation.1Office of the Law Revision Counsel. 26 USC 223 – Health Savings Accounts
This is the middle piece of what’s often called the HSA’s triple tax advantage: contributions reduce taxable income going in, investments grow without any annual tax drag, and withdrawals for qualified medical expenses come out tax-free.2Internal Revenue Service. Publication 969 (2025), Health Savings Accounts and Other Tax-Favored Health Plans
California and New Jersey Tax the Earnings
California and New Jersey are the only two states that don’t recognize the federal tax-exempt status of HSAs. If you live in either state, your HSA investment earnings, meaning dividends, interest, and capital gains, are taxable income on your state return for the year they’re received. You effectively track every transaction inside the account the same way you’d track a regular brokerage account. That’s a real bookkeeping headache, because HSA custodians don’t issue 1099 forms for in-account earnings that are federally tax-free.
Both states also treat HSA contributions as after-tax for state purposes, so residents don’t get the state-level deduction available elsewhere. In California, employer contributions show up as imputed income on your state return. Failing to report these amounts accurately can lead to state penalties and interest on the unpaid balance.
Residents of the eight states with no individual income tax, Alaska, Florida, New Hampshire, South Dakota, Tennessee, Texas, Washington, and Wyoming, face no state-level tax on HSA earnings at all. Everyone else’s state follows the federal rules, so investment growth inside the account isn’t taxed at the state level.
When Federal Tax Suddenly Applies
The federal protection disappears the moment money leaves the account for anything other than a qualified medical expense. When that happens, the entire withdrawal, contributions and investment gains together, gets added to your gross income and taxed at your ordinary rate.2Internal Revenue Service. Publication 969 (2025), Health Savings Accounts and Other Tax-Favored Health Plans Because your original contributions were pre-tax, the IRS treats the whole distribution as income you haven’t paid tax on yet.3Internal Revenue Service. IRS Releases Tax Inflation Adjustments for Tax Year 2026
The 20% Additional Tax
If you’re under 65, the IRS adds a 20% penalty on top of the ordinary income tax for any non-qualified distribution. On a $10,000 withdrawal spent on something other than medical care, that’s $2,000 in penalty before you even get to the income tax hit.2Internal Revenue Service. Publication 969 (2025), Health Savings Accounts and Other Tax-Favored Health Plans
Three situations remove the 20% penalty:
- You’re 65 or older. The penalty goes away, though the withdrawal is still taxed as ordinary income. At that point, the HSA functions similarly to a traditional IRA for non-medical spending.2Internal Revenue Service. Publication 969 (2025), Health Savings Accounts and Other Tax-Favored Health Plans
- You become disabled. Distributions made after you become disabled are exempt from the additional tax.
- The account holder dies. Distributions to a beneficiary after the holder’s death aren’t subject to the 20% tax.4Internal Revenue Service. Instructions for Form 8889
The Long Game After Age 65
The age-65 rule is worth dwelling on if you’re investing for the long term. Many people intentionally let their HSA grow for decades, paying current medical bills out of pocket and keeping receipts. After 65, they can reimburse themselves tax-free for those old expenses, or use the money for anything else and pay only income tax with no penalty. That’s where most of the long-term investment strategy around HSAs comes from.
Excess Contributions Get Taxed at 6% a Year
Contribute more than your annual limit and the IRS charges a 6% excise tax on the excess amount for every year it stays in the account.2Internal Revenue Service. Publication 969 (2025), Health Savings Accounts and Other Tax-Favored Health Plans It repeats annually until you fix it. The most common ways people over-contribute are switching between self-only and family coverage mid-year without prorating the limit, or continuing to contribute after enrolling in Medicare.
You can avoid the excise tax by withdrawing the excess amount, plus any earnings on it, before your tax filing deadline including extensions. The earnings on the withdrawn excess get reported as income for the year you pull them out, but you dodge the recurring 6% charge.2Internal Revenue Service. Publication 969 (2025), Health Savings Accounts and Other Tax-Favored Health Plans
Medicare Enrollment Is a Trap for Contributions
Once you enroll in any part of Medicare, Part A, Part B, or Part D, you can no longer contribute to an HSA, even if you’re still covered by a high-deductible health plan. Existing HSA funds keep their tax-free treatment for qualified medical expenses, including Medicare premiums other than Medigap. But no new money can go in.
Watch out for retroactive coverage. Medicare Part A can apply retroactively for up to six months, which means contributions you made during that lookback window suddenly become excess contributions subject to the 6% excise tax. If you’re approaching 65 and plan to sign up for Medicare, stop contributing early enough to avoid the overlap, and pull any excess amount out before your tax filing deadline.
What Happens to the Investments When You Die
Tax treatment at death depends entirely on who inherits the account.
Surviving Spouse
If your spouse is the designated beneficiary, the account simply becomes their HSA. No taxable event, investments keep growing tax-free, and your spouse can use the funds for their own medical expenses just as you would have.5Internal Revenue Service. Publication 969 (2025), Health Savings Accounts and Other Tax-Favored Health Plans – Section: Death of HSA Holder Your spouse files Form 8889 going forward as if the account had always been theirs.6Internal Revenue Service. Instructions for Form 8889 – Section: Death of Account Beneficiary
Anyone Else
A non-spouse beneficiary faces an immediate tax bill. The HSA stops being an HSA on the date of death, and the entire fair market value of the account, every dollar of investments included, becomes taxable income to the beneficiary in the year of death.5Internal Revenue Service. Publication 969 (2025), Health Savings Accounts and Other Tax-Favored Health Plans – Section: Death of HSA Holder If the estate is the beneficiary instead, that value gets included on the deceased’s final tax return.6Internal Revenue Service. Instructions for Form 8889 – Section: Death of Account Beneficiary
One partial offset is available. A non-spouse beneficiary can reduce the taxable amount by any of the deceased’s qualified medical expenses the beneficiary pays within one year of the date of death.2Internal Revenue Service. Publication 969 (2025), Health Savings Accounts and Other Tax-Favored Health Plans Outstanding hospital bills or other medical debt from the decedent’s final months can sometimes absorb a meaningful portion of the account balance. Any post-death earnings on the account are also taxable income to the beneficiary, reported separately.
Reporting Requirements Still Apply
Even though HSA investment growth isn’t federally taxable, the IRS still wants paperwork. Anyone who contributed to an HSA, took a distribution, or inherited an HSA during the year must file Form 8889 with their federal return.4Internal Revenue Service. Instructions for Form 8889 That’s true even if you’d otherwise have no filing obligation; an HSA distribution alone creates one.
You’ll receive two informational forms from your custodian. Form 1099-SA reports any distributions made from the account during the year, whether paid directly to a medical provider or to you.7Internal Revenue Service. About Form 1099-SA, Distributions From an HSA, Archer MSA, or Medicare Advantage MSA Form 5498-SA reports your total contributions for the year and the fair market value of the account at year-end.8Internal Revenue Service. Form 5498-SA HSA, Archer MSA, or Medicare Advantage MSA Information Keep both with your tax records. California and New Jersey residents need to track in-account earnings manually on top of that, since custodians generally don’t issue 1099s for investment gains that are federally tax-exempt.