Sell HSA stocks after moving from California to Texas — state capital gains tax question

I moved from California to Texas in March and I've been holding appreciated index fund shares inside my HSA ever since I lived in CA. Now I want to sell those HSA stocks after moving from California to Texas to lock in some gains and rebalance. My question is about state capital gains tax. I know Texas has no income tax, but California is aggressive about taxing people who leave. I'm a full-year Texas resident now, the HSA is with my current employer's plan, and I haven't filed anything in California since the move. The gains would be realized after my residency change was complete. Does California have any claim on those gains just because I contributed to the HSA while living there? Or am I fully in Texas territory at this point? Tried searching but everything I find is about federal HSA rules, not the state angle.

34 comments

California is the state everyone worries about with this exact move. The key fact for CA is that it does not conform to federal HSA law at all — California taxes HSA earnings and investment gains as ordinary income at the state level, treating the HSA almost like a regular brokerage account for CA purposes. But that only applies while you are a California resident. Once you established Texas domicile and cut your CA ties, gains realized after that date belong to your new state — Texas — which taxes nothing. The question CA would actually ask is whether your residency change was real and complete before the sale.

Sam S.

Author

That's what I figured, but the "real and complete" part is what worries me. I changed my driver's license, registered to vote in TX, updated my employer address. Is there a formal CA test for that?

CA uses a facts-and-circumstances test, not a single checklist. The Franchise Tax Board looks at your domicile — where you intend to remain. Driver's license, voter registration, and employer address all help. The more of those you moved in March, the cleaner your argument.

The federal side of this is clean. Inside an HSA the investment gains grow tax-free federally and there's no federal capital gains event when you sell and reinvest within the account. The federal issue only comes if you take a nonqualified distribution. So your federal exposure from rebalancing inside the HSA is zero regardless of which state you're in.

Sam S.

Author

Good reminder — I was conflating the federal and state pieces. Federally the HSA sale is not taxable at all as long as funds stay in the account.

I moved from CA to WA two years ago and had the same concern about HSA stock gains. I uploaded my HSA year-end statements and my part-year return draft to taxr.ai and Taxr flagged that CA was showing a taxable line for HSA earnings through my CA residency period, which I hadn't caught. It also compared the dates on my residency forms against the transaction dates and listed which sales fell inside versus outside the CA period. Worth doing before you file if your situation has overlapping dates like mine did.

Sam S.

Author

This is exactly the kind of overlap I'm nervous about. My sales would all be after the move date but I want to make sure the dates are airtight before I file the CA part-year return.

One thing people get wrong here: California requires a part-year return (Form 540NR) for the period you were a CA resident. If you had any HSA investment income — dividends, capital gains distributions — while still a CA resident, that goes on the CA return. Gains you realize after leaving don't, but CA will want to see the part-year filing to confirm.

Sam S.

Author

So I'd file a CA 540NR for January through March, report any HSA income earned during that window, and then the post-March sale is purely a TX matter — meaning not reported to CA at all?

Yes, that's the basic structure. Your CA-source income ends on your move date for wage and investment purposes. The post-move HSA sale is outside CA's reach if your residency change was genuine and complete before the sale date.

I lived in CA for eight years before leaving. The FTB sent me a letter after my first post-move year asking why I had filed a part-year return. I responded with my TX lease start date, employer records, and the date I surrendered my CA license. They closed it without additional tax. Document everything contemporaneous to the move, not assembled after the fact.

Yes, the contemporaneous part is critical. A TX lease signed before the sale date is much stronger than records you pull together later.

Worth clarifying: even though the HSA sale itself is not a federal taxable event, if CA considers you a CA resident on the sale date, CA would treat the gain as taxable on the CA return. The whole question collapses to: what was your residency status on the trade date? If you're solidly TX by then, CA has no hook.

I sold HSA stocks in the same year I moved out of a high-tax state. I didn't realize my state treated HSA gains as taxable, so I had an unexpected balance on my part-year return. Check your state's HSA conformity before you assume it mirrors federal treatment — most states conform but a handful don't.

CA and NJ are the two states most people run into. CA doesn't conform at all. For anyone reading this in NJ the rules differ from CA so look up your specific state.

I ran into this last year after moving from CA to NV. I dropped my HSA statements and my FTB part-year return into Taxr and it pulled out the dates on each fund sale, matched them against my stated move date, and built a simple table showing which transactions were inside the CA residency window and which were outside. It made the 540NR much easier to review. That kind of date-mapping is tedious to do manually when you have multiple funds.

Sam S.

Author

Multiple funds is exactly my situation — four different ETFs. Having a table like that before I hand things to my CPA sounds really useful.

The IRS has no special rule that changes HSA treatment at the federal level based on what state you live in. Federal law is uniform. Your only federal risk inside the HSA is a nonqualified distribution — money coming out for non-medical expenses before 65. Rebalancing inside the account is not a distribution at all.

I'd push back slightly on the idea that moving in March and selling in, say, April is automatically clean. The FTB has a "safe harbor" concept but it's not an automatic rule — your facts still determine residency. If you kept a CA home, maintained CA bank accounts, or traveled back frequently in those early months, CA could argue you hadn't fully changed domicile yet.

Sam S.

Author

I closed my CA apartment lease in February before the March move, and I opened a TX bank account immediately. No CA property kept. Does that help the case?

Yes, a lot. Closing the CA lease before the move date and opening TX accounts contemporaneously are two of the stronger facts. Combine that with the voter and license change and you have a clear fact pattern.

The practical step is to note the exact trade date of every HSA sale — not the settlement date, the trade date — and map it against your documented move date. For federal purposes the holding period for securities runs from the trade date per Publication 550, and state tax authorities follow the same date logic when they're tracing which period your gain falls into.

Sam S.

Author

Good distinction. I'll pull the trade confirmation dates, not just the account statement dates.

I work in HR and see this come up when employees relocate. The employer address update in payroll is useful but it's not what determines tax residency — it's your domicile. Some employees update payroll but keep living in the old state for months, and that creates problems. Sounds like you actually moved, so you're in a better spot than many.

If your CA part-year return shows any HSA-related income during the CA period, make sure it's on the right line of the 540NR. CA doesn't have a dedicated HSA line the way the federal 8889 works — the income flows into the CA ordinary income lines because CA treats HSA earnings as regular investment income.

Sam S.

Author

I hadn't thought about where exactly it lands on the 540NR. I'll flag that specifically for my CPA so she knows to look for it.

The bigger risk I see in your situation isn't CA going after the post-move sale — it's CA auditing whether the move itself was genuine. CA is known for this, particularly for people with significant investment income or equity. If the amounts involved are large, working with a CPA or enrolled agent who handles CA nonresident issues specifically is worth the cost.

Sam S.

Author

The gains aren't enormous but they're not trivial either. I already have a CPA — I'll make sure she has CA nonresident experience specifically, good call.

I moved from CA to TX four years ago and CA never sent me anything. But I had a friend who moved the same year and got a residency audit because she still had a CA investment account open. She resolved it fine but it took months. The difference seemed to be how completely she had shifted her financial footprint.

Yes, keeping CA financial accounts open after a move is one of the factors the FTB weighs. Closing or transferring them is cleaner.

To summarize the federal piece cleanly: when you sell stocks inside an HSA and keep the proceeds in the HSA, there is no Form 1099-B issued, no Form 8949 entry, no Schedule D entry. It simply doesn't appear on your federal return. The state question is entirely separate from that federal non-event.

No, that's right, and it's an important point. The absence of a 1099-B sometimes makes people think they don't need to think about it at all — but CA will still want HSA investment income reported on the part-year return for the CA period, even without a 1099-B.

One edge case worth flagging: if you roll over or transfer the HSA to a new custodian around the same time as the move, make sure the transfer is treated as a trustee-to-trustee transfer and not a distribution and recontribution. A distribution, even briefly, could complicate the picture both federally and for CA.

Sam S.

Author

I'm not transferring custodians, just rebalancing within the same account. So that edge case doesn't apply to me, but useful to know.