Personal Income Tax (IRPF) on selling a property: capital gains, deductible expenses and exemptions

Selling a property can have consequences for Personal Income Tax (IRPF) when there is a capital gain. That gain is not "the sale price", but the difference between the transfer value and the acquisition value, taking into account any adjustments and expenses permitted by the Personal Income Tax Law (LIRPF) and its implementing regulations.
This guide sets out common concepts when selling property in Spain. It does not constitute tax advice: final taxation depends on your background, key dates, property use and regulatory updates. Always verify your situation with your accountant or tax advisor before finalizing figures.
What capital gains are when selling a property
In general terms, the tax authority assesses how much you have gained or lost when transferring the property relative to what it cost to acquire (plus allowed improvements and deductible expenses). A positive result forms part of the IRPF savings tax base, according to the tax bands in force for the relevant tax year.
If the result is negative (a capital loss), regulations lay down specific rules for offsetting losses and time limits. Do not assume that "since I sold cheaply I do not have to report anything": an obligation to file an information return may still apply even if no tax is payable.
Transfer value and acquisition value
The transfer value is usually tied to the actual sale price, with nuances if the price deviates from market value or involves related-party transactions. The acquisition value includes the price paid when buying plus, where applicable:
- acquisition expenses (notary fees, registry fees and purchase taxes paid at the time);
- investments and improvements carried out on the property permitted by regulations (cosmetic work does not generally qualify);
- adjustments from previous transfers (inheritances, gifts) that alter the tax base.
If you bought decades ago without keeping invoices, reconstructing the acquisition base is harder and riskier. Retaining documentation from day one simplifies any future sale.
Deductible expenses on transfer (guidance)
Under the conditions and limits established by law, the LIRPF allows certain expenses necessary for the disposal to be deducted. Common examples analyzed in professional practice (though not automatic in every case) include:
- estate agency fees connected with the sale;
- costs of certificates required to complete the transfer;
- certain sale formalization costs where legal requirements are met.
Not everything you pay when selling reduces your capital gain. Municipal capital gains tax (plusvalía municipal), for instance, is a separate local tax governed by its own rules (municipal plusvalía tax when selling).
Exemption through reinvestment in a main residence
The LIRPF provides partial or total tax relief when you reinvest the proceeds obtained into another primary home within legal timeframes and conditions. Key requirements revolve around:
- the property sold having been the taxpayer's main residence;
- time limits to reinvest or to have acquired the new main residence;
- the amount reinvested in relation to the transfer value.
This is one of the most frequently asked about areas and is particularly sensitive to dates and documentary proof. Reinvesting part of the sum may yield a partial exemption. Avoid applying rules from someone else's case to your own.
Over-65s and main residences
Regulations provide tax exemptions on capital gains resulting from the sale of a main residence based on the taxpayer's age and the status of the home. The exact conditions (age, ownership, usage, timeframes) must be reviewed in the LIRPF applicable for the tax year in question and verified with tax officials or an advisor.
This pathway does not replace other local taxes, nor does it automatically exempt you from reporting the transaction if an information filing requirement applies.
Legal comparison of IRPF exemptions on main residence transfers
Differences in legal requirements set by the IRPF Law between reinvestment relief and age-based exemption.
| Legal criterion | Reinvestment exemption | Exemption for over-65s |
|---|---|---|
| Property being sold | Must be the taxpayer's main residence. | Must be the taxpayer's main residence. |
| Reinvestment obligation | Mandatory to reinvest the proceeds into a new main residence. | No reinvestment of the proceeds is required. |
| Age requirement | Does not require reaching a specific age. | The taxpayer must be 65 or older (or demonstrate major dependency). |
Legal criterion
Property being sold
Reinvestment exemption
Must be the taxpayer's main residence.
Exemption for over-65s
Must be the taxpayer's main residence.
Legal criterion
Reinvestment obligation
Reinvestment exemption
Mandatory to reinvest the proceeds into a new main residence.
Exemption for over-65s
No reinvestment of the proceeds is required.
Legal criterion
Age requirement
Reinvestment exemption
Does not require reaching a specific age.
Exemption for over-65s
The taxpayer must be 65 or older (or demonstrate major dependency).
Information extracted directly from regulations governing Personal Income Tax.
Other circumstances that affect the outcome
- Prior inheritance or gift: the acquisition base may derive from values declared in previous inheritance or gift tax filings.
- Non-main residence: second homes, rental properties or vacant properties usually follow different rules regarding tax exemptions.
- Intragroup or corporate transfers: transactions outside the standard sale between individuals.
- Tax residency: Spanish IRPF applies according to tax residence; international dealings add extra complexity.
When it is reported
Capital gains from a property sale are generally included in the annual IRPF tax return for the financial year in which tax liability arises (accrual rules in the LIRPF). This means the buyer's funds may arrive in your account well before you settle the corresponding state tax.
Plan your liquidity: many sellers miscalculate net proceeds because they deduct fees and municipal plusvalía but forget to set aside funds for IRPF.
Relation to other sale expenses
To get a full picture of net proceeds, combine estimated IRPF with professional fees, certificates, mortgage cancellation costs and municipal plusvalía (IIVTNU). The guide on how much it costs to sell a house in Spain acts as a checklist of cost items, without replacing tailored tax calculations.
Common mistakes
- Confusing asking prices with the actual taxable base.
- Assuming reinvestment relief applies without meeting deadlines or proving main residence status.
- Failing to keep invoices for deductible improvements.
- Forgetting to declare transactions assuming tax authorities will not find out (data cross-referencing with notary offices and property registries occurs).
- Mixing up regional tax regulations on prior inheritances with current capital gains without professional review.
Consult a professional before signing a deposit agreement
If the sale is your primary property transaction of the year, it is well worth obtaining an IRPF simulation based on your deeds, purchase dates and property usage. The cost of tailored advice is usually small compared to the risk of budgeting incorrectly or missing out on tax relief due to a procedural error.
Sky Real Estate supports the commercial management and sales coordination; final IRPF settlement should be validated by your tax practitioner. If you would like assistance selling property in Madrid, Valencia, Mallorca or Zaragoza, visit residential sales and development.