Skip to content

The two-year window

If I reinvest only part, how much is exempt?

The part of the gain that is exempt is proportional to what is reinvested out of the amount obtained. The mortgage outstanding at the time of sale changes that percentage a great deal.

Beatriz Llorente, widowed four years ago, sold the family house in the Monelos district of A Coruña in February 2026; she had lived there since 2003. After deducting the costs of the sale, the transfer value was 260,000 €; the house had cost her 170,000 € with all the costs at the time, so the gain is 90,000 €. There was still 60,000 € left of a loan she had taken out to buy it, and the bank collected it at the signing before the notary. Beatriz has bought a smaller flat in Oleiros, near her daughter, for 150,000 € including costs, and she wants to give her son 50,000 € for the deposit on his first home. She asks whether the exemption is lost entirely because she is not reinvesting everything, or whether part of it can be saved.

The proportionality rule

Part of it is saved. The second paragraph of article 38.1 of the law on IRPF (Spanish personal income tax) puts it like this: when the amount reinvested is lower than the total received on the transfer, "only the proportional part of the capital gain obtained that corresponds to the amount reinvested shall be excluded from tax". Article 41.4 of the Regulations repeats the idea with the expression "amount actually invested".

The formula is:

Exempt gain = gain × amount reinvested ÷ total amount obtained

The denominator is not the sale price but the total amount obtained: the transfer value minus the principal of the purchase loan outstanding on the day of the sale. We explain why in do I have to reinvest the gain or the whole price?.

Beatriz's calculation step by step

  1. Transfer value: 260,000 €.
  2. Acquisition value: 170,000 €.
  3. Capital gain: 90,000 €.
  4. Principal of the purchase loan outstanding on the day of the sale: 60,000 €.
  5. Total amount obtained: 260,000 − 60,000 = 200,000 €.
  6. Amount reinvested in the flat in Oleiros: 150,000 €.
  7. Proportion reinvested: 150,000 ÷ 200,000 = 75 %.
  8. Exempt gain: 90,000 × 75 % = 67,500 €.
  9. Gain taxed in 2026: 90,000 − 67,500 = 22,500 €.

The 22,500 € goes into the savings base of the 2026 return. The actual tax depends on Beatriz's other income and on the scale in force, so we do not give it here. What matters is that helping her son does not cost her the whole exemption, but a quarter of the gain.

The weight of the old mortgage

Here is the effect that surprises people most. With the same sale and the same purchase, the exempt percentage changes depending on what was still owed to the bank on the day of the sale. Assuming Beatriz always reinvests 150,000 €:

Loan outstanding on saleTotal amount obtainedProportion reinvestedExempt gainTaxable gain
0 €260,000 €57.69 %51,923.08 €38,076.92 €
60,000 €200,000 €75.00 %67,500.00 €22,500.00 €
110,000 €150,000 €100.00 %90,000.00 €0 €

Someone who sells with more debt outstanding needs to reinvest less to achieve the same result, because the money the bank collects is not required of them. And someone who paid off the loan with their savings shortly before selling finds that this money now does count in the denominator. If you are about to sell and are thinking of repaying early, do the calculation with and without the repayment: the result can change considerably.

The part not reinvested cannot be allocated as you please

A common idea is to treat the 50,000 € that is not reinvested as coming "from the money I put in" and not from the gain, so that the gain would be exempt in full. The law does not allow this: the exemption is shared out in proportion, and the taxpayer cannot attribute what is not reinvested to the cost or to the profit. A return that calculates the exemption some other way may be corrected, with interest and, where applicable, a penalty.

The effect of the mortgage on the new home

The old mortgage acts on the denominator. The new one acts on the numerator: the question is how much of what is paid for the new home counts as reinvested. Beatriz paid for the flat in Oleiros with money from the sale, without a loan, and has no problem. But suppose she had taken out a 100,000 € mortgage to buy it and had paid only 50,000 € out of her own pocket.

The rule does not require the same euros that were received to be reinvested, but an equivalent amount applied to the acquisition within the time limit. To what extent what is paid with a new loan counts as reinvestment, and when, is a question examined carefully: if the home is paid for with borrowed money, part of the price is paid off over years, and only what is paid within the two-year period safely enters the calculation. That is why, in cases with a new mortgage, we prefer to reconstruct each payment with its dates before giving an exemption figure, and we point out the part that may be disputed.

The proportion when reinvesting in several stages

Article 41.3 of the Regulations allows reinvestment "in one go or in successive stages". If Beatriz had bought the flat in 2026 and paid for renovation work in 2027, both amounts would be added together in the numerator, provided they fall within the two years and the work fits the regulatory concept of renovation, which we deal with in does renovation count as reinvestment?.

When the reinvestment is completed in years other than the year of the sale, the intention to reinvest must have been recorded in the return for the year of the sale. If in the end the figure reinvested falls short of what was planned, the proportional difference is corrected with a supplementary return for that year, as we explain in I am not going to reinvest after all: what do I do?.

Decision table for anyone unsure how much to reinvest

If your aim isWhat to look atConsequence
Full exemptionReinvesting at least the total amount obtainedNone of the gain is taxed
Freeing up cash for another purposeHow much the proportion falls for each euro withdrawnThe proportional part is taxed
Reducing the figure to reinvestThe loan outstanding on the day of the saleMore debt outstanding, a lower figure required
Buying with a new mortgageWhich payments fall within the two yearsOnly those count safely

With the deeds and the proof of payment, the calculation is settled quickly. You can send them through the reinvestment form, saying what part of the money you want to use for other purposes.

The help for her son, looked at separately

The 50,000 € Beatriz gives her son is a gift, with its own regional tax, its reductions and, depending on the autonomous community (Spain's regions, which set part of this tax), allowances that vary from one territory to another. None of that affects the reinvestment exemption, but it is worth deciding at the same time. The question on parents who give money for the deposit on a flat explains that other side of the operation.

The guide on declaring the reinvestment exemption shows how a partial reinvestment is reflected in the return. Calculating the exempt part, together with reviewing time limits and proof, is part of the Salama Tax service for selling your main home.

Want your reinvesting in a new home taken care of?

Send us the case and we will tell you what it needs.

Start here
Book a callWhatsApp