
When you sell a property for more than you paid for it, the tax authorities consider that you have obtained a capital gain and require you to pay income tax on it. At Domoblock, we spend much of the year calculating the differences between purchase, renovation, and sale prices, and we often see how the same property can generate a very different tax gain depending on which expenses are justified and how depreciation is handled. In this guide, we explain what a capital gain is, how it is calculated step-by-step, how it is taxed in 2026, and what exemptions exist, with a complete example.
According to Article 33 of Law 35/2006 on Personal Income Tax, capital gains and losses are variations in the value of assets that become apparent when there is an alteration in their composition. Simply put: you sell, donate, exchange, or receive something, and the difference between what it was worth to you and what you obtain is the gain or loss. As long as there is no alteration, there is no taxation. The fact that your apartment is worth more today than when you bought it is not taxed until you sell it.
Income comes from something that produces revenue on a recurring basis: a salary, rent, or interest. A capital gain arises from a change in your assets, usually a sale. The same property can generate both: rental income is considered real estate capital income, and the profit from selling it is a capital gain.
It is the negative result of an alteration: you sell for less than the asset cost you, including expenses. Losses can be offset against gains, within the limits we see below.
Note: not all losses count. Those derived from consumption, gambling, or free transfers (for example, donating something that has lost value) are not computed (Article 33.5).
This is the most common case and the one that involves the most money. The difference between the transfer value and the acquisition value, both adjusted for expenses, improvements, and depreciation, is taxed.
Selling shares, funds, or company holdings generates gains or losses. For investment funds, transfers between funds are not taxed until the final redemption. There is an anti-avoidance rule: if you sell listed shares at a loss and repurchase homogeneous securities in the two months before or after, you cannot report that loss until you sell the repurchased ones (Article 33.5.f).
Contest or sweepstakes prizes and many public grants are capital gains that do not arise from a transfer. For this reason, they are taxed in the general tax base, not the savings base.
State lottery prizes and similar winnings have a special 20% tax rate, with the first €40,000 exempt.
If you donate an apartment, the recipient pays Inheritance and Gift Tax, but you, as the donor, pay income tax on the gain accumulated since you bought it. Many families discover this too late. If there is a loss instead of a gain, it cannot be computed.
.jpeg)
If two siblings who inherited two apartments at 50% each are assigned one apartment each, there is no gain, provided the assignments correspond to their ownership shares (Article 33.2.a). Each retains the original acquisition date and value.
If there is an excess of assignment compensated with money, that portion may be subject to tax.
Distributing assets upon the dissolution of a marital property regime or joint ownership is also not considered a change in net worth, provided the assignments respect the ownership shares.
These do not generate a gain at the time of the reduction (Article 33.3.a). If the company returns contributions, the amount reduces the acquisition value of your shares; any amount exceeding that value is taxed as investment income.
The so-called "death capital gain" does not exist in personal income tax: death does not generate a capital gain for the deceased (Article 33.3.b). Heirs take the value declared in the Inheritance Tax as the acquisition value.
This is the actual amount paid for the asset (Article 35 of the Personal Income Tax Law). If you inherited or were gifted the asset, it is the value declared in the Inheritance and Gift Tax, which cannot exceed the market value.
Expenses and taxes inherent to the purchase paid by you are added to the acquisition value: Property Transfer Tax (ITP) or VAT, Stamp Duty (AJD), notary fees, registry fees, and administrative agency fees. Investments and improvements made afterward are also included. Mortgage interest is not included: it is treated in other sections of the tax return, not as part of the capital gain.
This is the actual sale price, provided it is not lower than the normal market value. If you sell to a family member at a price significantly below market value, the tax authorities may apply the market value.
Deduct from the sale price any expenses you pay as the seller: agency commission, municipal capital gains tax (IIVTNU), energy performance certificate, or mortgage registry cancellation costs.
The formula is:
Capital gain = (sale price − selling expenses) − (purchase price + purchase expenses + improvements − depreciation)
A simple example: you bought shares for €10,000 with a €50 commission and sold them for €14,000 with a €60 commission. The profit is (€14,000 − €60) − (€10,000 + €50) = €3,890.
For real estate, the calculation involves more components, as you will see below.

Take the price from the deed and add the Property Transfer Tax (ITP) or VAT and Stamp Duty (AJD), notary fees, land registry fees, and agency fees. If you paid ITP based on the Cadastre reference value because it was higher than the purchase price, the purchase price remains the one on the deed, but the excess tax you paid is included as a cost.
Include work that increases the value or useful life of the property: a comprehensive renovation, an extension, an elevator, or the installation of new systems that did not previously exist. These must be justified with invoices in your name. Repairs and maintenance do not count, as we explain in the section on common mistakes.
If you rented out the property, depreciation must be subtracted from the acquisition value. Here is the nuance that is most surprising: the minimum depreciation is subtracted even if you did not deduct it in your tax returns (Article 40 of the Personal Income Tax Regulations). In other words, if you did not apply it at the time, you lost the rental deduction and will also pay more tax on the gain when selling.
Take the price from the deed of sale and subtract the agency commission including VAT, the municipal capital gains tax (plusvalía municipal), and other expenses you assume as the seller.
Full example. A property purchased in 2015 for €120,000 (€12,000 in property sale taxes and expenses), renovated for €15,000 in 2016, rented out for eight years, and sold in 2026 for €220,000. It is assumed that the building accounts for 60% of the cadastral value.
Step 1. Acquisition value:
Gains derived from transfers are integrated into the savings tax base. The combined state and regional rates for 2026 are:
They are declared in the year in which the change in assets occurs, usually the date of the deed (Article 14.1.c). A sale signed on December 30, 2026, is declared in the 2026 tax return, which is filed in 2027. If you sell with deferred payment and receive the money over more than one year, you can allocate the gain as you receive the payments (Article 14.2.d).
First, capital gains and losses from transfers within the same year are offset against each other. If the balance is negative, it may be offset against the positive balance of investment income from the savings base, up to 25% of that amount (Article 49). Any amount that cannot be offset is carried forward to the following four years. It is advisable to record this each year, as it is lost if not applied in time.
Purchase and sale deeds, ITP, VAT, and AJD tax settlements, notary, registry, and administrative agency invoices, improvement invoices, municipal capital gains tax settlement, and the agency's invoice. If the property was rented out, your tax returns for those years. The tax authorities may audit the sale for four years, but you must keep the supporting documents for the purchase and improvements from day one, even if they are twenty years old.

Capital gains from the sale of a primary residence are exempt if the seller is 65 years of age or older (Article 33.4.b). It must have been their residence for at least three consecutive years, or they must have ceased to reside there less than two years ago. If only one spouse meets the age requirement, the exemption applies to their share.
If you reinvest the amount obtained into another primary residence within the two years prior to or following the sale, the gain is exempt (Article 38.1). If you reinvest only a portion, the exemption is proportional. The nuance: the "amount obtained" is considered the sale price minus the outstanding loan you pay off. If you sell for €200,000 and pay off an €80,000 mortgage, you only need to reinvest €120,000 for the full exemption.
The sale of a primary residence by individuals in a situation of severe or high dependency, in accordance with Law 39/2006, is also exempt, with no age limit.

Replacing a broken boiler with a similar one is a repair: if the apartment was rented out, it was deducted as a rental expense and does not add to the acquisition value. Installing heating where there was none is an improvement and does add to it. When renovating an apartment, separate which items in the budget are improvements and which are maintenance. We recommend doing the same with your invoices.
The most common oversights are the municipal capital gains tax paid upon sale, the AJD tax from the purchase, the administrative agency fees, and the registry cancellation fees. Each one reduces the gain.
Without an invoice, an improvement does not exist for the tax authorities. Cash payments without an invoice do not serve as proof.
The reinvestment exemption requires the new property to be your primary residence (living in it for at least three years and occupying it within twelve months). If this is not met, you must regularize the situation with late-payment interest.
Yes. The municipal capital gains tax (IIVTNU) is a separate tax that levies the increase in the value of urban land and is paid by the seller. It can be deducted as an expense when calculating the IRPF gain. If you sell at a real loss, you can request that it not be assessed by providing proof via the deeds.
For the seller's IRPF, the actual price counts, provided it is not below market value. The reference value is primarily used for the property transfer tax (ITP) paid by the buyer. A sale significantly below market value may attract the attention of the tax authorities, so it is advisable to be able to justify the price.
Yes. Every sale must be declared even if the result is negative. It is also in your interest: the loss can be offset against other gains for the year, and if there is a surplus, you can carry it forward for four years. If you do not declare it, you lose that right.
Your acquisition value is the one declared for Inheritance Tax, plus any corresponding inheritance expenses. If you sell soon after for a similar price, the gain will be small or zero. Declaring a low value in the inheritance to pay less Inheritance Tax results in higher IRPF when selling later.
If you are a tax resident in Spain, there is no withholding: you pay in your tax return. If you are a non-resident, the buyer must withhold 3% of the price and pay it to the tax authorities as a payment on account of the Non-Resident Income Tax.
No. Income obtained from a participating loan is taxed as investment income, with a 19% withholding, also within the savings tax base. This positive balance can be offset against net capital losses from the same year, up to 25%.
Domoblock enables users to invest starting from €200 in real estate projects entirely online through real estate tokenization and blockchain technology. Assessing the true outcome of a transaction requires more than simply comparing the initial capital with the proceeds received: it is necessary to identify the tax classification of the return, associated expenses, the date of transfer, and the documentation applicable to each project. While technology streamlines operations, it does not replace professional tax or legal advice, nor does it eliminate the risks of illiquidity, delays, or capital loss.
With Domoblock, a real estate investment platform offering house flipping projects in Spain, you can achieve your goals and secure your long-term financial independence.
The capital gain on a property is not the difference between what you paid and what you received: it is the result of adding expenses and improvements and subtracting depreciation. Our practical advice: open a folder today with the deed, purchase taxes, and every construction invoice, and separate repairs from improvements. If the apartment was rented out, calculate the depreciation before setting the sale price. This way, you will know how much you will actually keep.
.png)
5 Pedro María Ric
Funded
100%
€550,012.94
Target
€550,012.94