Andrés is 51, has always lived in Valencia and founded a software company eighteen years ago. He still holds 35% of it, which cost him 200,000 euros across incorporation and two capital increases. A recent funding round has put a price on the company, and his 35% is now worth around 1,800,000 euros. He also owns a portfolio of listed shares worth about 900,000 euros. In February 2027 he moves to Lisbon with his family. He has no plans to sell anything. And yet, when he stops being resident in Spain, he may have to declare a gain of 1,600,000 euros that he has never received.
That is the exit tax. It is not a separate tax but a rule inside Spanish personal income tax (IRPF): article 95 bis of Law 35/2006 treats the latent increase in value of shares and holdings as a capital gain when the taxpayer ceases to be a Spanish taxpayer because of a change of residence. This guide explains when it applies, how it is calculated and the three ways out the law itself offers: deferral within the European Union, an extension for temporary moves, and a refund if you come back.
What switches the rule on
The gain only arises if two conditions are met together: one about how long you have been resident and one about size.
Length of residence: you must have been an IRPF taxpayer for at least ten of the fifteen tax periods before the last one you have to file. Andrés, resident all his life, clearly meets it. Someone who arrived in Spain six years ago does not.
Size comes in two versions, and either is enough:
| Case | Threshold in art. 95 bis.1 | Which shares are taxed |
|---|---|---|
| Letter a) | The market value of all shares and holdings together exceeds 4,000,000 euros | All of them |
| Letter b) | Otherwise: a stake of more than 25% in one entity, where the market value of your holding in it exceeds 1,000,000 euros | Only those in that entity |
For Andrés, the total (1,800,000 + 900,000 = 2,700,000 euros) is below four million, so letter a) does not apply. But his 35% stake is above 25% and worth more than a million, so he falls under letter b). The consequence matters: only the latent gain on that company is taxed. His listed portfolio stays outside, even though it has also gone up.
The article refers to shares or holdings "in any type of entity", which also covers units in investment funds. It does not reach property, bank accounts or other assets.
Which year, and on what date the shares are valued
The gain is allocated to the last tax period you must file in Spain. If Andrés leaves in February 2027 and spends too little of that year in Spain to remain resident, his last Spanish return is for 2026. The shares are valued on the accrual date of that period, 31 December 2026. Exactly when residence ends is a separate question, covered in our guide to dual residence.
The law sets the value as follows:
- Listed shares on regulated markets: their market price.
- Unlisted shares: unless a different market value is proved, the higher of the net equity in the last closed balance sheet and the figure obtained by capitalising at 20% the average profit of the last three closed financial years. The practical detail is in our guide to valuing unlisted shares.
- Investment funds: the net asset value on that date or, failing that, the last one published.
The words "unless a different market value is proved" matter in a case like Andrés's. Where a recent deal with a third party has priced the company, it is reasonable to expect the tax authority to take it into account, whatever the balance sheet says.
Working through the numbers
The gain goes into the savings tax base and is declared through a supplementary return for the last period, with no penalty, late-payment interest or surcharge. Article 121 of the IRPF Regulation sets the deadline: the filing window for the first year in which you are no longer a Spanish taxpayer. For Andrés, the supplementary 2026 return is filed during the 2027 income tax campaign.
- Market value of his 35% at 31-12-2026: 1,800,000 euros.
- Acquisition cost: 200,000 euros.
- Latent gain: 1,600,000 euros.
- Tax on the savings scale (State plus regional), ignoring the personal allowance and any other savings income: 6,000 × 19% = 1,140; 44,000 × 21% = 9,240; 150,000 × 23% = 34,500; 100,000 × 27% = 27,000; and the rest, 1,300,000 × 30% = 390,000.
- Total: 461,880 euros, on money he has not received.
That is why the part of the article that really matters is not the calculation, but the routes it offers to avoid paying that sum in one go, or at all.
Moving to another EU or EEA country
Where the move is to another EU Member State, or to a state in the European Economic Area with an effective exchange of tax information, the taxpayer may opt for a special regime (art. 95 bis.6). Under it, the gain only has to be self-assessed if, within the following ten years, one of three things happens:
- the shares or holdings are transferred during the taxpayer's lifetime;
- the taxpayer stops being resident in an EU or EEA state;
- the taxpayer fails to meet the duty to report to the Spanish tax authority.
The reporting is not a formality: you must notify the option, the gain, the destination state with your address and any later changes, and the fact that you still hold the shares. The Regulation (art. 123) gives two months to report each change of address. If Andrés sells within the ten years, the exit gain is reduced by any fall in value since he left. And if he becomes a Spanish taxpayer again before any of those events, the article ceases to have effect.
Portugal is a Member State, so Andrés can use this route. Had he been moving to Switzerland, Dubai or the United States, it would not be available.
Temporary moves: extending the payment
Paragraph 4 offers another route for temporary moves, and it is the one that matters when the destination does not allow the European regime. On application, the tax authority defers payment where the move is:
- for work reasons, to a country or territory that is not a tax haven; or
- for any other reason, to a country that has a double taxation treaty with Spain containing an exchange of information clause.
The extension follows the general rules of the General Tax Act: interest accrues and security is required, which may be given wholly or partly over the shares themselves. The application is made within the same filing window and states the destination country. The deferral expires, at the latest, on 30 June of the year after a period of five tax years ends; for work moves, a further extension of up to five more years may be requested. If the shares are sold first, the Regulation brings the due date forward to two months after the sale.
The reward comes on return: if you become a Spanish taxpayer again within that period without having transferred the shares, the deferred debt and its interest are extinguished. The cost of the security is not refunded.
What the article does not solve. The exit tax is a Spanish rule. Whether your new country later taxes the sale of those shares, what base cost it accepts, whether it recognises the tax already paid in Spain or has its own exit rule, is a matter of that country's law. We do not give opinions on it: your adviser there has to confirm it. Nor can it be assumed that the tax authority will accept the value declared, particularly for an unlisted company. There is a risk of review, and we always flag it before filing.
Paying now and coming back later
If you pay the gain without deferring it, it is not necessarily lost for good. If you become a Spanish taxpayer again without having transferred the shares, you may ask for the return to be corrected and the amount paid for this gain to be refunded, with late-payment interest from the date of payment until the refund is ordered (art. 95 bis.5). The request can be made once the filing window for the first period in which you are taxed in Spain again has closed. Returning has its own issues, set out in our guide to coming back to Spain.
Tax havens and the Beckham regime: two special rules
Tax havens. A Spanish national who moves to a country or territory classed as a tax haven does not stop being a Spanish taxpayer in the year of the move or the following four years (art. 8.2). Even so, article 95 bis.7 applies the exit tax: the gain is allocated to the last period of habitual residence in Spain and valued at that date. If the shares are sold while the person is still a Spanish taxpayer, that value becomes the base cost, so the same increase is not taxed twice.
The article 93 regime. For anyone who was under the special regime for workers posted to Spain, the ten years of residence only start counting from the first year in which the regime no longer applies (95 bis.8). Someone who arrived under Beckham, used it up and leaves soon afterwards will usually not reach ten years. How the regime ends is covered in our guide to leaving article 93, and the regime itself on our Beckham regime page.
Questions to settle before the removal van comes
| Question | Why it matters |
|---|---|
| Have I been a Spanish taxpayer for 10 of the last 15 years? | Without that there is no exit tax, however large the portfolio |
| Am I above 4 million in total, or above 25% and 1 million in one company? | Decides whether everything is taxed or only that company |
| Which will be my last Spanish tax period? | Fixes the valuation date and the deadline for the supplementary return |
| Is my destination in the EU or EEA, or is this a temporary move? | Opens the ten-year deferral or the extension with security |
| Do I plan to sell, or to come back? | A sale triggers payment; a return cancels or refunds it |
Leaving also brings steps that have nothing to do with the size of the portfolio, such as updating your tax registration status, explained in our guide to Modelo 247, and, where there is income in both countries, proving where you live with a tax residence certificate. If, once resident abroad, those shares pay dividends that are taxed twice, the fix is a different one: the article 80 credit or whatever the treaty provides.
Building the exit file
To review it we need the planned departure date and destination, your residence history for the last fifteen years, a list of shares and holdings with their value and cost, and the last three balance sheets of any unlisted company. With that we check whether the article applies, calculate the gain and prepare the right option: the EU notification, the application for deferral or the supplementary return. The starting point is our tax residence form, and the rest of this service is on our tax residence certificate page. We analyse every departure with care, but what the tax authority decides is not in our hands and we do not guarantee the outcome.
If your situation crosses borders in more than one way, carry on with the exemption for work done abroad, relief for tax already paid abroad, controlled foreign company rules and how Spain looks at a trust.