HSA - am i understanding this right?

Hello,

I am opening an HSA.

Self employed, Tax rate lets assume 24% and my state tax is 0%. I have a high deductible insurance plan.

I'm 33 (32 years away from tax free withdrawal)

I'm just trying to make sure i understand this all the way. In the past, I had held off on opening an HSA because it felt like the annual savings was only a few thousand if even that, but I realized it can also be invested AND i can't contribute to a roth anymore for income limits so its time to open the HSA. This is what I am understanding of the financial gain of the HSA.

Let's say I invest $4,000 per year in to the HSA... this means I will save 24% on the $4k, which is about $960 of tax savings per year. So, if I do this until 65, I will have invested $128,000 and saved $30,720 in taxes over the years.

Also, I can invest the $4,000 contributions into the stock market. So if that is compounded for 32 years at 5% I will have $311K, although I only invested $128K, benefiting by $183K in tax free stock growth.

So in this scenario, I benefit by:

-saving $960/yr in taxes or $30K over the time period)

-Tax free investment on the money, benefiting $183K over 32 years..... then I can withdraw tax free at 65?

-not considering benefit of using the HSA for expenses right now.

Does this understanding hold up? I did finance in school but sometimes wonder if I am mathing correctly. Thank you!