Selling and rebuying stock to raise cost basis before moving to a higher-tax state

Moving from Texas to California in about four months and I've been sitting on a lot of unrealized gains in my taxable brokerage account. Someone told me I could sell my positions now, pay federal capital gains tax at my current zero-state-tax rate, then rebuy immediately to step up my cost basis before I become a California resident. That way future gains would be taxed at the new, higher basis. I get the basic idea but I'm worried about wash sale rules killing the whole strategy. These are stock ETFs, not individual securities I'm selling at a loss—I'd actually be selling at a gain. I've also read something about California having its own residency rules that could claw back gains. I've already tried reading through Publication 550 but couldn't find anything that addressed the state transition angle specifically. Is this strategy actually viable, and what are the tax mechanics I should understand?

37 comments

The wash sale rules won't touch this. Wash sales only apply when you sell at a loss and rebuy within 30 days. You're selling at a gain, so the wash sale disallowance under section 1091 simply doesn't apply—you can sell and rebuy immediately with no issue there. What you're actually doing is recognizing gain now, resetting basis to the current price, and reducing future taxable gain. The federal mechanics are clean. The tricky part is California residency timing, which is a state law question, not federal.

Diego W.

Author

That's the confirmation I needed on wash sales—I kept second-guessing myself because I'd only ever seen the rule discussed in the context of losses.

Worth separating two things here: the federal side and the California side. Federally: gain recognized while you're a Texas resident is fully yours at whatever your federal rate is. No state income tax in Texas. You rebuy, your new basis is the sale price, done. California side: California taxes its residents on worldwide income. The question is exactly when you become a California resident. That's not a federal question at all—it turns on California's FTB rules around domicile and the 546-day safe harbor. You'd want to look at that carefully before assuming the move date equals the tax cutoff.

Diego W.

Author

The California FTB piece is what I was most uncertain about. I'll dig into the part-year residency rules there separately.

The 546-day safe harbor you mentioned—that's for people who leave California, not for people moving in, right? Just want to make sure nobody reads that backwards.

Yes, correct. That safe harbor is for California residents leaving. For someone moving in, the question is domicile and when you establish California residency. Different analysis entirely.

I ran into almost this same question when I relocated from Washington to Oregon two years ago. I uploaded my brokerage statements and a draft of my planned trades to taxr.ai and Taxr identified which lots would generate short-term vs long-term gain based on my holding periods, then flagged two positions where I'd held less than a year and the gain would be short-term. That detail changed which positions I sold first. On the substance: the key federal form question is Schedule D and Form 8949. Each lot you sell gets its own row—proceeds in column (d), your old basis in column (e), and the gain flows to Schedule D. After you rebuy, your new basis for each position is simply your repurchase price.

Diego W.

Author

The lot-by-lot breakdown is exactly what I need to work through. Some of my ETF positions were bought in chunks over several years so the holding periods are mixed.

Short-term vs long-term matters a lot here. Per the holding period rules, you count starting the day after you bought and the sale date itself is included. For exchange-traded securities it's the trade date, not settlement. If any lots are under a year old, those gains are short-term and taxed as ordinary income at the federal level. Depending on your bracket that could be significantly worse than long-term rates. Worth running the numbers lot by lot before you decide which positions to sell.

This is the part that bites people. They think "raise basis" and forget they might be accelerating a short-term gain that would have become long-term in three more months.

Diego W.

Author

Yes, some of my lots are from 2024 so I need to check each one carefully. Good point about waiting a few more months on specific lots if that tips them to long-term.

One thing I'd add: if your gains are large enough that selling them all in one year pushes you into a higher federal bracket or triggers the net investment income tax, that changes the calculus. The NIIT applies to investment income above certain thresholds—the instructions for Schedule D and Form 8960 cover this. Sometimes it's better to spread sales across two tax years rather than recognize everything at once.

Agreed. I did a large sale in one year without thinking about bracket stacking and it pushed dividend income into a worse rate too. Worth modeling it out before executing.

Practically speaking: once you sell and repurchase, the new 1099-B you receive next January will show your new (higher) cost basis. If your broker reports covered securities with basis reported to the IRS, that flows into box 1e of the 1099-B. Keep records of the actual purchase confirmations too in case there's ever a discrepancy.

Diego W.

Author

Good reminder. I'll download trade confirmations immediately after executing rather than relying on year-end statements.

Nobody seems to have mentioned transaction costs. If you're in ETFs with bid-ask spreads and you're doing a large sale-and-rebuy, you're paying spread twice plus any commissions. On a large position that can be real money. For index ETFs tracking the same index, you could also consider switching to a different but not "substantially identical" fund to avoid even the theoretical wash sale question—though as noted above, gains don't trigger wash sales anyway.

The "substantially identical" concern is moot on the gain side. But switching funds as part of the rebuy is a valid strategy for other reasons—you might prefer a lower-expense fund anyway.

California part-year returns use Schedule CA on the state return. Income recognized before you become a California resident generally goes in the non-California column. But California's FTB has taken aggressive positions on when residency begins, particularly if you're buying a home there or your family moves ahead of you. This is a situation where a CPA licensed in California is worth consulting before you execute—the state rules are fact-specific and the stakes are high if the FTB disagrees with your residency date.

Diego W.

Author

This is my biggest concern. I'll be buying property there before the move is fully complete. That's exactly the kind of fact pattern that probably needs a California CPA.

Buying property before you formally move is a significant factor. The FTB looks at things like where you get your mail, where your cars are registered, where your family is. A California CPA or tax attorney who handles residency audits is the right call here—not something to DIY.

When I was sorting out which of my lots to harvest last year, I gave Taxr my 1099-B and my brokerage's unrealized gain report and it cross-checked the holding period on each lot against the 1099-B dates and built me a list sorted by short-term vs long-term and by gain size. Saved me a couple hours of spreadsheet work. Useful when you have a lot of lots across multiple years. On the federal reporting: each sale goes on Form 8949. If your broker reports basis to the IRS (covered securities), you check box A for short-term or box D for long-term. The totals carry to Schedule D lines 1b and 8b respectively.

Diego W.

Author

Exactly the kind of organized breakdown I'll need. My positions span four years of purchases so there are a lot of individual lots to track.

Something worth noting: after you rebuy, the clock resets. You'll have a new acquisition date equal to the rebuy date. So if California does get to tax future gains and you sell within a year of the rebuy, those gains will be short-term. If you're planning to hold the positions long-term in California anyway that's fine, but if there's any chance you'd sell soon after moving, you're setting yourself up for a short-term gain under California rates, which are ordinary income rates.

Yes, holding period resets completely. That's often overlooked. The new basis is clean but the new holding period starts from zero.

Diego W.

Author

That's a real consideration—I had assumed I'd hold for years but it's not a certainty on every position.

Are you in a position where some lots have losses? If you have any positions that are underwater, you could harvest those losses to offset some of the gains you're recognizing. Just watch the 30-day window on the repurchase side for those—that's where wash sale rules actually do apply. Losses sold and rebuyed within 30 days would have the disallowed loss added to your new basis instead of being deductible now.

Diego W.

Author

I do have a couple of underwater positions from 2024. The 30-day window for those is definitely something I'd need to manage carefully.

Right, and if you can't wait 30 days, you can rebuy a substantially non-identical fund in the meantime to stay invested while the window runs. Just has to be genuinely different—not the same index through a different issuer.

I uploaded my own brokerage gain/loss report to Taxr before doing a similar harvest last spring and it checked each lot's acquisition date against the sale date and confirmed which were long-term—it also flagged one lot I thought was long-term that was actually one day short. Would have been an expensive mistake. On your specific situation: Publication 550 at irs.gov covers holding period rules in detail if you want to verify the federal side yourself. The state residency question is entirely separate from federal and needs California-specific advice.

Diego W.

Author

One day short—that's exactly the kind of error I could easily make on a lot I bought on a specific date and lost track of. Worth triple-checking every lot.

To put the federal mechanics plainly: sell → recognize gain → pay federal tax at your current rate → repurchase → new basis = repurchase price → future gains measured from the new basis. That's the whole strategy. It's completely legal and the IRS doesn't penalize you for recognizing gain deliberately.

If the positions are in ETFs that track broad indexes, liquidity usually isn't a concern—you can sell and rebuy same-day without material market impact. If you're in narrower sector ETFs or individual stocks, you might want to think about whether a large sale moves the price against you, though for most retail-sized accounts this isn't a real issue.

For most people's portfolio sizes, same-day execution on ETFs is completely routine. The bigger timing question is making sure the trades execute by the last trading day of the year if you want them in this tax year, since the trade date, not settlement, decides the year.

Nobody above mentioned the NIIT threshold interaction explicitly: if your modified AGI is above a certain level, net investment income including these recognized gains gets hit with an additional tax reported on Form 8960. It doesn't change the basis-step-up strategy, but it affects how much you actually pay when you execute. I had Taxr look at my AGI alongside my planned sale amounts to estimate where I'd land relative to that threshold—it laid out the numbers clearly so I could decide whether to split the sales across two years. Worth doing that modeling before you pull the trigger.

Good addition. The Form 8960 layer is easy to forget when you're focused on capital gains rates. Especially relevant if the gain amount itself pushes you over the threshold.

The strategy is sound on the federal side. The execution risk is entirely in California residency timing. If you have any doubt about when exactly you become a California resident—and buying property early creates real doubt—get a California CPA or tax attorney involved before you sell. The FTB can audit residency and the burden of proof is on you to show you weren't a California resident when the gains were recognized.

Diego W.

Author

This is probably the clearest summary of where the real risk sits. Federal mechanics are clean; California timing is the variable I can't afford to get wrong.