Selling Shares and ETFs Through a Broker: FIFO, Transfers and Anexo G or J
Which shares you sold is decided by the law, broker by broker. Who issued them decides the annex.
- Selling shares and other securities is a capital gain, Category G (CIRS art. 10.º n.º 1 b)). The year's gains and losses are netted (art. 43.º n.º 1) and the positive balance is taxed at 28% (art. 72.º n.º 1 c)), unless you opt to add it to your other income (n.º 13).
- The shares sold are the ones acquired longest ago: first in, first out (art. 43.º n.º 8 d)). It is the law, not an option you elect.
- When your securities sit with more than one broker, FIFO runs separately at each one (art. 43.º n.º 9). A sale at one broker never uses an older purchase held at another.
- Moving shares between brokers is not a sale. The sending broker should pass on the original acquisition date and value, whenever possible (art. 43.º n.º 10).
- A Portuguese issuer's securities go in Anexo G quadro 9; a foreign issuer's in Anexo J quadro 9.2A.
If you sell shares, ETFs or bonds through a broker, the IRS code decides three things for you: which purchase each sale used, how the year's results add up, and where the sale goes on the Modelo 3. This guide takes each in turn, from the text of the code and the AT's filling instructions, and says where our broker capital gains calculator stops short of the law.
What counts as a gain
Art. 10.º n.º 1 b) puts the onerous disposal of shares and other securities in Category G, capital gains, when the gain is not business, professional, capital or rental income. The gain on each sale is the realisation value less the acquisition value, less the expenses necessarily and actually incurred on the acquisition and the sale (art. 51.º n.º 1 b)), such as broker commissions you can document. What is taxed is the year's balance: art. 43.º n.º 1 nets the gains against the losses realised in the same year.
FIFO is the law, not a choice
For securities of the same kind that confer identical rights, art. 43.º n.º 8 d) says that those disposed of are the ones acquired longest ago. You cannot pick a more expensive lot to show a smaller gain, and there is no average-cost method to elect. The date that matters on your return is therefore the date of the oldest purchase still held, and a sale that uses up several purchases is several lines: the Anexo G and Anexo J quadros hold one acquisition date per line.
FIFO does not run across all your accounts. When the securities are deposited with more than one credit institution or financial company, art. 43.º n.º 9 applies the rule by reference to each of those entities. Each broker is its own queue.
| Example: the same share at two brokers | Broker A | Broker B |
|---|---|---|
| Bought 10 shares | 16 Jan 2023 at €100 | 10 Jun 2024 at €150 |
| Sold 10 shares on 15 Sep 2025 at €200 | — | Sale at Broker B |
| Purchase the sale uses (n.º 9) | Not used | The 2024 purchase, cost €1,500 |
| Gain, before fees | — | €2,000 − €1,500 = €500 |
| Tax at 28%, if this is the year's only operation | — | €140 |
Pooling the two accounts would have matched the sale to the 2023 purchase and shown a €1,000 gain. That is the wrong figure: the law looks only at Broker B. The holding period changes too, from 462 days to 973 days, and the holding period is what the exclusions below turn on.
Moving shares between brokers
A transfer is not a disposal, so it produces no gain. What it moves is the history. Art. 43.º n.º 10 says that, on a transfer of securities between those entities, the entity they leave should tell the receiving one the acquisition date and the historical acquisition value of the securities transferred, whenever possible. When you later sell at the new broker, those are the date and value that belong on the line.
The calculator cannot follow a transfer. Broker exports record a transfer as a movement, not a purchase, and the calculator ignores those rows. A sale of shares that arrived by transfer therefore has no purchase at the broker where it was sold. The calculator does not borrow a purchase from another broker to fill the gap: it reports the sale as unmatched and names the brokers where the same security was bought. Declare that sale with the original date and value the sending broker gave, or that your own records show.
28%, the option to aggregate and the holding period
The positive balance of the year's gains and losses on securities, together with the other operations listed in art. 72.º n.º 1 c), is taxed at 28%. A resident can instead opt to add it to their other income at the general rates (art. 72.º n.º 13). The option is not for one sale: art. 22.º n.º 5 makes it cover all income of the same category. A negative balance can be carried forward to the next five years only when you opt, or are obliged, to aggregate (art. 55.º n.º 1 d)).
Aggregation is compulsory in one case. Under art. 72.º n.º 14, the balance from shares and other securities held for less than 365 days must be added to your other income when your taxable income, including that balance, reaches the value of the top bracket of art. 68.º n.º 1.
For securities admitted to trading and units of open-ended collective investment undertakings, art. 43.º n.º 5 excludes part of the balance by holding period: 10% for assets held more than 2 and less than 5 years, 20% for 5 years or more and less than 8, and 30% for 8 years or more. This is why both annexes ask, line by line, whether the securities are admitted to trading or units in an open-ended fund.
A resident's loss does not count when the counterparty is subject to a regime referred to in art. 63.º-D n.º 1 or n.º 5 of the Lei Geral Tributária (art. 43.º n.º 7).
Anexo G or Anexo J: who issued the security
The annex is decided by the issuer, not by where the broker is. Art. 18.º n.º 1 i) treats as obtained in Portugal the gains on shares in entities with their seat or effective management in Portugal and on other securities issued by entities seated there. So a Portuguese issuer's securities are declared in Anexo G quadro 9, and a foreign issuer's in Anexo J quadro 9.2A, income obtained abroad. A US share bought through a Portuguese bank is still Anexo J; a Portuguese share bought through a foreign broker is still Anexo G.
| Anexo G, quadro 9 | Anexo J, quadro 9.2A | |
|---|---|---|
| Issuer | Seated in Portugal | Seated abroad |
| Identifies the issuer by | The issuer's NIF | The source country |
| Codes for the common cases | G01 shares, G10 bonds, G22 units in a UCITS fund | G01 shares, G10 bonds, G20 fund units |
| Also asks | Counterparty country; admitted to trading or open-ended fund? | Tax paid abroad; counterparty country; admitted to trading or open-ended fund? |
| Option to aggregate | Anexo G, quadro 15, field 01 | Anexo J, quadro 9.2C |
Both quadros exclude securities acquired up to 31 December 1988. In Anexo G, the instructions allow securities other than shares and quotas to be declared aggregated by year of acquisition. The calculator reads the issuer country from the first two letters of the ISIN and shows the annex for each sale; with no ISIN, or one that names no country, it leaves the annex to you. For an ETF, that is the country where the fund is registered.
Paste your broker's export. The calculator matches each sale oldest-first at that broker, splits it into one line per purchase, and shows the annex by issuer.
Check my broker salesWhat the calculator does not do
- Compute the tax. It totals gains net of losses; the 28%, the option to aggregate and the n.º 5 exclusions are not applied to that total.
- Read transfers between brokers. A sale of transferred-in shares is reported as unmatched, for you to declare with the original date and value.
- Match across brokers. That is deliberate: art. 43.º n.º 9 forbids it.
- Convert by law. It converts each trade at the rate your export states to euros, otherwise the ECB reference rate of the trade's date; that is the tool's method, not a rule read from the code.
- Crypto-assets that are not securities, which follow their own rules: see the crypto guide.
Checklist
- Export the full history from each broker, from your first purchase, not just this year.
- For shares that arrived by transfer, get the original acquisition date and value from the broker they came from.
- Match each sale to the oldest purchase still held at that broker.
- Note for each lot whether the security is admitted to trading, and how long it was held.
- Split the lines by issuer: Portuguese issuers in Anexo G quadro 9, foreign issuers in Anexo J quadro 9.2A.
- Decide on aggregation once, for the whole category, and check whether art. 72.º n.º 14 makes it compulsory.
Frequently asked questions
Can I choose which shares I sold?
No. For securities of the same kind conferring identical rights, the ones sold are those acquired longest ago (CIRS art. 43.º n.º 8 d)). There is no average-cost or specific-lot method to elect.
I hold the same ETF at two brokers. Which purchase does a sale use?
Only purchases at the broker where you sold. When securities are deposited with more than one institution, FIFO applies by reference to each one (art. 43.º n.º 9).
Is moving shares to another broker a taxable sale?
No. A transfer is not a disposal. The sending broker should pass on the acquisition date and historical value whenever possible (art. 43.º n.º 10), and those are used when you eventually sell.
Do foreign shares go in Anexo G or Anexo J?
Anexo J quadro 9.2A. Gains count as obtained in Portugal when the issuer is seated in Portugal (art. 18.º n.º 1 i)); those go in Anexo G quadro 9. The broker's country does not decide it.
What is the tax rate on share gains in Portugal?
28% on the positive balance of the year's gains and losses (art. 72.º n.º 1 c)). You can opt to aggregate it with your other income instead (n.º 13); it is compulsory for holdings under 365 days when taxable income reaches the top bracket (n.º 14).
Can I carry a loss forward?
Only if you opt, or are obliged, to aggregate: then a negative balance can be carried forward to the next five years (art. 55.º n.º 1 d)).
Get the free Portugal tax playbook
A first-year PDF: NIF and NISS, NHR vs IFICI vs IRS Jovem, the Modelo 3 annex map and the deadline calendar. Sent to your inbox.
