FIFO with two brokers: how to calculate the gain if you hold the same security in both

Learn how to correctly apply the FIFO method when selling shares of the same security split between two different brokers. Practical examples included.

One of the most frequent headaches in the tax return for individual investors arises when you hold positions in the same security in two different brokers. The question is inevitable: how do I apply the FIFO method if I've bought shares in the same company on both platforms?

The answer, whilst it has a clear regulatory basis, generates confusion in practice. Let's break it down step by step.

What is the FIFO method and why it matters

FIFO stands for First In, First Out. It is the method that Spanish tax regulations establish to calculate the capital gain or loss when you sell homogeneous securities acquired at different times.

In simple terms: when you sell, you're deemed to be selling first the oldest shares you bought, regardless of the price at which you acquired them. This chronological order determines the acquisition cost you must apply to calculate your gain or loss.

The fundamental principle: a unified view

Here's the key that many investors overlook: for tax purposes, you must consider all your holdings of the same security as a single portfolio, regardless of which broker or brokers you have them deposited with.

The tax regulations do not distinguish between custodian entities. For Hacienda (the Spanish tax authority), what's relevant is that they are the same financial asset (same share, same ISIN), and therefore FIFO is applied globally across all your historical purchases of that security.

How to apply FIFO with two brokers: practical example

Let's look at a specific case to understand it better:

Initial situation:

  • January 2024: You buy 50 Telefónica shares in Broker A at €4/share (investment: €200)
  • March 2024: You buy 50 Telefónica shares in Broker B at €4.50/share (investment: €225)
  • June 2025: You buy another 50 Telefónica shares in Broker A at €3.80/share (investment: €190)
  • October 2026: You sell 80 shares in Broker B at €5/share (proceeds: €400)

How do you calculate the capital gain?

Although the sale takes place in Broker B, you must apply FIFO considering all purchases chronologically:

  1. The first 50 shares sold correspond to your purchase of January 2024 in Broker A (€4/share)
  2. The next 30 shares sold correspond to your purchase of March 2024 in Broker B (€4.50/share)

Therefore, the calculation would be:

  • Sale price: 80 shares × €5 = €400
  • Acquisition cost: (50 × €4) + (30 × €4.50) = €200 + €135 = €335
  • Capital gain: €400 - €335 = €65

As you can see, although you sold in Broker B, you've had to 'consume' first the oldest shares from Broker A according to the FIFO order.

Practical implications of this approach

This way of calculating has several important consequences:

1. You need rigorous control of all your transactions

It's not enough to look at the tax report provided by the broker where you sold. You must keep your own historical record of all purchases in all brokers, ordered chronologically.

2. Broker reports may be incomplete

Many investors are surprised to discover that the calculation of gains and losses provided by their broker doesn't match what they must declare. This is normal: each broker only knows the transactions carried out on its own platform.

3. The location of the sale doesn't determine the cost

You could have all your old purchases (and expensive ones) in Broker A, and sell from Broker B where you only have recent purchases (and cheap ones). Even so, you must apply FIFO on the whole set, 'consuming' first the purchases from Broker A.

Special cases to bear in mind

Shares of different origin

If some of your shares come from corporate actions (splits, scrip dividends, rights issues), the calculation becomes more complicated. These shares have their own acquisition value and date, which you must incorporate into your global FIFO order.

Foreign and domestic brokers

The principle is the same regardless of where your broker is domiciled. Whether you operate with Interactive Brokers, DeGiro, MyInvestor or any combination, you must apply FIFO across all transactions.

Currency conversions

If you've bought the same security in different currencies, remember that you must convert all amounts to euros using the exchange rate in force on each purchase or sale date. This adds an additional layer of complexity to the calculation.

Tools to avoid getting lost

Given how laborious the process is, having adequate tools is essential:

  • Customised spreadsheets: You can create your own tracking system, although it requires discipline and technical knowledge
  • Specialised platforms: Tools like QCapital allow you to consolidate transactions from multiple brokers and automatically calculate the correct FIFO
  • Professional advice: For complex portfolios or substantial assets, it may be worth having a specialised tax adviser

Final recommendations

To avoid surprises in your tax return:

  1. Record all transactions immediately: Don't wait until the following year to sort out your purchases and sales
  2. Maintain a consolidated file: Document all transactions from all brokers in a single system
  3. Review calculations before selling: If you're planning a significant sale, calculate in advance what your capital gain will be by applying FIFO correctly
  4. Keep all supporting documents: Purchase and sale contracts, statements and transaction confirmations from all brokers
  5. Verify annually: Before submitting your tax return, contrast your calculations with the brokers' reports and adjust any differences

The FIFO method with multiple brokers may seem complex, but by following an orderly system and having the right tools, it's perfectly manageable. The important thing is to understand the fundamental principle: for Hacienda, all your shares of the same security are a single portfolio, wherever they're deposited.

You may be interested in

Content provided for educational and informational purposes only, based on publicly available sources. It does not constitute financial, tax or legal advice, nor a personalised investment recommendation. Before making any decision, consult a qualified and registered financial or tax adviser who can assess your individual circumstances. Tax rules change each year: confirm current figures and rates with the AEAT (Spanish tax authority) or your adviser. This information applies only to residents for tax purposes in Spain.