Broker capital gains calculator (FIFO)
Paste your broker's transaction export — get FIFO-matched realized capital gains for Anexo G/G1 and foreign dividend/interest totals for Anexo J. Nothing is uploaded — parsing runs entirely in your browser.
Frequently asked questions
How are capital gains calculated for foreign brokerage accounts?
Portugal uses FIFO (first-in, first-out) as the default cost-basis method under CIRS Art 48-51: the oldest shares you bought are treated as the ones you sold first. This calculator applies FIFO per instrument, matching each sale against your earliest open buy lots to compute the realized gain.
Do I need to declare foreign brokerage gains even if the broker doesn't withhold Portuguese tax?
Yes. Portuguese tax residents must declare worldwide capital gains and investment income on Modelo 3, regardless of where the broker is based or what tax (if any) it withholds. Realized gains go on Anexo G/G1; foreign dividends and interest go on Anexo J.
Which brokers does this calculator support?
Revolut and Interactive Brokers have dedicated parsers that recognise their CSV export formats automatically. For any other broker, use the manual column-mapping option — you tell the calculator which column holds the date, transaction type, quantity, price, and so on, and it parses your export the same way.
What happens if I sold shares that don't appear in my imported buy history?
The calculator flags these as unmatched sales rather than guessing a cost basis of zero. This typically happens when shares were transferred in from another account, or when your CSV export doesn't cover the full history — you'll need the missing buy transaction's date and price to complete that lot's cost basis manually.
How is the EUR conversion done for foreign-currency transactions?
Each row is converted at the rate of its own date, never one rate for the whole year. We use a rate from your export only when the export says it is to EUR; otherwise the ECB reference rate of that date, or the last earlier quote when there was none that day (CIRS art. 23.º n.º 3). Dividends and interest use the date they were paid (art. 23.º). A sale uses the sale date, and each matched purchase keeps its own purchase date: the acquisition value is the documented cost (art. 48.º), which is how AT converted it in the case the tax arbitration court found lawful (CAAD 92/2023-T). A row with no rate is listed and left out of the totals — it is never counted 1:1. The law speaks of the bank buy rate; the ECB publishes one reference rate, so small differences from your bank's statement are expected.
Is my transaction data uploaded anywhere?
No. All CSV parsing, FIFO matching, and aggregation happen entirely in your browser using JavaScript — the pasted or uploaded file is never sent to Finkavo's servers. This is the same trust model as our other planning calculators.
I sold once and have no CSV — can I still use this?
Yes. Switch the entry method to manual and type the trade in: instrument, buy date, sell date, quantity, and the two prices. It goes through the same FIFO cost-basis engine as an imported export, so the Anexo G figures are produced the same way.
