How to calculate California cost basis for HSA capital gains

Moved to California a few years ago and finally realized the state doesn't treat HSAs like the federal government does. I've been investing inside my HSA — mostly index funds and some individual stocks — and now I'm trying to figure out how to calculate California cost basis for HSA capital gains on my CA state return. Federally everything is sheltered, but California taxes HSA earnings as regular income and the gains as capital gains. My broker's 1099-B shows the federal cost basis for covered securities, but I'm not sure if I can just use that same number for the state return or if I need to track something separately. I've never filed a CA Schedule D before. Do I just use the same purchase price as my federal basis, or does California require a different starting point?

38 comments

My HSA brokerage account had a pretty active year of trading two years back, so I've dealt with exactly this. California is one of only a handful of states that doesn't conform to the federal HSA exemption, so yes, you have to report the investment income and capital gains on your CA return. The good news is that the cost basis itself — what you paid for the shares — is generally the same number you see on your 1099-B. California doesn't create a different purchase price. What changes is that the gains aren't sheltered, so you're reporting them on CA Schedule D.

Derek R.

Author

That's the part I was unsure about — whether CA resets the basis or just removes the shelter. So same purchase price, just no exclusion. That helps a lot.

Had this same mess last spring. I uploaded my 1099-B and my HSA transaction history to taxr.ai and it compared the two line by line, flagged where the CUSIP matched and where the holding periods lined up, and drafted a worksheet showing the federal figures next to what needed to go on the CA Schedule D. That draft saved me probably three hours of manual matching. The actual rule: CA uses the same cost basis as federal for the shares themselves. The difference is that CA never gave you a deduction for HSA contributions the way federal did, so for the contributions side you don't get double-counted — but for the investment gains and losses, basis is what you paid.

Derek R.

Author

Did it also handle situations where shares were bought in multiple lots? I have several funds where I've been adding money monthly and the lots are all over the place.

Multiple lots, yes — that's exactly what it compared. It listed each lot with its acquisition date and per-share cost so I could see which ones were short-term vs. long-term for CA purposes. You still have to decide whether you're using FIFO or specific identification, but it lays out all the lots clearly.

Worth noting: CA Schedule D follows the same short-term / long-term structure as the federal Form 8949 / Schedule D. If you held a fund share more than one year, the gain is long-term on the CA return too. The holding period clock starts the day after the trade date you bought and ends on the trade date you sold — same rule as federal, just reported to CA instead of being sheltered.

Holding period next step for me: I need to go back through my HSA statements and find the actual trade dates, not the settlement dates. My brokerage sometimes shows settlement date on the monthly statement.

Settlement date next step is to ignore it for holding period purposes. The IRS and California both use trade date for securities traded on an established market. Settlement date is irrelevant for determining short-term vs. long-term.

My accountant told me something that tripped me up at first — California also taxes HSA dividends and interest as ordinary income, not just the capital gains when you sell. So if your HSA funds paid dividends that were reinvested, those reinvested amounts do add to your cost basis for CA purposes even though federally you never track them. Keep records of reinvested dividends inside the HSA.

Derek R.

Author

Reinvested dividends had completely slipped past me. I have dividend reinvestment turned on for two of my funds inside the HSA. So each reinvestment creates a new lot with its own basis?

New lot next step, yes. Each reinvested dividend is treated as if you bought new shares at that day's price. For CA that price becomes your cost basis for those shares. Your brokerage may or may not track this separately in the HSA account — worth calling them to ask if they have a CA-specific cost basis report.

I ran into an issue where my HSA custodian doesn't report anything to California at all — no state 1099 equivalent — so I had to build the whole gain/loss schedule myself from the transaction history PDF they give you each year. I gave that PDF and my federal 1099-B to Taxr and it matched up every sale with its corresponding lots, figured the holding period, and put together a table I could hand directly to my preparer for the CA Schedule D. Saved a lot of back-and-forth.

Transaction history PDF next step I'm on too. My custodian's online portal only goes back 18 months so I had to call and request the full history going back to when I started investing in the HSA.

Full history next step: once you have it, check whether they show cost basis per lot or just proceeds. Some custodians only show proceeds in the transaction history and you have to cross-reference with the original purchase confirmations.

Does California have its own version of the wash sale rule? I sold some losers inside my HSA late in the year and bought back similar funds within 30 days. Federally that doesn't matter since there's no tax anyway. But if CA is taxing the gains, do the wash sale rules apply to the losses too?

Wash sale next step is complicated here. CA generally conforms to the federal wash sale rules. If you sold at a loss and repurchased substantially identical securities within 30 days before or after the sale, the loss is disallowed and added to the basis of the new shares — same as federal. The fact that it's inside an HSA doesn't change the CA wash sale analysis since CA is treating the HSA as a taxable account.

Basis adjustment next step: so the disallowed loss gets added to the new shares' basis for CA purposes. That actually reduces the future CA gain when I eventually sell those new shares. At least there's some relief.

Exactly. The wash sale just defers the loss, it doesn't eliminate it. The adjusted basis on the replacement shares captures the disallowed loss so you get it eventually when those shares are sold without triggering another wash sale issue.

Spent a weekend on this last year. The practical workflow I landed on: export the full transaction history from your HSA custodian, sort by security, then by acquisition date within each security. For each sale, match it to the earliest lot (FIFO) unless you told the custodian to use specific identification at the time of sale. Calculate gain or loss per lot, then classify as short-term or long-term based on trade dates. Sum them up onto CA Schedule D.

Derek R.

Author

FIFO next step — I never actually designated specific lots when I sold so I guess I'm stuck with FIFO for the ones already sold. For future sales I should tell the custodian which lots to use at the time of the transaction.

There's a subtlety with mutual funds that sometimes gets missed: if your HSA held a mutual fund that distributed capital gains internally during the year, California taxes that distribution as capital gain income even though no shares were sold. The distribution doesn't increase the basis of your existing shares; if it was reinvested, it buys new shares that become a new lot with their own basis, same logic as the reinvested dividend situation. Your custodian's year-end tax statement should show these.

Distribution next step: I never realized the internal capital gain distributions mattered separately from selling shares. So I need to look at that section of the year-end statement too.

My HSA also held a money market fund for cash sweeps. California apparently taxes the interest from that too as ordinary income even though it's inside the HSA. I had to report it on my CA return as interest income, separate from the Schedule D capital gains.

Coming at this from a slightly different angle — I had Taxr read through my prior year CA return alongside the HSA transaction history and it found that my preparer had used the wrong acquisition dates for three lots, which made two of them look long-term when they were actually short-term for CA. The difference in rate mattered. I brought it back to the preparer with the corrected lot detail and we filed an amended CA return. For basis itself: Taxr confirmed the same thing others have said here — the per-share purchase price is the same as federal; it's just not sheltered. The holding period and wash sale rules apply the same way.

Derek R.

Author

Acquisition date next step I need to double-check too. I assumed short vs. long-term would be obvious but if dates can be misread from a transaction history PDF, I should verify each one manually.

Practical thing that helped me: I asked my HSA custodian whether they can produce a realized gain/loss report specifically for California. A few of the larger custodians have added this as an option in the last couple of years because so many CA account holders were asking. Mine could not, but it's worth a call before you spend hours building the spreadsheet yourself.

I want to flag something that could cause an error: some people assume that because HSA contributions to California weren't deductible, those contribution amounts themselves become part of the investment cost basis. That's not right. The contribution amount is irrelevant to the cost basis of shares you bought with it. The cost basis is the price you paid for the shares on the day you bought them, period.

Contribution basis confusion next step: this is exactly the mistake I almost made. I was about to add my annual contribution amounts to my basis as some kind of adjustment. The shares' purchase price is the basis. The contribution deductibility question is completely separate.

Derek R.

Author

This would have tripped me up. I was thinking the same thing — that since CA didn't let me deduct contributions, maybe that created some basis adjustment. But the shares' cost is just what I paid for them on the trade date, no contribution adjustment.

For anyone who also has losses from HSA investments in California — net losses from your HSA investments can offset other capital gains on your CA return, and if net losses exceed gains, the deductible loss against other income is limited the same way it is federally: check the CA Schedule D instructions for the annual limit and carryover worksheet because the CA limit may differ from the federal limit.

Loss carryover next step I didn't know was possible. So if I have more HSA losses than gains in a year, I can carry the excess to future CA returns? I had no idea that was available.

Carryover confirmation next step: yes, the same general framework applies. The excess carries forward. The instructions for CA Schedule D will show you exactly how to compute the carryover — the state form mirrors the federal logic but with California's own figures.

Worth repeating what a couple of people mentioned: California does not receive a 1099-B or any form from your HSA custodian. The reporting burden is entirely on you. If you don't report HSA investment gains on your CA return, there's no automatic matching the way the IRS does with the 1099-B. But CA does audit and cross-reference, so not reporting isn't a safe strategy.

My situation is a little different: I have an old HSA from before I moved to California. The shares I bought when I lived in a conforming state now have embedded gains, and I'm wondering whether the CA cost basis for those shares is the federal basis or whether CA marks up to FMV on the date I became a CA resident.

Residency date next step is important here. California's general rule for new residents is that pre-residency appreciation can be allocated to the nonresident period, potentially reducing the amount taxable in CA. This gets into CA Schedule S territory and possibly a part-year return analysis. For a large embedded gain on HSA holdings I'd strongly recommend an enrolled agent or CPA who handles CA part-year returns — the allocation method matters and it's easy to over-report CA income if you don't apply it correctly.

Part-year return next step — I hadn't thought about the part-year allocation angle at all. That changes things. I'll look for a CPA with CA part-year experience before I assume the whole embedded gain is taxable to CA.

To pull everyone's points together on the cost basis question specifically: (1) basis of each share lot is the price paid on the trade date — same as federal, no adjustment for contribution deductibility; (2) reinvested dividends and internal capital gain distributions each create new lots with their own basis; (3) wash sale rules apply, disallowed loss goes into the basis of the replacement shares; (4) holding period uses trade dates, not settlement dates. All of this gets reported on CA Schedule D.

Derek R.

Author

Those four points cover everything I was asking about. I have my work cut out but at least I know the framework now. Time to request the full transaction history and start building the spreadsheet.