Skip to content

FIFO for stocks: method, calculator and Trade Republic example

FIFO stands for First-In-First-Out and is the legally required method in Germany for calculating your profit on stock sales. The method decides which of your bought shares are sold first. Sounds like accounting nitpicking but it's the main reason why your real profit looks different from what the Trade Republic app shows. This page explains the FIFO method with a concrete example, how stock splits are factored in, and which edge cases come up in a real portfolio.

What FIFO is and why it applies

When you sell a share, you need to know which of the bought ones is going out. In Germany the FIFO principle applies for tax purposes: the shares bought first count as sold first. This is laid down in §20 EStG (German income tax code) and applies to all German private investors. Trade Republic has to follow this, your tax statement is based on it. If a tool doesn't calculate FIFO but uses average prices or LIFO, it doesn't show you the tax-relevant profit.

FIFO step by step with an example

Imagine you buy the same stock three times at different prices, then sell a portion. Example with Apple shares:

  1. 1

    Buy 1 on 2024-02-01

    10 shares at 180 EUR. Total value 1800 EUR.

  2. 2

    Buy 2 on 2024-06-15

    10 shares at 220 EUR. Total value 2200 EUR.

  3. 3

    Buy 3 on 2024-10-03

    10 shares at 240 EUR. Total value 2400 EUR.

  4. 4

    Sell on 2025-04-20

    15 shares at 260 EUR. Proceeds 3900 EUR. Per FIFO the 10 shares from Buy 1 plus 5 from Buy 2 go out.

  5. 5

    Profit calculation

    Cost basis of the 15 sold: 10 × 180 plus 5 × 220 = 1800 plus 1100 = 2900 EUR. Proceeds 3900 EUR. Realized profit 1000 EUR. Capital gains tax applies to this profit.

  6. 6

    What's left

    5 shares from Buy 2 plus 10 from Buy 3 = 15 shares. Average book value of this remaining position is (5 × 220 plus 10 × 240) / 15 = 233.33 EUR per share. That's the basis for the next sale.

What happens with stock splits

When a stock is split, the share count and price per share change, but the total value of your position stays the same. Example NVIDIA: on 2024-06-10 there was a 10-for-1 split. Anyone who held 10 shares at 1200 EUR each before (total 12000 EUR) had 100 shares at 120 EUR each afterwards (still 12000 EUR total). FIFO bookkeeping must be back-adjusted. So the original buy record becomes not 10 at 1200 but 100 at 120. If a tool doesn't do that, it compares the nominal price before the split to today's post-split price and arrives at a completely wrong profit. trade-insight back-books all splits in our universe correctly.

Edge cases that come up in a real portfolio

Mergers with cash component

When company A is acquired by company B and you get 0.8 B-shares plus 15 EUR cash per A-share, FIFO bookkeeping has to split this apart. The 15 EUR cash is realised proceeds, the 0.8 B-shares inherit the original FIFO purchase price. With multiple A buys this quickly becomes complex.

Warrants and knock-outs

If you trade five different knock-out certificates on NVIDIA, those are five different ISINs, each with its own FIFO bookkeeping. The TR app shows you profit per ISIN. But anyone wanting to know how their NVIDIA knock-out strategy went overall needs a consolidated view across all ISINs on the same underlying. trade-insight groups warrant families.

Reverse splits

Some stocks are consolidated rather than split. 10 shares at 1 EUR become one share at 10 EUR. Bookkeeping-wise this is the mirror image of a normal split, but many tools choke on it because reverse splits are rarer.

Partial repayment with residual value

With bonds or certain certificates it can happen that a position is repaid at maturity not at par but at a fraction of it. The difference is a realised loss. FIFO bookkeeping has to pull in the correct purchase price for the calculation.

How trade-insight shows FIFO

In the drilldown for each position you see the full FIFO trail. All buys chronologically, each sell with an indication of which buy records were just consumed, the remaining share count per buy, the average book value of your open position. With splits it's visible that the original buys were back-booked, with original date but adjusted share count and price. Edge cases like mergers and warrant families are prepared in their own sections. This is the view you don't get in the TR-native tax statement.

FAQ

Does FIFO apply to all securities in Germany?

FIFO applies to German private investors for calculating capital gains tax on stocks, ETFs, bonds, warrants and certificates. For crypto coins there's a special rule (§23 EStG, one-year holding period with individual allocation possible).

What happens if I have multiple Trade Republic accounts?

FIFO applies per account. If you hold the same stock in two TR accounts, the FIFO stacks are kept separate per account. trade-insight currently pulls one TR account per user. Multi-account consolidation is a planned feature but not yet live.

What about savings plans?

Each savings-plan execution is a normal buy and is added to the FIFO stack. If you save 100 EUR per month into an ETF and sell part after three years, the oldest savings-plan buys go out first per FIFO.

How does the loss-offset pot work?

The loss-offset pot is a separate mechanism. FIFO first determines the realised profit or loss per position. Realized losses are then automatically collected by TR in the loss-offset pot and netted against future gains. trade-insight currently shows the realised balance per position, the consolidated loss-offset-pot view is part of the planned tax helper.

Why does the TR app show me a different profit than trade-insight?

Usually two reasons. First: TR shows the trajectory since your last login or since opening a position, often based on a snapshot price. FIFO is the correct method for realised profits. Second: TR shows some edge cases simplified or with delay (e.g. splits, mergers). The tax statement from TR is however FIFO correct, that's where you'll find the value that should match our calculation.

Dive deeper

Have trade-insight show you your FIFO calculation

Free, in beta. CSV upload is enough. Server in Germany.