
Cierre fiscal del año: compensar pérdidas y ganancias en tu cartera
Essential Points
- Offsetting losses and gains means subtracting your year's sales results from each other to pay less income tax on what you have actually earned.
- The tax authorities require that gains and losses of the same nature be combined first, and only then can the limits that allow them to be combined with other income be applied.
- It helps you avoid overpaying when your portfolio of funds, stocks or ETFs has had a mixed year, with winning and losing positions.
- The nuance that surprises most people: selling to generate a tax loss and then immediately repurchasing the same stock can cancel out that loss if you don't respect a certain time period.
Every December, as the year draws to a close, many people who already have funds, stocks, or ETFs in their portfolios ask themselves the same question: does it make sense to move anything before December 31st to pay less in the next tax return? The answer almost always involves understanding a mechanism of the Personal Income Tax (IRPF) that is rarely explained clearly—the offsetting of capital gains and losses—and reviewing the portfolio well in advance to take action before the tax year ends.
This article explains how the offsetting of losses and gains works within the savings base, what happens to losses you don't offset during the year, and why the end of the fiscal year is the natural time to review whether it's advisable to realize any unrealized losses. You'll also learn about the rule that prevents you from buying back a recently sold security simply to create an artificial loss, and what steps to take if you want to reorganize your portfolio before the end of the year. It's intended for those who already invest and want to optimize their tax situation, not for those starting from scratch.
This is not tax advice. This article is for educational and informational purposes only and does not constitute personalized tax, legal, or financial advice. Regulations on offsetting gains and losses, their deadlines, and limits may vary depending on the tax year and the individual circumstances of each taxpayer. Therefore, it is advisable to confirm the current details with the Tax Agency or a qualified tax advisor before making any decisions about your portfolio. If you invest through Bit2Me Invest, remember that this service is provided through Bit2Me Stocks, SL, in collaboration with InbestMe, the entity that acts as the regulated provider of the investment service, and that past performance does not guarantee future results.

Main Cryptocurrencies Course
Basic levelBit2Me Academy We bring you a new course where you will learn everything you need to know about the most important cryptocurrencies that exist today.
Empezar ahora ›What does it mean to offset capital losses and gains in personal income tax?
When you sell shares of a fundWhether you're buying stocks or ETFs, the result of that sale is a capital gain or loss, depending on whether you received more or less money than you paid when you bought them. Personal income tax (IRPF) doesn't require you to declare each transaction separately: it allows you to combine all your capital gains and losses for the year and pay tax only on the net result, that is, on what you actually earned after subtracting the losses. This mechanism is called offsetting gains and losses, and it's one of the most useful aspects of savings taxation for those who already maintain a diversified portfolio.
All these gains and losses are integrated into the IRPF savings basealong with other income such as dividends or interest. Within this base, the regulations distinguish two categories: on the one hand, income from movable capital, such as dividends and interest; on the other, capital gains and losses derived from the transfer of assets, such as the sale of funds, shares, or ETFs. This distinction is important because it determines what is offset against what, and in what order.
The underlying logic is simple: if in the same year you've sold a fund at a profit and some shares at a loss, it doesn't make sense to pay taxes on the entire profit while ignoring the loss you also incurred. Offsetting losses and gains corrects this distortion and aligns your tax bill with your actual results for the year. Ultimately, this is why reviewing your entire portfolio before filing your taxes—and not just the most recent transaction—is almost always worthwhile.
How does offsetting work within the same fiscal year?
The first step in the offsetting process occurs within each category separately. Capital gains and losses from selling funds, stocks, or ETFs are first offset against each other: if the combined result is positive, you pay tax on that net amount; if it's negative, that negative balance is carried over to the next stage of the process. The same applies, independently, to returns on investment income, such as... dividends or interest from your interest-bearing account.
Only after you've made that initial offset within each category does the second level come into play: the regulations allow you to carry over, up to a certain percentage of the positive balance in one category, the remaining negative balance in the other. This limit and its exact percentage have changed in different tax years, so it's not advisable to assume a fixed number without verifying it before filing your return. The key to planning your year-end closing is understanding that this carryover margin exists, not memorizing the specific figure from a previous year.
This order of offsetting—first within the same block, then between blocks with their respective limits—is what makes offsetting losses and gains not as simple as subtracting two random numbers. That's why, when you review your portfolio before year-end, it's helpful to mentally separate which result corresponds to sales of funds, stocks, or ETFs from which result corresponds to dividends or interest, because each block follows its own logic before being combined.

Uncompensated capital losses: four exercises to take advantage of them
Not all losses in a given year are offset by sufficient gains in the same tax year. When this happens, current regulations allow you to carry forward the outstanding negative balance to the following four tax years, applying it as soon as gains appear to offset it. This carryforward option transforms a loss from this year into a tax tool that remains valuable several years later, provided you claim it correctly in each subsequent tax return.
To benefit from this carryforward, it's essential to declare the loss in the tax year it occurs, even if you don't have any profits to offset it at that time. If you omit the loss because "it's pointless this year," you lose the opportunity to carry it forward and reduce your tax bill in subsequent years when you do have profits to offset. Keeping a clear record of which losses remain to be offset, and in which tax year they were generated, is just as important as accurately calculating the current year's profit.
This carryover mechanism is also one of the reasons why year-end analysis shouldn't be limited to just the last twelve months. Before deciding what to do with your portfolio in December, it's worth checking if you're carrying forward losses from previous years that you can still apply, because that changes how much it's advisable, or not, to realize further losses this year.
Why is it a good idea to review your wallet before December 31st?
The end of the fiscal year, which in Spain usually coincides with December 31st, is the natural time to take stock of what has happened in your portfolio over the past twelve months. If you have already sold any funds, stocks, or ETFs at a profit at any point during the year, that positive result has already been generated and is part of your savings base, whether you like it or not. What you can still decide, while the year is still ongoing, is whether it is advisable to realize any unrealized losses in your portfolio to offset that gain already realized.
This approach, which is known internationally in the sector as tax loss harvestingIt simply involves selling a position that is now worth less than what you paid for it, provided that this decision also makes sense within your investment strategy, not just for tax reasons. If that position no longer fits into your portfolio, or if you prefer to reallocate that capital to another asset with better prospects in your opinion, taking the loss before the end of the year allows you to offset it against gains already made and reduce your tax bill for the year.
It's wise to be cautious with this reasoning: selling an asset solely to generate a tax loss, without it making sense within your long-term investment strategy, can end up costing you more than you save if that asset later recovers and you no longer hold it in your portfolio. The year-end review should always begin with a two-part question: Does this position still make sense in my portfolio? And, if the answer is no, is it tax-advantageous to realize the loss now instead of waiting? Cryptoassets They also generate capital gains and losses that are offset under this same logic, and organizing them together with your funds and ETFs from before December makes this review much easier.
The two-month rule: what it is and how it prevents fictitious tax losses
Herein lies the nuance that most confuses those deciding to realize a loss for the first time with year-end in mind. Personal income tax regulations include an anti-taxation rule designed to prevent someone from selling a security, generating a tax loss, and then almost immediately repurchasing that same security or a substantially identical one, without their actual market position having changed at any point. Without this rule, anyone could "manufacture" tax losses without assuming any real risk, by selling and repurchasing on the same day.
Generally speaking, when you sell securities listed on a market and repurchase homogeneous securities—that is, securities of the same type and with equivalent economic rights—within a two month term Before or after that sale, the resulting loss cannot be included in your tax return for that year. The loss doesn't disappear forever: it's deferred until you finally transfer the repurchased securities, at which point you can claim it. This timeframe and its exact conditions depend on the type of asset and whether or not it's traded on an organized market, so it's best to treat it as a general guideline and not as a fixed calculation for your specific situation.
The practical consequence is clear: if you're going to realize a loss before year-end with the intention of repurchasing the same asset shortly afterward, that loss probably won't help you offset anything on your tax return for this year. If your intention is genuinely to exit a position because it no longer fits your strategy, the rule doesn't apply to you, because you don't plan to repurchase. The problem arises when the sale is purely for tax purposes and the repurchase was already decided from the outset, which is why this is one of the points where it's crucial to confirm the current details with a tax advisor before trading.
How to plan your fiscal year-end step by step?
Breaking down the year-end review into concrete steps helps avoid leaving it until the last day of December, when there's little time left to act calmly. These are the general steps to follow to plan how to offset losses and gains before the end of the fiscal year.
- Compile the results of all sales of funds, stocks, and ETFs that you have already made during the year, separating gains and losses already realized.
- Review your current portfolio to identify unrealized loss positions, that is, assets that are worth less today than what you paid for them and that you have not yet sold.
- For each loss-making position, evaluate whether it still makes sense within your long-term strategy or if you would prefer to reallocate that capital to another asset.
- If you decide to realize any loss, check the two-month rule before planning any repurchase of the same or a similar security.
- Check if you have carried forward capital losses from previous years that you can still apply against this year's profits.
- Document each transaction with its date, amount, and fees, and centralize that record before the process begins. income campaign.
Following this order reduces the risk of making last-minute decisions driven more by the calendar date than by a genuine analysis of your portfolio. Year-end tax treatment for investments primarily benefits those who begin reviewing their situation weeks in advance, not those who improvise on December 30th.

Common mistakes when closing the fiscal year in your portfolio
The most common mistake is selling a loss-making position solely for tax reasons, without considering whether that decision makes sense within the long-term investment strategy. Offsetting losses and gains is an optimization tool, not an end in itself, and pursuing it without careful consideration can lead to unwinding positions that were actually worth holding.
Another common mistake is planning an immediate repurchase of the same asset without considering the two-month rule, which negates the intended tax benefit and unnecessarily complicates the tax return. It's also common to overlook capital losses from previous years that can still be carried forward, thus missing out on a legitimate reduction in the tax bill simply because proper record-keeping wasn't maintained.
Finally, many people inadvertently conflate the two building blocks of savings, treating dividends or interest as if they were the same as gains from selling funds or stocks. Understanding this distinction, and reviewing your entire portfolio well in advance of December 31st, is what separates a tidy year-end from a tax return full of surprises in the spring.
How do they fit together Bit2Me Invest and Bit2Me Taxes at the end of your year?
If your portfolio of funds, stocks, and ETFs lives within Bit2Me InvestReviewing the year's results before December is easier when you have all the information in one place, instead of reconstructing it from several different brokers. Bit2Me Invest allows you to invest in funds, stocks, and ETFs from a single platform, making it easy to identify at a glance which positions are accumulating gains and which are carrying unrealized losses as the year draws to a close.
Once those positions have been identified, the remaining task is to organize the transaction record so that the offsetting of losses and gains is calculated correctly when the tax return is due. DISCOVER Bit2Me TAX It's a good starting point if you also hold crypto assets alongside your funds and ETFs, because it's designed to centralize transaction records and help you calculate your tax liability in an organized way—the same organizational principle you should apply to your entire portfolio before the end of the year. If you want to delve deeper into how each product is declared afterward, our guide on how to declare index funds and ETFs in Spain directly complements what you've seen here about the tax year-end.
Year-end doesn't have to turn into a race against time on December 30th. Reviewing your portfolio calmly, understanding your accumulated losses and gains, and confirming specific regulatory details with a professional before making any changes are the three habits that make the difference between paying the correct tax bill and overpaying because you didn't check in time.
Frequently asked questions about offsetting losses and gains
What does it mean to offset capital losses and gains?
This is the personal income tax mechanism that allows taxpayers to deduct capital losses from capital gains earned during the same period, so they are only taxed on the net result. It applies to gains and losses derived from selling funds, shares, ETFs, or other assets.
How are losses and gains offset within the same fiscal year?
First, capital gains and losses from sales are offset against each other, and income from movable capital, such as dividends or interest, is offset separately. Then, within a percentage limit that should be confirmed each year, the negative balance of one group can be carried forward against the positive balance of the other.
What happens if my losses for the year exceed my gains?
Any negative balance that you cannot offset in the current tax year can be carried forward and applied against profits in the following four tax years. To use it later, you must declare the loss in the year it occurs, even if you don't yet have profits to offset it against.
Why is it a good idea to review your portfolio before December 31st?
Because once the fiscal year has ended, you can no longer decide whether or not to realize a latent loss to offset gains already made that year. Reviewing your portfolio in advance allows you to calmly assess whether any losing positions should be sold before the year's end.
What is the two-month rule when selling at a loss?
This is an anti-application rule that prevents you from deducting a loss for tax purposes if you repurchase similar securities within two months before or after the sale. The loss is not entirely lost, but it is deferred until you definitively transfer the repurchased securities.
Can I sell and repurchase the same fund or stock on the same day to generate a loss?
Generally, this isn't effective from a tax perspective, because repurchasing the item within the timeframe stipulated by the regulations prevents the loss from being included in the tax return for that year. The loss is deferred instead of being eliminated, but you don't achieve the immediate effect you were looking for.
Is offsetting losses and gains the same as avoiding paying taxes?
No, it's about adjusting your tax bill to your actual profit for the year, not eliminating tax on the gains earned. If your net profit for the year is positive, you'll still pay tax on that amount even if you've offset some losses.
Do cryptocurrencies fall under this same net loss and gain?
Yes, capital gains and losses from trading cryptocurrencies are also included in your savings and are offset under the same logic as those from funds, stocks, or ETFs. Keeping a single record of all your positions makes calculating your year-end gains and losses much easier.
What is the difference between offsetting losses this year and carrying forward losses from previous years?
Offsetting within the year means offsetting profits and losses generated in the same fiscal year before calculating net income. Carrying forward losses means applying the negative balance that you couldn't offset in the first year to subsequent years, within the four-year period allowed by law.
¿Bit2Me Does TAX help me prepare the offsetting of losses and gains on my portfolio?
Bit2Me TAX is designed to centralize the recording of your digital asset transactions and calculate their taxable income in an organized way before filing your tax return. For funds, stocks, and ETFs of Bit2Me Invest, applying that same organizational principle makes it easier to identify which positions should be reviewed before the end of the year, although the final tax details should always be confirmed with a qualified advisor.

«Investment in cryptoassets is not fully regulated, may not be suitable for retail investors due to high volatility and there is a risk of losing all invested amounts»
Share this article!Continue learning

Traspaso de fondos en España: la ventaja fiscal que debes conocer
Descubre cómo el traspaso de fondos en España te permite cambiar de fondo sin tributar, y por qué los ETFs casi nunca gozan de esta ventaja fiscal.

Errores comunes del inversor principiante (y cómo evitarlos)
Descubre los errores al invertir más comunes del inversor principiante en fondos, acciones y ETFs, su consecuencia práctica y cómo evitar cada uno de ellos.

ETF de acumulación o distribución: cuál elegir
ETF de acumulación o distribución: compara el tratamiento fiscal de sus dividendos en España y descubre cuál elegir para tu propia estrategia de inversión.

Taxation of shares in Spain: taxation and the two-month rule
Taxation of shares in Spain: savings base, personal income tax brackets and the two-month rule (art. 33.5 LIRPF) explained step by step, with examples.










