This is one of the tax mechanisms most misunderstood by property owners in Spain, particularly foreign owners:the capital gains tax exemption on a primary residence in the event of reinvestment. Selling one’s primary residence can, in fact, be completely tax-free, provided that a new home is purchased. This provision, known as the “exención por reinversión en vivienda habitual,” is, however, subject to specific rules regarding duration, deadlines, and amount.
However, if not properly anticipated, these rules can result in the loss of the exemption—or even trigger a tax reassessment. And that really stings. The experts at Terreta Spain explain the mechanism, its conditions, and, most importantly, who it actually applies to.
Capital Gains Tax Exemption on a Primary Residence: The Basics
Key Takeaways
- The property being sold must be your primary residence, which you have occupied continuously for at least 3 years.
- You must reinvest the proceeds in a new primary residence within 2 years, either before or after the sale.
- A partial reinvestment results in a proportional exemption, not a full one.
- Spanish tax residents (IRPF) are eligible. Non-residents are also eligible, but only if they reside in the EU or the EEA.
- Sellers over the age of 65 are exempt from tax without reinvesting, but only if they are tax residents of Spain.
Who is eligible for the capital gains tax exemption on a primary residence?
First of all, the exemption applies tothe Impuesto sobre la Renta de las Personas Físicas (IRPF), the income tax for Spanish tax residents. It is therefore primarily intended for sellers residing in Spain—both Spanish nationals and foreigners (French, Belgian, Dutch, British, American, etc.)—who have become tax residents there and are selling their primary residence to purchase another one.
Reminder
Any person who stays in Spain for more than 183 days a year, or whose center of economic interests is in Spain, is considered a tax resident of Spain. The tax authorities also presume residency when the spouse and dependent minor children live there.
What about non-residents?
However, contrary to popular belief, the capital gains tax exemption on a primary residence does not preclude all non-residents from claiming it. Since the 2014 reform, a seller who is a resident of another European Union or European Economic Area country may claim the same exemption under theIRNR (Additional Provision 7 of the IRNR Act). However, two conditions are essential:
- The property sold must have been the seller's primary residence at the time of the sale or at any time during the two years preceding it;
- He must reinvest the amount in a new primary residence, within the same time frame as a resident.
Take, for example, a Dutch woman who lived in Valencia for five years and then returned to Amsterdam. If she sells her apartment in Valencia within two years of her departure and repurchases her primary residence in the Netherlands, she can claim the exemption. The same logic applies to a French, Belgian, or German citizen. However, an owner who has never lived in the property (second home, rental investment) is not eligible. Similarly, a resident outside the EU/EEA (United Kingdom, United States, United Arab Emirates, etc.) remains subject to a 24% tax rate.
Keep the timeline in mind: the buyer will still withhold 3% of the price. You can then claim the exemption through Form 210 if you have already repurchased the property, or through a specific refund request if the repurchase occurs after the sale.
Are you planning to buy or sell a home in Spain?
Terreta Spain helps you prepare for the sale of your home and the purchase of your new residence, whether in Madrid or Valencia, in collaboration with our partner tax specialists.
Contact Terreta SpainConditions for the capital gains tax exemption on a primary residence
1. Minimum Tenancy Term
First, the home you are selling must have been your primary residence for at least 3 consecutive years. Exceptions apply if you are required to change your place of residence before this period ends, such as in the event of death, marriage, separation, a job transfer, or your first job.
2. The reinvestment period
Next, you must reinvest the amount in a new home within two years, either before or after the sale. You may therefore buy first, provided you sell the old property within the following two years.
3. The amount to be reinvested
In practical terms, the amount to be reinvested is equal to the sale price, minus any outstanding balance on a mortgage. If the property is fully paid off, the entire sale price must therefore be reinvested to qualify for a full tax exemption.
4. Partial reinvestment
On the other hand, if you reinvest only a portion of the amount, the exemption applies only to the corresponding portion of the capital gain. The tax authorities then tax the balance at the standard rate—either according to the savings tax schedule for residents (19% to 30%) or at a rate of 19% for non-residents of the EU/EEA.
5. Moving into the new home
Finally, the new property must become your primary residence within 12 months of its purchase or the completion of its construction. You must then live there for at least 3 years, unless there are exceptional circumstances.
Why this requirement exists, and how the tax authorities enforce it
In reality, this requirement prevents the tax exemption from becoming merely a tax loophole. Without it, it would be enough to purchase a property “for appearances’ sake” without ever living there. The tax exemption granted in the year of the sale is therefore temporary: it depends on whether the new property is actually occupied in subsequent years.
Furthermore, there is no certificate that needs to be obtained in advance. In the event of an audit, the Agencia Tributaria relies on concrete evidence: the empadronamiento (registration in the municipal registry), water or electricity bills consistent with permanent occupancy, and the declared address.
⚠️ The burden of proof rests with you. If the tax authorities determine that you did not actually occupy the residence, they may revoke the exemption and issue a back-tax assessment, including interest on late payment and, if applicable, a penalty. This issue should therefore be addressed from the very beginning of the project.

Practical example: Calculating the capital gains tax exemption for a primary residence
Full or partial reinvestment
Example based on a capital gain of €150,000, with the property fully paid off
| Screenplay | Reinvestment | Tax-Exempt Capital Gains |
|---|---|---|
| Sale price: €400,000; buyback price: €400,000 | 100% of the selling price | 150,000 € (total) |
| Sale price: €400,000; buyback price: €300,000 | 75% of the selling price | €112,500; the remaining amount (€37,500) is still taxable |
Simplified educational example. The actual calculation depends on the taxpayer’s specific circumstances: have it reviewed by a partner tax specialist.
⚠️ This example does not take into account any outstanding loans, which reduce the amount available for reinvestment. Therefore, have a tax professional review your specific situation before selling or buying.
Over 65: A capital gains tax exemption on the primary residence without reinvesting
Good to know: A seller over the age of 65 is fully exempt from capital gains tax on the sale of their primary residence, with no requirement to reinvest the proceeds.
This more favorable tax regime is, however, reserved for Spanish tax residents. The Directorate General of Taxes reiterated this in 2026: a non-resident over the age of 65 cannot take advantage of it. Such a person can only avoid taxation by reinvesting, provided they reside in the EU or the EEA.
For a detailed breakdown of capital gains and other tax regimes, read our article on real estate sales taxation in Spain and our feature on capital gains for residents (ganancia patrimonial).
FAQ: Tax Exemption Through Reinvestment of a Primary Residence in Spain
Can a nonresident qualify for the capital gains exemption on their primary residence?
Yes, if the seller resides in the EU or the EEA, if the property sold was the seller’s primary residence (at the time of the sale or within the preceding two years), and if the seller reinvests in a new primary residence within two years. A person who simply owns a second home is not eligible.
What happens if I reinvest only part of the sale price?
The exemption is proportional. If you reinvest 75% of the amount received, 75% of the capital gain is exempt, and the remaining 25% is taxed at the normal rate.
Can I buy my new home before selling my old one?
Yes. The two-year period is calculated either before or after the sale. You may therefore purchase the new home first, provided that the previous home is sold within two years of that purchase.
Does the exemption apply if I sell the property before I have lived there for 3 years?
Generally speaking, no, unless there are circumstances that require a change of residence: death, marriage, separation, a job transfer, or a first job. Each situation must be documented and verified with a tax professional.
Is a nonresident over the age of 65 exempt from tax without reinvesting?
No. The exemption for individuals over 65 without reinvestment is limited to Spanish tax residents. A non-resident of the EU or EEA may only qualify for the exemption by reinvesting in a new primary residence.
Conclusion
A powerful tool—as long as you check every box
Length of ownership, reinvestment period, exact amount to be reinvested, tax status: the capital gains tax exemption on a primary residence can result in significant savings for both Spanish tax residents and EU residents. Terreta Spain assists its clients—both residents and non-residents—in coordinating the sale and new purchase, in collaboration with partner tax specialists.
Contact Terreta SpainFor more information:
- Taxation of Real Estate Sales in Spain: Residents and Non-Residents
- Selling as a resident: How is your capital gain taxed?
- Required Documents for Selling Real Estate in Spain
- Understanding the IRNR for Non-Residents
- Everything You Need to Know About Capital Gains on Real Estate in Spain
- Real Estate Taxes in Spain: The Complete Guide


