Skip to content
Calculadora Capital

Reinvesting home-sale gains: how to pay no IRS when you sell your home

Selling the home you live in without paying IRS on the gain is possible, but the law does not forgive the tax just because you buy another home: it requires reinvesting the sale value, minus the mortgage repaid, in another main permanent home, within tight deadlines and with the intention declared in your tax return. This guide explains the calculation, the conditions, partial reinvestment and the mistakes that cost thousands of euros.

6 min readReviewed By Thorben Rasmus IdelReviewed by Nahar Geva

TL;DR

If you sell your main permanent home in Portugal, the capital gain pays no IRS when the sale value, minus the repayment of the mortgage on the home sold, is reinvested in another main permanent home in Portugal, the EU or the EEA (article 10(5) of the IRS Code). The reinvestment must happen between 24 months before and 36 months after the sale and the intention is declared in Anexo G. Only own funds count: the part paid with a new mortgage is not reinvestment. Reinvesting only part excludes the gain in the same proportion; 50% of the rest is taxed at the progressive rates. People aged 65+ or retired can instead apply the proceeds to a life-insurance financial contract, pension fund or PEPP within 6 months.

The most valuable relief in Portuguese property tax

When you sell a property at a profit, the general rule is clear: 50% of the gain is added to your income and taxed at the progressive IRS rates2. On a home that gained €100,000 in value, that can mean well over €15,000 of tax. The big exception is selling your main permanent home (habitação própria e permanente): article 10(5) of the IRS Code excludes the gain from taxation when the sale proceeds are reinvested in another main permanent home1.

The exclusion is neither automatic nor unconditional, and the calculation the law makes is not the one most people imagine. Before going further, compute the gain in the property capital gains calculator and simulate the exclusion in the capital gains reinvestment calculator.

The right calculation: what you actually must reinvest

The most expensive mistake in this regime is thinking it is enough to reinvest the profit. What the law requires you to reinvest is the sale value (valor de realização), minus a single item: the repayment, made at the sale, of the mortgage taken to buy the home sold1.

An example with round numbers:

ItemAmount
Sale value of the old home€250,000
Mortgage repaid at the sale€100,000
Amount to reinvest (full exclusion)€150,000
Capital gain computed€60,000

To pay no IRS at all on the €60,000 gain, this family must apply €150,000 to the new home, not €60,000. The calculator runs this calculation and shows the tax in each scenario.

The new mortgage does not count

Reinvesting means applying the money the sale left in your hands, not signing a new credit agreement. The Portuguese tax authority consistently takes the position that the part of the new home financed by a new loan is not reinvested sale proceeds3.

If the new home costs €300,000 and you borrow €200,000 from the bank, the reinvestment considered is €100,000, your own funds. In the example above, that family would have reinvested €100,000 of the €150,000 required: two thirds. Which brings us to the next rule.

Partial reinvestment: the exclusion is proportional

If you do not reinvest everything, you do not lose everything. Article 10(12) excludes the proportional part of the gains corresponding to the amount reinvested1:

  • you reinvested two thirds of the required amount → two thirds of the gain is excluded;
  • the remaining third follows the normal regime: 50% of it is added to your income and taxed at the progressive rates2.

In the example: €40,000 of the gain is exempt, €20,000 remains taxable, and the taxable base is €10,000. At a 35% marginal rate, the IRS falls from €10,500 (without reinvestment) to €3,500: a €7,000 saving just from applying the rule well.

The deadlines: 24 months before, 36 months after

The reinvestment must happen within a precisely defined window1:

  • between 24 months before and 36 months after the sale date;
  • buying first and selling later also qualifies, as long as the sale happens within the 24 months following the purchase;
  • the intention to reinvest, even partially, must be declared in Anexo G of the IRS return for the year of the sale;
  • after the reinvestment, the new home must become your or your household's residence within 12 months; for construction, enlargement or works, the property (or the changes) must be registered in the matriz within 48 months of the sale.

Missing any of these steps cancels the benefit: the IRS on that gain is assessed with the legal additions1.

The eligibility conditions

Not every home sale qualifies. The cumulative conditions of paragraph 5 are1:

  • the property sold was the main permanent home of the taxpayer or their household, proven by the fiscal domicile, for the 12 months before the sale (a condition introduced by the Mais Habitação package);
  • the reinvestment is made in Portugal, the EU or the European Economic Area with tax information exchange;
  • the destination is another main permanent home: buying a property or a plot for construction, or building, enlarging or improving a property for that purpose.

Second homes, rented-out properties and investment properties stay out: for those, the normal regime of the property capital gains calculator applies.

Aged 65+ or retired: exemption without buying a home

If you sell your home at a stage of life where you no longer want to buy another, there is a dedicated alternative. If, at the date of the sale, the taxpayer, their spouse or civil partner is retired or at least 65 years old, the gain is excluded when the sale value (minus the loan repayment) is applied, within the following 6 months, to one of these products1:

  • a life-insurance financial contract;
  • an individual subscription to an open pension fund;
  • a contribution to the public capitalisation scheme;
  • a PEPP (pan-European personal pension product).

The exclusion is equally proportional to the amount applied, and there are payout conditions (regular instalments) and redemption limits to respect. If you are weighing this route, comparing it with a PPR and the retirement simulator helps see the full picture.

What changed and what has already ended

Two recent changes cause frequent confusion:

  • Mais Habitação (2023) tightened the entry: the home sold must now have been the main permanent residence for the 12 months before the sale.
  • The temporary mortgage-repayment regime is over: between 2022 and 2024, gains from other properties (plots, second homes) could be applied to repaying the mortgage on the main home of the taxpayer or their descendants. That regime has ended; today, repaying another home's mortgage does not count as reinvestment.

When in doubt about what is still in force, the safe source is the consolidated text of article 10 on the Portal das Finanças1.

From the sale to the new home, with the numbers done

The reinvestment regime is one of the few where the taxpayer controls almost everything: the window is wide (5 years between the before and the after), the partial exclusion avoids all-or-nothing outcomes and declaring the intention costs one cross in Anexo G. What it does not forgive is the base of the calculation. Before deciding how much to borrow for the new home, simulate the scenarios in the capital gains reinvestment calculator, add the IMT and stamp duty of the purchase, and check that the mortgage payment fits your budget: the new loan lowers the exclusion, but it is also what shapes the rest of your financial life.

Common mistakes

  • Thinking it is enough to reinvest the gain

    What the law requires you to reinvest is the sale value minus only the repayment of the mortgage on the home sold. The gain may be €60,000 and the amount to reinvest €150,000. Reinvesting only the profit leaves most of the gain taxable.

  • Counting the part financed by the new mortgage as reinvestment

    It does not count. The tax authority's position is that reinvesting means applying the money from the sale; the part of the new home paid with a new loan stays out of the calculation. Only the own funds applied enter the proportion.

  • Forgetting the declaration of intention in Anexo G

    The exclusion requires the intention to reinvest, even partially, to be declared in the IRS return for the year of the sale (the reinvestment table of Anexo G). Without it, the tax authority assesses the tax under the normal regime.

  • Missing the deadlines

    The reinvestment must happen between 24 months before and 36 months after the sale, and the new home must become your main permanent residence within 12 months of the reinvestment. Missing a deadline cancels the benefit and the IRS becomes due with the legal additions.

  • Assuming that repaying another home's mortgage still counts

    The temporary Mais Habitação regime that allowed using gains to repay the mortgage on the main home (your own or your descendants') applied only to sales from 2022 to 2024 and has ended. Under the permanent regime, only the repayment of the loan on the very home sold is deducted.

Frequently asked questions

How much do I have to reinvest to pay no IRS?
The sale value minus the repayment of the mortgage taken to buy the home sold. Example: selling for €250,000 and repaying €100,000 of the loan at the sale requires reinvesting €150,000 of own funds to exclude the whole gain.
What is the deadline to reinvest the proceeds?
Between 24 months before and 36 months after the sale date. You can buy the new home before selling the old one, as long as the sale happens within the following 24 months. The intention is declared in Anexo G of the IRS return for the year of the sale.
Does buying the new home with a mortgage count as reinvestment?
The part financed by the new loan does not count. If the new home costs €300,000 and the new mortgage is €200,000, the reinvestment considered is €100,000. Only money applied without credit enters the exclusion proportion.
What if I only reinvest part of the amount?
The exclusion is proportional (article 10(12) of the IRS Code): reinvesting 60% of the required amount exempts 60% of the gain. The remaining 40% follows the normal regime, in which 50% of the gain is added to your income and taxed at the progressive IRS rates.
I sold my home and I am retired. Do I have to buy another home?
No. Anyone who at the date of the sale is retired or aged 65 or over (the taxpayer, spouse or partner) can apply the sale value, minus the loan repayment, to a life-insurance financial contract, an open pension fund, the public capitalisation scheme or a PEPP, within 6 months of the sale, with the same proportional exclusion.
What happens if I declare the intention and then do not reinvest?
The benefit is lost: the IRS on the gain becomes due with the legal additions. The same happens if the new home does not become your main permanent residence within 12 months of the reinvestment or, for construction, if the property is not registered in the matriz within 48 months.

Sources

  1. 1.Article 10 of the IRS Code: reinvestment exclusion for the main permanent home (paragraphs 5, 6, 10 and 12) · Autoridade Tributária e Aduaneira / Portal das Finanças · retrieved 1 Aug 2026
  2. 2.Article 43 of the IRS Code: only 50% of the balance of property capital gains is taxed · Autoridade Tributária e Aduaneira / Portal das Finanças · retrieved 1 Aug 2026
  3. 3.IRS: capital gains and reinvestment in construction (credit-financed amounts do not count as reinvestment) · Ordem dos Contabilistas Certificados · retrieved 1 Aug 2026

Author / Reviewed by

Author

Thorben Rasmus Idel

Co-founder & writer

Co-founder of Calculadora Capital and the writer behind the methodology on every calculator and article. An entrepreneur and active investor, Thorben founded Idel Versandhandel GmbH, an international trading company operating across 16 countries, and invests across stocks, ETFs and cryptocurrency. He writes the methodology and verifies the math behind each page, drawing on hands-on business and investing experience to keep the tools and explanations grounded in how money, markets and taxes actually work for everyday people in Portugal.

Reviewed by

Nahar Geva

Co-founder & reviewer

Co-founder of Calculadora Capital and the independent reviewer behind every calculator and article. An entrepreneur and active investor, Nahar brings a data- and product-driven mindset together with hands-on experience in the markets, investing across stocks and ETFs as well as cryptocurrency and other digital assets, alongside broader personal finance and real estate. On each page Nahar reviews the methodology and double-checks the math and figures, pressure-testing how the tools and explanations hold up against the way money, markets and taxes actually work for everyday investors.

Published: Updated: Reviewed: