HSAs and Retirement

Here are three threads on exactly that.
Nov 2015:

Oct 2020:

Jan 2021:

In general, assuming you can afford it, and your HSA provider has decent investment options beyond just passbook savings, you should consider it simply an extra 401K or IRA and max it out every year, never touching the money until retirement.

See also this Investopedia advice.

@elbows: HSA’s are only available to people who have a certain type of medical plan, a so-called “high deductible health plan” or HDHP. Although they’ve been around for 20-ish years now fairly few employers offer them.