The FIFO method
If you sell units you bought at different times, German tax law always treats the units bought first as sold first (§ 20 Abs. 4 S. 7 EStG). That is the FIFO method: first in, first out. Which units you "meant" to sell doesn't matter – capi.tax automatically matches every sale against the oldest purchases still open.
What does the FIFO rule say?
The law phrases it for securities held in collective custody: for securities of the same kind, it is to be assumed that those acquired first were sold first. For you this means:
- Every share and every fund has its own queue of purchases.
- A sale always takes units from the front of the queue, i.e. from the oldest purchase.
- If the oldest purchase isn't enough, it continues with the next oldest.
- You cannot choose a different order – for example the most expensive purchase first, to keep the gain small.
FIFO applies per account – that is the tax authorities' view in the BMF decree on individual questions of the Abgeltungsteuer. If you hold the same share with two brokers, each account has its own queue. Strictly speaking, the law refers to collective custody under the German Depot Act; for custody at a foreign broker the rule is applied by analogy. That fits how capi.tax works: you upload the files of one account per calculation, and the tool keeps the queues within that account.
US brokers often work differently. Interactive Brokers, for instance, lets you pick a different lot method for US tax purposes ("Highest Cost" or "Specific Lot"). For German tax that is irrelevant – capi.tax ignores the broker's lot selection and recalculates using FIFO. That is why the realised gain in your broker report can differ from the result in capi.tax.
Worked example: several purchases, one partial sale
All amounts are example values, already converted to euros at each day's rate (how that works is explained under Currency conversion).
| Date | Transaction | Units | Value | Fee |
|---|---|---|---|---|
| 10 Feb | Purchase 1 | 100 | €13,800.00 | €1.00 |
| 15 Apr | Purchase 2 | 50 | €7,600.00 | €1.00 |
| 20 Sep | Sale | 120 | €19,200.00 | €1.20 |
The sale of 120 units is split into two parts:
Part 1 – 100 units from purchase 1 (fully used):
- Share of proceeds: €19,200.00 × 100/120 = €16,000.00
- Acquisition cost: €13,800.00
- Purchase fee: €1.00, proportional sale fee: €1.20 × 100/120 = €1.00
- Gain: 16,000.00 − 13,800.00 − 1.00 − 1.00 = €2,198.00
Part 2 – 20 units from purchase 2 (partly used):
- Share of proceeds: €19,200.00 × 20/120 = €3,200.00
- Acquisition cost: €7,600.00 × 20/50 = €3,040.00
- Proportional purchase fee: €1.00 × 20/50 = €0.40, proportional sale fee: €1.20 × 20/120 = €0.20
- Gain: 3,200.00 − 3,040.00 − 0.40 − 0.20 = €159.40
Total taxable gain: €2,357.40. 30 units from purchase 2 remain in the account, with €4,560.00 acquisition cost and €0.60 of purchase fee not yet used. They are the first to be drawn on at the next sale.
For comparison: had the newest units been sold first (50 from purchase 2, then 70 from purchase 1), the acquisition cost would have been €7,600.00 + €9,660.00 = €17,260.00 instead of €16,840.00. Including fees, the gain would have been €420.30 lower – but German law does not allow that choice.
How are fees split on partial sales?
Fees belong to the trade they arise on: purchase fees increase the acquisition cost, sale fees reduce the proceeds (§ 20 Abs. 4 S. 1 EStG). If a purchase is only partly sold, capi.tax allocates the fee proportionally by units – exactly as in the example above. The rest travels on with the remaining units. That way no fee is counted twice and none is lost.
Each fee is converted to euros at the rate of its own trade date, even if the broker charges it in a different currency from the trade itself.
FIFO for short positions and options
For options and short sales the law does not expressly set the order; capi.tax applies FIFO by analogy, as German banks do. It also works the other way round: if you open a position with a sale – you write an option (sell to open) or sell a share short – that sale sits at the front of the queue. A later purchase (buy to close) first closes the oldest open short position. capi.tax takes from your broker's marker whether a sale opens a short position (IBKR: code O/C; Tastytrade: Sell to Open/Sell to Close). A sale marked as closing without holdings never opens a short; it is listed under Sales without a purchase. Only when the export has no marker (DEGIRO) is a sale without holdings treated as a short sale.
Example (values in euros): On 3 March you write two put contracts and receive €560.00 in premium, fee €2.00. On 20 March you buy back one contract for €100.00 (fee €1.00), on 18 April the second for €400.00 (fee €1.00).
- First buyback: 280.00 − 100.00 − 1.00 − 1.00 = +€178.00
- Second buyback: 280.00 − 400.00 − 1.00 − 1.00 = −€122.00
- Together: +€56.00 (check: 560.00 − 500.00 − 2.00 − 2.00 = 56.00)
Every option – each combination of underlying, type, strike and expiry – has its own queue. If you write and close an option in the same year, capi.tax combines both into one result. If a written option stays open over the turn of the year, the premium counts in the year you wrote it and a later buyback in the year you pay for it; see Options & writing options.
What about purchases from earlier years?
This is the most common stumbling block. capi.tax calculates the tax year you select. It takes purchases from earlier years out of earlier-year files you upload as well (or one file covering several years), but only when the history is provably complete – see Upload earlier years. FIFO then runs across the year boundary: a sale in 2025 uses the 2023 purchase first, then the 2024 one. How the carried remainder of a purchase came about is shown on the results page – see Tracing the carried holdings.
If an earlier-year purchase is still missing, capi.tax does not guess. The sale stays out of the tax, and the header shows Incomplete: … sales without a purchase. You close the gap in one of two ways: add the earlier year's file (Adjustments › Files › Add file; capi.tax then uses the real purchase) or Add purchase (for a buy-back Add opening) – symbol, date, quantity and acquisition cost in the purchase currency (capi.tax converts it at the purchase date's rate). Options written in a previous year need none of this (see below). Details: Sales without a purchase.
Options written in a previous year need no opening position. The option premium is taxed in the year it is received, a buyback in the year it is paid (§ 11 EStG, § 20 Abs. 1 Nr. 11 EStG as amended by the JStG 2024). capi.tax assigns both itself: if a written option is still open on 31 December, its premium counts in the chosen year; a buyback whose opening lies in an earlier year counts as negative income. More in Options & writing options.
The purchase date you enter determines the order. If you have several earlier purchases of the same share, enter each one separately with its date so FIFO sorts them correctly. The same applies to holdings from a transfer between brokers: the new broker often doesn't know the original cost, so you add it yourself. Step-by-step instructions are under Adjustments and Common issues.