If you have held index funds or individual stocks for years, most of what is in your taxable brokerage account is probably gain rather than principal. In the United States that is not always a tax problem: a retiree whose taxable income is modest can fall into the 0% long-term capital-gains bracket and realise those gains at no federal cost at all. Financial planners build whole strategies around it, "tax-gain harvesting" — deliberately selling and rebuying to lift your cost basis for free while you have the room.
This page is written for Americans planning a move on the non-lucrative visa, and it sits alongside our notes on keeping US brokerage accounts after the move and the non-lucrative visa for dividend investors. Those pages deal with life after arrival; this one is about the window before it, because a US tax break that costs nothing at home behaves very differently once Spain's taxing right switches on. None of this is tax advice — it is general orientation, and your numbers belong with a Spanish asesor fiscal and a US tax adviser working together.
On this page
What tax-gain harvesting actually is The 2026 numbers Why the 0% bracket stops working in Spain The part nobody budgets for: Spain gives no step-up on arrival The timing pivot: harvest in a US-only year Harvest before vs after becoming a Spanish resident Where it stops helping — and what can go wrong Frequently asked questions
"Retirees arrive telling me they never pay tax on their investments — and in the US, with a sensible income, that can be true. The point I want them to see is that the free 0% window is a US window, and it closes the year Spain's tax right begins. Spain won't give them the break, and it won't pretend their shares were bought on the day they landed either. If we know the move is coming, the year before is when a portfolio's basis is worth resetting, cleanly, while the US still charges nothing for it."
— Lola Jurado · Immigration lawyer, Ilustre Colegio de Abogados de Málaga (nº 10907)
What tax-gain harvesting actually is
Tax-gain harvesting is the mirror image of the loss harvesting most investors know. Instead of selling losers to book a deductible loss, you sell winners in a year when your income is low enough that the long-term gain is taxed at 0% federally — then, if you want to keep the position, you buy it straight back. Nothing about your portfolio changes except one number: your cost basis, which is now reset to the higher price you just sold at. Every dollar of gain you "washed" out at 0% is a dollar that will never be taxed again as a gain.
Two features make it clean. First, it only touches long-term gains — assets held more than a year — which are the ones eligible for the preferential 0/15/20% rates. Second, and crucially, the wash-sale rule does not apply to gains. That rule, under IRC §1091, disallows a loss if you rebuy a substantially identical security within 30 days; it says nothing about gains. So you can sell an appreciated holding and repurchase it the same morning to lock in the higher basis, with no waiting period and no disallowance. Loss harvesters have to sit out 30 days or buy something merely similar; gain harvesters do not.
The 2026 numbers
The strategy only works inside the 0% band, so the thresholds are the whole game. For 2026 the long-term capital-gains rate is 0% until your taxable income crosses the figures below, then 15%, then 20% at the top. Remember these are taxable income figures — after the standard or itemised deduction — and that the gain you harvest stacks on top of your other income, filling the band from the bottom up.
| 2026 filing status | 0% long-term gains up to | Then 15% until |
|---|---|---|
| Single | $49,450 taxable income | $545,500 |
| Married filing jointly | $98,900 taxable income | $613,700 |
| Head of household | $66,200 taxable income | $579,600 |
For a couple whose income comes mostly from Social Security and modest withdrawals, that $98,900 joint ceiling leaves real room to realise gains at 0% each year. The same preferential rates and thresholds apply to qualified dividends. What matters for a move is that this is a use-it-or-lose-it allowance tied to being a US-only taxpayer: it does not travel, and there is no Spanish equivalent waiting on the other side.
Why the 0% bracket stops working in Spain
Once you become a Spanish tax resident — broadly more than 183 days in a calendar year, or your main centre of economic interests in Spain, as set out in our note on the 183-day residency rule — Spain taxes your worldwide income, and capital gains fall into the base del ahorro, the savings-income base. There is no 0% band there. For 2026 the savings rates run in steps: 19% on the first €6,000 of savings income, 21% up to €50,000, 23% up to €200,000, 27% up to €300,000, and 30% above that.
Now put the two systems together on the same sale. If you realise a long-term gain while still a US-only taxpayer inside the 0% band, the US charges nothing and Spain has no claim — the gain disappears at zero cost. If you realise the identical gain after becoming a Spanish resident, Spain taxes it at 19% or more from the first euro, and because the US charged 0% there is no US tax for a treaty foreign tax credit to offset. The Spanish tax lands as a straight, unrelieved cost. The break did not shrink in the move; it was removed.
The part nobody budgets for: Spain gives no step-up on arrival
This is the piece that turns a nice-to-have into a decision worth planning around. Spain computes a capital gain as the transfer value less your original acquisition value. As a general rule it does not rebase your assets to their market value on the day you become resident. Some countries hand new arrivals a fresh basis at that date — a "deemed acquisition" — so they only pay tax on growth that happens on their watch. Spain, as a matter of course, does not.
The consequence is easy to miss and expensive to discover late. Suppose you bought an index fund for $100,000 twenty years ago and it is worth $400,000 when you move. If you do nothing and sell it as a Spanish resident, Spain measures the gain from your original $100,000 — the full $300,000 — even though every dollar of that appreciation accrued while you lived in the United States. Spain taxes growth it had no part in, because it never reset the starting line. Harvesting the gain before the move is the only way to move that starting line: sell and rebuy at $400,000 while still a US-only taxpayer, and your basis for Spanish purposes is now $400,000, so only future growth is ever exposed to Spanish tax.
The same logic runs, in a happier direction, through inheritance: a Spanish heir generally does receive a step-up, which is why our note on the community-property step-up matters for couples. But that is death and inheritance tax doing the rebasing, not immigration. For a living retiree simply moving to Spain, no such reset is handed over at the border.
The timing pivot: harvest in a US-only year
Everything turns on the calendar, and Spain's calendar is unforgiving in a specific way: it does not split the tax year. Under Spanish rules you are generally either resident or non-resident for the whole calendar year, with no US-style dual-status split. So the clean window for harvesting is a calendar year in which you are not, and will not become, a Spanish tax resident — realistically, the year before the year your residency begins. Harvest then, and the sale is a US-only event: 0% if you stay in the band, no Spanish taxing right, basis reset.
Try to squeeze the harvest into the same calendar year you actually move and you invite the argument that Spain was entitled to tax you for that whole year, gains included. This is the same trap that catches Roth conversions and large withdrawals, which is why we lay it out on the Roth conversion timing page and in the note on the order you draw on your accounts. The levers that exist before residency switches on — harvesting gains, converting to Roth, selling a home under the §121 exclusion, and cutting US state residency — mostly close the moment the Spanish year begins. The same logic runs in reverse for anyone tempted to spread a sale over years: an installment sale or seller financing pushes gain into exactly those Spanish-resident years instead.
Harvest before vs after becoming a Spanish resident
Laid side by side, the difference is almost entirely about timing rather than the mechanics of the trade.
| Harvest while still a US-only taxpayer | Sell after Spanish residency begins | |
|---|---|---|
| US tax on the gain | 0% if within the band; 15% above it | US still taxes the citizen; often 0% or 15% |
| Spanish tax on the gain | None — Spain has no taxing right yet | 19%–30% on the gain from original cost |
| Cost basis going forward | Reset upward to today's value | Stuck at original cost; US-era growth exposed |
| Foreign tax credit | Not engaged — a US-only event | Little to credit; US charged 0% or little |
| Net position | Decades of gain washed out at little cost | Spain taxes appreciation it had no part in |
The right-hand column is not a disaster in every case — a modest portfolio, or one you plan to hold until death for the inheritance step-up, may not need the reset. But for a large, highly-appreciated taxable account that you expect to draw on during your Spanish years, the gap between the two columns can be the largest single number in the whole relocation plan.
Where it stops helping — and what can go wrong
Harvesting is not free of consequences, and it is worth being honest about its edges. Realising gains fills your US taxable income, so an over-enthusiastic harvest can push part of the gain out of the 0% band and into 15%, or spill ordinary income into a higher bracket. It also raises your modified adjusted gross income, which is the figure Medicare uses two years later to set premiums — so a big harvest can quietly trigger the IRMAA surcharge even for someone who has moved abroad, and can affect ACA subsidies in a transition year. The band is a ceiling to work up to carefully, not a target to blow through.
It also only reaches one kind of account. Harvesting resets the basis of assets in a taxable brokerage account. It does nothing for a traditional IRA or 401(k), which have no outside basis and whose distributions are taxed as ordinary income however long you held them — those are a matter of withdrawal sequencing and Roth decisions instead. Crypto has its own version of this timing issue: a pre-move sale can create a US taxable disposal and may be part of building a crypto-funded proof-of-means file, but it is not a wash-sale-style basis reset for a brokerage portfolio. And harvesting does not remove the assets from Spain's reporting net: a large taxable portfolio abroad is generally declarable on the Modelo 720 once the relevant balance crosses €50,000, and can feed into the Spanish wealth tax depending on your region. Resetting basis changes the income-tax exposure of a future sale; it does not make the account disappear from the Spanish system.
Frequently asked questions
Should I harvest capital gains before moving to Spain?
For many US retirees with modest taxable income, realising long-term gains while you are still a US-only taxpayer in the 0% federal bracket can reset your cost basis at little or no US cost. Spain does not honour that 0% break and, as a rule, does not rebase your assets to market value when you become resident, so it taxes the whole gain from your original cost. Doing the reset in a calendar year before Spanish residency begins captures the free step-up while it is still available. It is not automatically right for everyone — harvesting raises your US taxable income and MAGI — and should be modelled with a Spanish asesor fiscal and a US tax adviser before you act.
Does Spain give you a step-up in basis when you become resident?
As a general rule, no. Spain computes a capital gain as the transfer value less your original acquisition value, and it does not, as a matter of course, reset your assets to their market value on the day you become a Spanish tax resident. The appreciation that built up during your US years therefore stays inside the Spanish gain and can be taxed by Spain when you eventually sell, even though none of it accrued while you lived in Spain. This is the opposite of the automatic rebasing some other countries give new arrivals, and it is the main reason resetting basis before the move matters.
Will the wash-sale rule stop me from harvesting gains?
No. The US wash-sale rule under IRC §1091 disallows losses when you buy back a substantially identical security within 30 days. It does not apply to gains. You can sell an appreciated holding to realise the gain and buy it straight back the same day to reset your cost basis higher, with no wash-sale problem. That is what makes gain harvesting mechanically clean, unlike loss harvesting, where you must wait 30 days or buy something merely similar.
Can I harvest gains in the same year I move to Spain?
It is risky. Spain does not split its tax year the way the US does. Under Spanish rules you are generally either resident or non-resident for the whole calendar year, so a gain you realise earlier in the same calendar year you later become resident can still fall inside Spain's worldwide taxing right for that year. To keep the harvest a US-only event, the safe pattern is to realise the gains in a calendar year before the year Spanish residency begins, and to confirm your residency start year with a Spanish asesor fiscal.
Does gain harvesting help my IRA or 401(k)?
No. Harvesting resets the cost basis of assets held in a taxable brokerage account. Traditional IRAs and 401(k)s have no outside basis to step up, and their distributions are taxed as ordinary income rather than capital gains, so there is nothing to harvest. Those accounts are governed by different levers — the order in which you draw on them and whether a Roth conversion makes sense before the move. Gain harvesting is only about after-tax brokerage holdings.
Sources reviewed July 2026: IRS newsroom and Revenue Procedure guidance on 2026 inflation-adjusted long-term capital-gains breakpoints (0% up to $49,450 single / $98,900 married filing jointly / $66,200 head of household) and the 0/15/20% rate structure; IRC §1 (capital-gains rates) and §1091 (wash sales, which apply to losses only); the United States–Spain income tax treaty and published summaries of its capital-gains, residence and saving-clause articles; Spanish Ley 35/2006 del IRPF and AEAT guidance on tax residence (art. 9), the savings base (base del ahorro) and the computation of capital gains from acquisition value (arts. 34–37), together with the 2026 savings-base rate steps (19%/21%/23%/27%/30%); and the Modelo 720 reporting regime and Spanish wealth-tax rules with their regional variation. General information only, not legal, tax or immigration advice, and not US tax advice; thresholds, treaty treatment, IRPF classification and rates, regional variation and the absence of an immigration step-up change and should be confirmed with a qualified Spanish asesor fiscal and a US tax adviser before you rely on them.