HSA investing: how to grow a health savings account for decades

An HSA lets people with HSA-eligible health coverage contribute pre-tax, invest the balance and withdraw it tax-free for medical costs, so money left invested for decades can be worth more after tax than the same savings in an IRA or a taxable account. The trade-offs are market risk, record-keeping and state taxes in California and New Jersey.

By Sonic Wallet Editorial Team· Updated · 9 min read

Key takeaways

  • An HSA combines three federal tax breaks: contributions are deductible or excluded from pay, growth is untaxed, and withdrawals for qualified medical costs are tax-free. Contributions through an employer's cafeteria plan also skip the 7.65% Social Security and Medicare tax, so an invested HSA used for health costs can beat both a 401(k) and a Roth IRA.
  • For 2026 the limit is $4,400 with self-only coverage or $8,750 with family coverage, plus $1,000 at 55 or older, rising to $4,500 and $9,000 in 2027. Bronze and catastrophic plans sold as individual exchange coverage now qualify as well.
  • In this page's example, $4,400 a year invested at an assumed 6% for 20 years grows to $161,856.60 for medical spending, against $113,866.12 in a Roth account and $106,072.40 in a taxable account funded from the same pre-tax pay.
  • The IRS sets no deadline for reimbursing yourself, so you can pay a bill out of pocket now, keep the receipt and withdraw the same amount tax-free years later.
  • Medicare enrollment ends new contributions, and Part A can start up to six months before you apply. After 65, non-medical withdrawals owe income tax but no penalty. California taxes HSA contributions and earnings, and New Jersey taxes payroll contributions.

A health savings account is usually treated as a place to park money for this year's doctor bills, but its tax rules make it one of the strongest long-term investment accounts available to people with the right health plan. This page covers the tax treatment, who qualifies after the 2026 changes, the limits, when to invest rather than hold cash, the receipt strategy, a 20-year example, the rules at 65 and the two states that tax HSAs. How it fits with workplace plans and IRAs is on the stocks hub.

How does the HSA triple tax advantage work?

An HSA can avoid federal income tax at all three stages: when money goes in, while it grows and when it comes out for medical care. Contributions through an employer's cafeteria plan also skip Social Security and Medicare tax, which no IRA contribution or 401(k) deferral does.

HSATraditional 401(k) or IRARoth IRA
Money going inDeductible or excluded from pay; no payroll tax through a cafeteria planDeductible or excluded from income tax; payroll tax still appliesNot deductible
GrowthNot taxedNot taxedNot taxed
Withdrawals for medical costsTax-free at any ageTaxed as ordinary incomeTax-free once qualified
Withdrawals for anything elseTaxed as income; a 20% penalty also applies before 65Taxed as income; a 10% penalty usually applies before 59½Contributions come out tax-free; earnings can be taxed and penalized
Required withdrawalsNoneYes, starting at 73 or 75 depending on birth yearNone for the original owner

Qualified medical expenses are the costs listed in IRS Publication 502, such as deductibles, copays, prescriptions, dental work and glasses, for you, your spouse and your dependents. Insurance premiums mostly don't qualify. The exceptions are COBRA coverage, coverage while you receive unemployment benefits, long-term care insurance within limits and, from 65, Medicare premiums.

Who can contribute to an HSA in 2026?

You can contribute for any month that starts with HSA-eligible health coverage and no other coverage that disqualifies you. Normally that means a high-deductible health plan whose deductible and out-of-pocket cap meet the IRS thresholds in the next section, though preventive care can be covered from the first dollar. A 2025 law, explained in IRS Notice 2026-5, widened the rules:

  • Bronze and catastrophic plans. From 2026 these count even when they miss the usual thresholds, provided the same plan is sold as individual coverage on a health insurance exchange. Buying it directly from the insurer is fine; small-business exchange plans qualify only if they meet the normal thresholds.
  • Direct primary care. A membership with a doctor's practice costing up to $150 a month, or $300 covering more than one person, no longer disqualifies you, and the fees can be paid from the HSA.
  • Telehealth. A plan can cover virtual visits before the deductible without costing you eligibility, a rule now made permanent.

You can't contribute while enrolled in any part of Medicare, if someone else can claim you as a dependent, or while other health coverage pays before the deductible. A general-purpose health FSA or HRA counts, including a spouse's that can reimburse your bills. Dental, vision, accident, disability and long-term care coverage are allowed.

How much can you contribute to an HSA?

For 2026 the limit is $4,400 for self-only coverage and $8,750 for family coverage, plus $1,000 at 55 or older, and the 2027 figures are already published.

Figure20262027
Contribution limit$4,400 for self-only coverage and $8,750 for family coverage, plus $1,000 at 55 or older$4,500 for self-only coverage and $9,000 for family coverage, plus $1,000 at 55 or older
High-deductible plan thresholdsa deductible of at least $1,700 for self-only coverage or $3,400 for family coverage, with out-of-pocket costs capped at $8,500 or $17,000a deductible of at least $1,750 for self-only coverage or $3,500 for family coverage, with out-of-pocket costs capped at $8,700 or $17,400

Sources: IRS Rev. Proc. 2025-19 for 2026 and Rev. Proc. 2026-24, published May 29, 2026, for 2027.

  • One shared limit. Your deposits and your employer's all count. Deposits through payroll skip payroll tax; deposits you make yourself are deducted on your return but come from pay that already owed payroll tax.
  • Couples. With family coverage, spouses split the family limit however they like, but each spouse 55 or older adds the $1,000 catch-up only to an HSA in their own name.
  • Part-year coverage. The limit is prorated by month unless you are eligible on December 1, when the last-month rule allows the full amount. You must then stay eligible through December 31 of the next year, or the extra is taxed with a 10% additional tax.
  • Deadline. You can still fund the 2026 limit until April 15, 2027.
  • IRA transfer. Once in a lifetime you can move IRA money into an HSA, up to that year's limit, as a qualified HSA funding distribution.
  • Too much. Contributions over the limit owe a 6% excise tax for every year they remain.

Limits for workplace plans and IRAs are in IRA and 401(k) contribution limits.

Should you invest your HSA or keep it in cash?

A common approach is to keep enough cash for the deductible or a typical year's bills and invest the rest for the long term.

Cash in the HSAInvested HSA
SuitsBills expected this year or nextMoney you won't touch for five years or more
Typical holdingsInterest-bearing deposit or money market optionIndex funds, target-date funds or other funds on the provider's menu
Main riskInflation slowly erodes the balancePrices can fall just before a large bill
Costs to checkInterest rate paid and monthly account feesFund expense ratios and any investment platform fee

Many providers require a minimum cash balance before you can invest, and menus range from a handful of funds to a full brokerage window. Your employer usually picks the provider that receives payroll deposits, but trustee-to-trustee transfers to another HSA are unlimited, so you can keep the payroll tax savings and invest elsewhere. A single fund that shifts its mix with age, explained in target-date funds, keeps upkeep low.

Cash set aside for near-term bills works like an emergency fund for medical costs; where to keep an emergency fund compares the options, and how money market funds work explains a common HSA cash choice. HSAs with a brokerage window may also hold Treasury bills, which behave much as described in T-bills in an IRA.

How does paying out of pocket and reimbursing yourself later work?

You can pay a medical bill with other money, let the HSA keep growing and withdraw the same amount tax-free years later. IRS Notice 2004-50 sets no time limit, provided the expense came after the HSA was opened, wasn't reimbursed by insurance and wasn't claimed as an itemized deduction. Keep the itemized receipt or explanation of benefits and proof of payment for as long as you might withdraw against it, plus the years the return could be examined.

Worked example: A $2,000 dental bill reimbursed 14 years later

In 2026 Nia pays a $2,000 dental bill from her checking account and files the itemized receipt and card statement. Her HSA stays invested.

  • The $2,000 left in the HSA, grown at an assumed 6% a year for 14 years: $4,521.81.
  • In 2040 she withdraws $2,000 tax-free against the saved receipt.
  • The other $2,521.81 stays invested and has never been taxed.

The strategy only helps if you can pay bills from other savings without carrying debt, and it depends on records surviving for years. Withdraw only what your documents support, because an undocumented withdrawal before 65 is taxed and penalized.

How much could an invested HSA grow in 20 years?

Funded at the 2026 self-only limit for 20 years, an HSA spent on medical costs ends well ahead of the same pay saved elsewhere.

Worked example: 20 years of HSA contributions compared

Nia is 45, has self-only HSA-eligible coverage and can set aside $4,400 of pre-tax pay each year for 20 years. Assumptions: a 6% yearly return on investments, 2% on cash, a 22% federal tax rate now and in retirement, 7.65% payroll tax and a 15% rate on long-term gains. Catch-ups, limit increases and state tax are left out.

Where the $4,400 of pay goesInvested each yearValue at 65After tax
HSA, invested, spent on medical costs$4,400.00$161,856.60$161,856.60
HSA, invested, spent on other things after 65$4,400.00$161,856.60$126,248.15
Traditional 401(k), after payroll tax$4,063.40$149,474.57$116,590.17
Roth 401(k) or Roth IRA$3,095.40$113,866.12$113,866.12
HSA left in cash at 2%$4,400.00$106,908.43$106,908.43
Taxable brokerage account$3,095.40$113,866.12$106,072.40

Spent on medical costs, the invested HSA finishes $55,784.20 ahead of the taxable account and $54,948.17 ahead of the same HSA held in cash.

Even spent on other things after 65, the HSA beats the traditional 401(k) by $9,657.98 here, purely because it skipped payroll tax. That edge disappears if you contribute directly instead of through payroll, and a 401(k) match, which an HSA can't offer, would change the comparison. A 6% return is an assumption, not a forecast; real returns vary and can be negative for years. Test other rates and periods with the compound interest calculator, and see capital gains tax on stocks for how gains in the taxable account are taxed.

What changes at 65 and when you enroll in Medicare?

At 65 the 20% penalty on non-medical withdrawals ends, but enrolling in any part of Medicare stops new contributions from the first month of coverage. After 65 the account can pay Medicare Part A, Part B, Part D and Medicare Advantage premiums tax-free, though not Medicare supplement (Medigap) policies.

Starting Social Security at 65 or later enrolls you in Part A automatically. If you apply later, premium-free Part A begins up to six months before your application, but not before 65, so the Social Security Administration advises stopping HSA contributions six months before you apply.

Worked example: Prorating contributions around Medicare

Omar turns 65 on August 15, 2026, and his Medicare Part A begins August 1. He was HSA-eligible from January through July.

  • Eligible months in 2026: 7.
  • Limit: ($4,400 + $1,000 catch-up) × 7 ÷ 12 = $3,150.

If he instead delayed Medicare and Social Security and applied in March 2028, Part A would be backdated to September 2027. His 2027 limit would become ($4,500 + $1,000) × 8 ÷ 12 = $3,666.67, and contributions should stop after August 2027.

Do California and New Jersey tax HSAs?

Yes: both states tax HSA money that federal law leaves alone, in different ways, so residents get less from an HSA than the figures above suggest.

California does not recognize HSAs. Contributions aren't deductible on the state return, employer contributions are added back to state wages, and interest, dividends and capital gains inside the account are taxed by California in the year they arise, so you need yearly records much like a brokerage account. Because that money was already taxed, a non-medical withdrawal included in federal income isn't taxed again by California.

New Jersey has no deduction for HSA contributions: its list of allowed deductions includes Archer medical savings accounts but not HSAs. Contributions made by salary reduction also count as taxable New Jersey wages, because the state does not follow the federal cafeteria plan exclusion. The Division of Taxation does not clearly address the yearly earnings inside an HSA, so residents should check with a tax professional who knows New Jersey rules. Most other states follow the federal treatment, but check your own state's rules.

What are the risks of investing an HSA?

The biggest risk is needing the money for a large medical bill just after the market has fallen.

  • Market losses. Invested balances can drop sharply; types of investment risk explains the main ones.
  • High deductibles. An HSA-eligible plan can cost more in a bad health year than a plan with a lower deductible, so compare total expected costs, not just premiums.
  • Penalties. Non-medical withdrawals before 65 owe income tax plus 20%, and losing eligibility after using the last-month rule brings tax plus 10%.
  • Records. Reimbursing yourself years later depends on receipts that prove each expense.
  • Fees and menus. Account fees and costly funds can eat into a small balance, and some providers offer few choices.
  • Social Security credit. Payroll contributions are left out of the earnings Social Security counts, which can slightly lower future benefits.
  • Heirs. A spouse can take over the account, but any other beneficiary owes income tax on the whole balance at once, so spending it on medical costs during life is usually more efficient.
  • Rule changes. Congress widened eligibility for 2026 and can change the rules again, and state treatment can differ from federal.

An HSA sits alongside workplace and IRA savings: 401(k) basics covers how an employer match works, and Roth vs traditional IRA weighs a deduction today against tax-free withdrawals later. HSA rules and state treatment change, so check current IRS guidance and consider a tax professional for your own situation.

Frequently asked questions

Can I invest my HSA in index funds?+

Usually, if your provider offers investments. Many let you choose from a menu of mutual funds or ETFs once the cash balance passes a set minimum, and some offer a brokerage window. If the menu is poor or costly, you can move the money to another HSA by trustee-to-trustee transfer.

What happens to my HSA if I change jobs or health plans?+

The account stays yours, including money your employer put in, because HSA contributions are never forfeited. You can keep investing and spending it without HSA-eligible coverage; you just cannot add new contributions until you are eligible again.

Can I use my HSA for a spouse's or child's medical bills?+

Yes. Qualified medical expenses for your spouse and your tax dependents can be paid tax-free from your HSA, even if they are not covered by your high-deductible plan, as long as insurance did not reimburse them and you do not also deduct them.

Is an HSA better than a 401(k)?+

For money that will go to medical costs, an HSA usually comes out ahead because it can avoid tax at every stage. An employer 401(k) match adds money an HSA cannot, though, so many savers collect the full match first and then weigh the HSA against further 401(k) deferrals.

What happens to an HSA when the owner dies?+

A spouse named as beneficiary takes over the HSA as their own. Any other beneficiary must include the account's value in income for the year of death, reduced by the owner's medical bills paid from it within one year after death.

Sources

  1. Publication 969, Health Savings Accounts and Other Tax-Favored Health Plans, IRS
  2. Notice 2026-5: Expanded availability of health savings accounts under the One, Big, Beautiful Bill Act, IRS
  3. Notice 2004-50: Health savings accounts, additional Q&As, IRS
  4. How to Apply for Medicare Part B During Your Special Enrollment Period, Social Security Administration
  5. 2025 Instructions for Schedule CA (540), California Adjustments, California Franchise Tax Board
  6. Income Tax: Exemptions and Deductions, New Jersey Division of Taxation
  7. Technical Bulletin TB-39(R): Cafeteria Plans, New Jersey Division of Taxation
  8. Rev. Proc. 2025-19: 2026 HSA limits, IRS
  9. Rev. Proc. 2026-24: 2027 inflation-adjusted amounts for health savings accounts, IRS

Related guides