Taxes in the backtest: how Portfolio Lab calculates flat-rate tax and Vorabpauschale
With taxes switched on, the backtest calculates like the brokerage account of a private investor in Germany under current law: flat-rate withholding tax (Abgeltungsteuer) with solidarity surcharge and optional church tax, partial exemption (Teilfreistellung), Vorabpauschale (advance lump-sum taxation), saver's allowance (Sparer-Pauschbetrag), sales under FIFO, separate loss offset pots (Verlustverrechnungstöpfe) and, for single stocks, dividends with foreign withholding tax. This page describes the rules and the simplifications. It is not tax advice.
Tax rate
The basis is the 25% flat-rate tax on investment income under the Income Tax Act (EStG 2009), with a 5.5% solidarity surcharge on top: 26.375% in total. With church tax, the flat-rate tax is reduced according to the formula in § 32d EStG to 25% / (1 + church tax rate / 4); church tax and solidarity surcharge are then added on top.
| Church tax | Total rate in Portfolio Lab |
|---|---|
| none | 26.375% |
| 8% (Bavaria, Baden-Württemberg) | 27.819% |
| 9% (other states) | 27.995% |
The saver's allowance applies per calendar year (default €1,000, €2,000 for joint assessment). Taxes are calculated in the selected base currency; if this is a currency other than the euro, the app points this out.
Tax category per security
For each security, the app suggests a tax category based on its type, name and category, which you can change. The partial exemption under § 20 of the Investment Tax Act (InvStG 2016) makes part of the income tax-free:
| Tax category | Partial exemption | Vorabpauschale | Loss pot |
|---|---|---|---|
| Equity fund | 30% | yes | general |
| Mixed fund | 15% | yes | general |
| Real estate fund, German / foreign | 60% / 80% | yes | general |
| Other fund (bonds, money market, commodities, REIT) | 0% | yes | general |
| Single stock | 0% | no | equities |
| ETC, ETN, certificate, bond | 0% | no | general |
| Gold with delivery claim, cryptocurrency held directly | – | no | tax-free after one year |
Vorabpauschale
Because the prices already include distributions, the app treats all funds as accumulating funds. For these, a Vorabpauschale is due every year under § 18 InvStG: redemption price at the start of the year × base rate × 0.7, at most the increase in value during the year. The price at the start of the year is the last closing price of the previous year. For units bought during the year, the amount is reduced by one twelfth for each full month before the purchase. The tax is charged on the first trading day of the following year; the Vorabpauschale applied later reduces the capital gain on sale (§ 19 InvStG).
The base rate is stored in the code with the official values from 2018 onwards, and for 2026 from the letter issued by the BMF (2026). For years before 2018, the app uses an approximation if this option is switched on: the January yield of ten-year German federal bonds. A negative or missing base rate means no Vorabpauschale.
| Year | Base rate |
|---|---|
| 2018 | 0.87% |
| 2019 | 0.52% |
| 2020 | 0.07% |
| 2021 | −0.45% |
| 2022 | −0.05% |
| 2023 | 2.55% |
| 2024 | 2.29% |
| 2025 | 2.53% |
| 2026 | 3.20% |
Sales, FIFO and loss offset pots
Each purchase is kept as a separate lot with its date, acquisition cost and the Vorabpauschale amounts already taxed. Sales follow FIFO: the oldest units first, as required by § 20 para. 4 EStG. Gain = proceeds − acquisition cost − Vorabpauschale amounts applied; trading costs and the spread count as acquisition or disposal costs.
- Two pots: losses from single stocks can only be offset against gains on stocks; all other income runs through the general pot. General losses may reduce gains on stocks.
- Running annual calculation: the tax for the year is recalculated after every event; a later loss in the same year leads to a refund.
- Loss carryforward: losses remaining at the end of the year are carried forward to the following year, pot by pot.
- Gold and crypto: gains after more than 365 days are tax-free; the app treats gains realised earlier, as a simplification, like investment income.
The tax is withdrawn from the portfolio pro rata, without this sale itself being taxed again. Taxes arise on rebalancing, on withdrawals, through the Vorabpauschale and, with the dividends switch, on every ex-dividend date of a single stock. How much it pays to defer gains is examined, for example, by Constantinides (1983).
Sale at the end and after-tax metrics
Optionally, the app sells everything on the last day (with spread and order fee) and shows the final value after this tax. This produces the CAGR after sale (the last period bears the final tax) and the tax ratio: taxes paid plus the tax on the final sale, divided by the pre-tax gain. The annual table shows, for each year, the Vorabpauschale, realised gains, tax-exempt portions, tax base, allowance used, loss carryforward and tax; with dividends, it also shows the gross dividends and the withholding tax (paid, credited, refundable and lost). “Taxes paid” then also includes the foreign withholding tax.
Withholding tax on dividends
Many countries deduct a withholding tax from dividends before the money flows abroad. For an investor in Germany, what matters is who pays it: for single stocks, investors pay it themselves, and it is partly credited against the German flat-rate tax. For funds, the fund pays it; it reduces the fund's unit price and is therefore already reflected in the prices. Portfolio Lab calculates the two separately: single stocks in the backtest, funds as an estimate in the Look-through. More on the topic in the article Withholding tax.
Single stocks in the backtest
With the “Tax dividends of individual stocks” switch (on by default in the form, off via the API if not specified, so that saved calculations stay the same), the app loads the dividend history for every position with the tax category single stock. For each payment date: dividend yield = dividend / closing price on the trading day before the ex-dividend date; the gross dividend in the base currency is this yield times the value of the position on the previous day. It is booked on the ex-dividend date, i.e. when the total return price reinvests the dividend.
Because the prices already include the gross dividend, the app only deducts the taxes from the portfolio: foreign withholding tax and German flat-rate tax on the gross dividend in the general loss pot. It records the reinvested dividend as a new purchase with an acquisition cost equal to the dividend. Otherwise, the dividend would be taxed a second time as a capital gain on sale. Without the switch, the app calculates as before: the dividends sit untaxed in the price and are only taxed on sale, in the equity pot.
The stock's country of domicile comes from the ISIN, otherwise from the master data or the exchange (no suffix: USA; German trading venues do not reveal the country). For each country, the code holds three rates: the usual deduction at a German custodian bank, the rate that remains after a refund in the source country, and the creditable rate according to the overview by the Federal Central Tax Office, BZSt (2026), as of 1 January 2026, which is authoritative for banks:
| Country of domicile | Withheld at source | creditable | refundable on application |
|---|---|---|---|
| USA | 15% | 15% | – |
| Switzerland | 35% | 15% | 20% |
| France | 25% | 12.8% | 12.2% |
| Netherlands | 15% | 15% | – |
| United Kingdom | 0% | 0% | – |
| Ireland | 25% | 0% | 25% |
| Japan | 15.315% | 15% | 0.315% |
| Canada | 25% | 15% | 10% |
| Australia | 15% | 7.5% | 7.5% |
| Spain | 19% | 15% | 4% |
| Italy | 26% | 15% | 11% |
| Denmark | 27% | 15% | 12% |
| Sweden | 30% | 15% | 15% |
| Norway | 25% | 0% | 10% |
| Finland | 35% | 15% | 20% |
| Belgium | 30% | 0% | 15% |
| Austria | 27.5% | 15% | 12.5% |
| Luxembourg | 15% | 15% | – |
Notes on the table: USA with the W-8BEN form, which German banks usually obtain (otherwise 30%). France usually withholds 25% at German custodian banks; the rate for private investors is 12.8%. Japan levies 15% plus reconstruction tax. For Australia, the app assumes that half of the dividends are unfranked. Franked dividends are exempt; the rest is subject to 30%, of which 15% is creditable. Norway, Belgium and Ireland refund on application themselves, so the bank does not credit their tax. Dividends from German stocks carry no foreign withholding tax; the flat-rate tax is due directly.
Crediting follows paragraphs (Randnummern) 201 to 206 of the BMF (Federal Ministry of Finance) letter on the flat-rate tax of 14 May 2025: the sum of the creditable amounts for a calendar year reduces the flat-rate tax that remains after loss offsetting and the saver's allowance; the order of the income does not matter. For each dividend, at most the creditable rate and at most 25% count. Any excess lapses at the end of the year. An unused remainder from a year in which the allowance applied does not help in the following year. Calculated over the year, this gives:
Tax = s × max(0; B − P − 4 × Q)- s
- total rate from flat-rate tax, solidarity surcharge and church tax (26.375% without church tax)
- B
- tax base for the year after loss offsetting, with dividends gross
- P
- saver's allowance
- Q
- sum of the creditable withholding tax for the year
The factor 4 arises because the creditable tax reduces the 25% flat-rate tax euro for euro. With church tax, § 32d para. 1 EStG (2009) uses the form (e − 4q) / (4 + k), so the same formula fits all rates. The solidarity surcharge and church tax are only levied on the flat-rate tax after crediting.
With “Reclaim withholding tax above the treaty rate”, the app assumes that the refundable portion flows back immediately and free of charge. In reality, this often takes months or even years. Without the switch, it is treated as lost.
Funds: estimate in the look-through
For funds, the backtest continues to calculate as for accumulating funds, because the fund has already paid the withholding tax. The “Withholding tax” tab in the look-through estimates how much return it costs: for each country, the equity share from the holdings list, times the dividend yield of the country index, times the withholding tax rate for the fund's domicile. The domicile is given by the ISIN prefix (IE, LU, DE, FR); the country that levies the tax comes from the position's ISIN, otherwise from its country.
Loss p.a. = Σ a_L × d_L × q_L(domicile)- a_L
- equity share of country L in the fund's assets
- d_L
- dividend yield of the country index
- q_L
- withholding tax rate on dividends from L for a fund with this domicile
The starting point is the rates that major index providers use to calculate their net return indices: the highest rate for non-resident institutional investors without treaty benefits. Portfolio Lab takes this as the view of a fund domiciled in Luxembourg. This tends to be too high, because individual funds reclaim some of it on application. On top of this, the app applies the exceptions that can be documented:
| Fund domicile | US dividends | German dividends | Dividends from its own country | Other countries |
|---|---|---|---|---|
| Ireland | 15% | 15% | 0% | non-treaty rate |
| Luxembourg | 30% | 15% | 15% | non-treaty rate |
| Germany | 30% | 15% | 15% | non-treaty rate |
| France | 30% | 15% | 0% | non-treaty rate |
Irish funds pay 15% on US dividends thanks to the treaty between Ireland and the USA. German dividends cost any investment fund with a status certificate 15% including solidarity surcharge (§ 6 and § 7 InvStG (2016)). Without a treaty, the rates are, for example, Switzerland 35%, France 25%, Canada 25%, Japan 15.315% and United Kingdom 0%. The dividend yields come from the factsheets of the country indices as of 30 September 2026, for example USA 1.11%, Japan 1.84%, Switzerland 2.78% and United Kingdom 3.17%; if a country is missing, its region applies (Europe 2.87%, Pacific 2.33%, emerging markets 2.02%, otherwise world 1.52%).
The table for each position shows the estimated loss and the same fund domiciled in Ireland, Luxembourg, Germany and France. If holdings data is missing, a note appears instead of a figure; stocks with no known country are assigned the average rate of the fund's other stocks, or 15% if there is no indication at all. Single stocks are shown alongside with the burden of a direct investment without refund.
Taxes in Financial goals
Financial goals simulates thousands of paths and therefore calculates more simply: with average cost instead of FIFO. On each sale, the gain share = 1 − cost basis / value is taxable, after the portfolio's average partial exemption. For withdrawals, the app sells a gross amount large enough for the planned net amount to arrive. The Vorabpauschale is due every January for the previous year, using the current base rate for all years. For the initial wealth, you can enter the cost basis as a percentage.
Simplifications
- Current law for all years. Different rules applied to funds before 2018.
- All funds treated as accumulating; the app does not model actual distributions and their taxation.
- No most-favourable assessment (Günstigerprüfung), no exemption orders (Freistellungsaufträge) across several banks.
- Withholding tax only for single stocks, with today's rates for all years; refunds arrive immediately and free of charge. For funds, the loss is an estimate: sector, dividend and factor funds deviate from the country's dividend yield, swap ETFs depend on the swap, and the app does not know about refund claims filed by individual funds.
- Gold and crypto held for less than a year treated, as a simplification, like investment income (in reality, private disposal transactions).
Frequently asked questions
Does the app treat distributing funds differently?
No. All funds are treated as accumulating funds, because the prices already include distributions.
When is the Vorabpauschale due?
On the first trading day of the following year, calculated with the base rate of the year just ended and the price at its start.
How are losses offset?
Using two pots: stock losses only against stock gains, everything else in the general pot. Whatever remains at the end of the year is carried forward.
What does the tax ratio show?
The share of the pre-tax gain that goes in tax, including the tax on the final sale if that option is switched on.
Does this apply to years before 2018?
The app applies current law to all years; for the Vorabpauschale before 2018, it can only use an approximation of the base rate.
Does the backtest calculate foreign withholding tax?
For single stocks, yes, if “Tax dividends of individual stocks” is on: deduction according to the country of domicile, credit up to the creditable rate. For funds, it is already reflected in the price; the look-through estimates how much it costs.
Why does withholding tax lapse within the saver's allowance?
Credit is only given against German flat-rate tax. If the income is tax-free because of the allowance, there is nothing against which the foreign tax could be credited; whatever remains at the end of the year lapses.
Literature
- Bundesministerium der Finanzen (2026): Basiszins zur Berechnung der Vorabpauschale gemäß § 18 Absatz 4 InvStG; Basiszins zum 2. Januar 2026 (Schreiben vom 13. Januar 2026, IV C 1 - S 1980/00230/012/001). Bundesministerium der Finanzen. Source
- Bundeszentralamt für Steuern (2026): Anrechenbarkeit der Quellensteuer auf Dividenden und Zinsen von Staaten, mit denen Deutschland ein Doppelbesteuerungsabkommen abgeschlossen hat (Stand 1. Januar 2026). Bundeszentralamt für Steuern, Referat St II 10, Redaktionsschluss Juni 2026; abgerufen am 25.10.2026. Source
- Constantinides, George M. (1983): Capital Market Equilibrium with Personal Tax. Econometrica 51 (3). doi:10.2307/1912150
- Deutscher Bundestag (2009): Einkommensteuergesetz (EStG), § 20 (Kapitalvermögen) und § 32d (Abgeltungsteuer). Bundesgesetzblatt; Fassung auf gesetze-im-internet.de. Source
- Deutscher Bundestag (2016): Investmentsteuergesetz (InvStG), §§ 16, 18, 19 und 20 (Investmenterträge, Vorabpauschale, Veräußerung, Teilfreistellung). Bundesgesetzblatt; Fassung auf gesetze-im-internet.de. Source
This page describes how Portfolio Lab calculates; past results are not a forecast. All terms in the glossary.