Health Savings Accounts (HSAs) have some properties that make them nice retirement accounts (that post is required reading for some of the facts discussed here). However, the inheritance laws surrounding them are much worse than inheritance laws for any retirement account.

From 26 US Code § 223 (f)

(8) Treatment after death of account beneficiary

(A) Treatment if designated beneficiary is spouse
If the account beneficiary’s surviving spouse acquires such beneficiary’s interest in a health savings account by reason of being the designated beneficiary of such account at the death of the account beneficiary, such health savings account shall be treated as if the spouse were the account beneficiary
(B) Other cases

(i) In general
If, by reason of the death of the account beneficiary, any person acquires the account beneficiary’s interest in a health savings account in a case to which subparagraph (A) does not apply—

(I) such account shall cease to be a health savings account as of the date of death, and
(II) an amount equal to the fair market value of the assets in such account on such date shall be includible if such person is not the estate of such beneficiary, in such person’s gross income for the taxable year which includes such date, or if such person is the estate of such beneficiary, in such beneficiary’s gross income for the last taxable year of such beneficiary.

(ii) Special Rules**

(I) Reduction of inclusion for predeath expenses
The amount includible in gross income under clause (i) by any person (other than the estate) shall be reduced by the amount of qualified medical expenses which were incurred by the decedent before the date of the decedent’s death and paid by such person within 1 year after such date

The language in 26 US Code § 223 (f)(8)(A) is massively confusing because technically if you have a HSA you're the "account beneficiary," and what you think of as the HSA beneficiary (the person who will receive the account upon your death) is actually the "designated beneficiary." So to clear that up, from IRS Publication 969:

Death of HSA Holder
You should choose a beneficiary when you set up your HSA. What happens to that HSA when you die depends on whom you designate as the beneficiary.

Spouse is the designated beneficiary.
If your spouse is the designated beneficiary of your HSA, it will be treated as your spouse's HSA after your death.

Inheritance by a Spouse

Per 26 US Code § 223 (f)(8)(A) above, the spouse's taxable income is unaffected by inheriting a HSA. The spouse simply receives the HSA as if it were his/her own. However, that's not the full story. What happens to
a) medical expenses incurred by the decedent before his/her death but not yet paid (I don't mean reimbursed, I mean paid)
b) medical expenses paid by the decedent and not reimbursed out of the HSA

I've seen some sources say that the spouse is allowed to make tax and penalty free withdrawals to pay for qualified medical expenses incurred by the decedent spouse before his/her death and paid by the spouse within one year of death. I certainly did not read the entirety of the US code, but I did not find anything in 26 US Code § 223, which is the section for HSAs, confirming that statement. The US code, specifically 26 US Code § 223 (f)(8)(B)(ii)(I) is only talking about reduction of taxable income for non spouses that inherit the HSA for expenses incurred by the decedent spouse before his/her death and paid by the spouse within one year of death. I could not find this one year provision for inheritance by spouses.

Now granted, one of the qualified medical expenses for which you can withdraw money from a HSA tax and penalty free includes your spouse's qualified medical expenses. One could try to argue that because you inherit your spouse's HSA and can treat it as your own, you can pay for your spouse's expenses. But it's not entirely clear if this still applies once your spouse is dead; the IRS could make the argument that since you cannot be married to a dead person, you cannot use HSA money tax and penalty free to pay for the decedent's unpaid medical expenses. And I did not find in the list of qualified medical expenses your recently deceased spouse's medical expenses. To the best of my knowledge there is no IRS ruling clarifying this matter.

Unfortunately, I also don't know what happens to medical expenses that were paid for after the HSA was established but not yet reimbursed (recall that one of the advantages of HSAs is being able to defer indefinitely reimbursing yourself for qualified medical expenses) out of the HSA. IRS Notice 2004-50, Question 39 is where we're told that we can defer reimbursements indefinitely. However, it doesn't answer the question of what happens to these deferred reimbursements once the HSA account holder dies.
One could try to argue that the clause "such health savings account shall be treated as if the spouse were the account beneficiary" gives the inheritor the right to reimburse themselves tax and penalty free for medical expenses incurred by the dead spouse.
However, we still have the same problem that the expenses were incurred by a now dead spouse, and "dead spouse's medical expenses" isn't listed as a qualified medical expense for tax and penalty free use of HSA funds.
I was not able to find any clarifying guidance from the IRS on the matter.

Inheritance by a Non Spouse

Inheritance of a HSA by a non spouse probably has some of the worst characteristics I've ever heard of in inheritance law (not that I'm a lawyer or accountant). If you inherit assets that were held in the decedent's taxable brokerage account, the decedent's estate pays any applicable estate taxes (of which in general, as of this writing, $11.18M for single people and double that for couples filing jointly is not subject to estate tax (more on gift and estate taxes here)), and from your perspective, you receive the funds tax free. Because of the large estate tax exclusion limits, most Americans' estates are not taxed. If you inherit a IRA, you do not pay taxes based on its balance (though you do have to start taking RMDs). [1]

But if you inherit a HSA, then per 26 US Code § 223 (f)(8)(B)(i)(II) quoted above, the HSA immediately ceases to be a HSA, and the entire HSA balance is added to your income, less qualified medical expenses paid in the year preceding the decedent's death. If there's $100k in a HSA you inherit, your taxable income increases by $100k that year!

Strategy for HSAs

If you have both a Roth IRA and a HSA, and unreimbursed expenses for the HSA, you should always reimburse yourself from the HSA first before touching Roth assets. Both of them have tax free growth, but the HSA has worse inheritance properties.

If you intend to leave some assets to charity, you should favor leaving your HSA to charity first, as the charity faces no tax consequences for receiving the HSA.

While it would be ideal if you spend all your HSA assets before your demise and leave behind other assets to your children, you should favor designating the lowest income person amongst yourself and your children as the beneficiary (if you designate yourself, you're really designating your estate. If you do so, 26 US Code § 223 (f)(8)(B)(i)(II) says that you add the HSA balance to your income tax return filed on the year of your death). This way you minimize the income taxes paid on the HSA balance.

Once you reach the age of 65, when you can start taking HSA distributions for non medical expenses penalty (but not tax) free, you should favor HSA distributions over traditional IRA distributions.

  1. IRS FAQ ↩︎