German IBAN explained: Bankleitzahl, Kontonummer and check digits

What the 22 characters of a German IBAN mean, how the Bankleitzahl and the Kontonummer fit into it, which check digits exist (and which ones this site does not compute), and where to get German test IBANs.

By the Generate Random IBAN editorial team · · 7 min read

A German IBAN has 22 characters: the country code DE, two IBAN check digits, the eight-digit bank code (Bankleitzahl, usually shortened to BLZ) and a ten-digit account number (Kontonummer). After the country code it is digits only. The example in the SWIFT IBAN Registry, DE89 3704 0044 0532 0130 00, splits into DE, 89, 37040044 and 0532013000.

The rest of this post covers what the Bankleitzahl encodes, why account numbers carry leading zeros, which check digits a German IBAN contains (there are two kinds, and most validators only verify one) and what to use as test data.

The structure of a German IBAN

Positions Length Content In the registry example
1 to 2 2 Country code DE
3 to 4 2 IBAN check digits (MOD-97) 89
5 to 12 8 Bankleitzahl 37040044
13 to 22 10 Kontonummer 0532013000

In the registry's notation the BBAN format is 8!n10!n: eight digits followed by ten digits, nothing else. A regular expression such as ^DE\d{20}$ is therefore a correct first check, provided you run it on the electronic format (uppercase, no spaces). At 22 characters Germany sits in the middle of the field: a Dutch IBAN has 18, an Italian one 27. The print format groups the characters in fours, which leaves a final group of two.

Because the BBAN is purely numeric, a German IBAN never trips the "letters in the account number" bugs that Dutch or British IBANs expose. It does trip the integer-overflow bug: the number you reduce modulo 97 has 24 digits, more than a 64-bit integer holds. https://generaterandomiban.com/en/ibanpedia/iban-check-digits shows the chunked remainder that avoids big-number libraries.

The Bankleitzahl: eight digits with a structure

The Bankleitzahl is the German bank sort code. Deutsche Bundesbank assigns the codes and publishes the directory, the Bankleitzahlendatei. According to the Bundesbank's guidance notes on the file, the digits are not arbitrary:

  • Digit 1 is the clearing area where the institution has its seat: 1 Berlin, Brandenburg and Mecklenburg-Vorpommern; 2 Bremen, Hamburg, Lower Saxony and Schleswig-Holstein; 3 Rhineland; 4 Westphalia; 5 Hesse, Rhineland-Palatinate and Saarland; 6 Baden-Württemberg; 7 Bavaria; 8 Saxony, Saxony-Anhalt and Thuringia.
  • Digits 1 to 3 together form the Ortsnummer, which identifies a Bundesbank branch location and its district.
  • Digit 4 is the institution group: 0 Deutsche Bundesbank; 1 to 3 payment service providers not covered by another group; 4 Commerzbank; 5 Girozentralen and Sparkassen; 6 and 9 cooperative central banks, credit cooperatives and former cooperatives; 7 Deutsche Bank; 8 Commerzbank, formerly Dresdner Bank.
  • Digits 5 to 8 are chosen by the institution itself, in agreement with the Bundesbank.

Read 37040044 from the registry example with this key: 3 is the Rhineland clearing area, 370 the Ortsnummer, and 4 the Commerzbank group. The code 10050000 (Berliner Sparkasse) has a 5 in fourth position, the Sparkasse group, and 50060400 (DZ BANK) a 6, the cooperative group.

Do not use this key to identify banks in software. The directory has a deletion flag and a successor bank code field, so a code stored years ago can now point to an institution that no longer exists under that name. When your code needs the bank behind an IBAN, look it up in the current file.

The Bankleitzahlendatei

The Bundesbank updates the directory four times a year. Each new file applies from the Monday after the first Saturday of March, June, September and December, and the next file appears for download about three to four weeks before it takes effect. The public version has 13 fields per record, among them the bank code, the name, postcode and town, the BIC, the check-digit method (field 9, more on that below), a change flag, the deletion flag and the successor code. A 14th field, the IBAN rule, is only in the extended version that payment service providers obtain through the Bundesbank's NExt platform.

Two practical consequences. First, the BIC column means a BLZ-to-BIC mapping is a solved problem in Germany: positions 5 to 12 of the IBAN are enough to find the BIC. Second, the quarterly cadence means a bank-code list in your code base goes stale; fetch the file or budget for updates.

The Kontonummer and its leading zeros

German account numbers have up to ten digits, and many have fewer. The Bundesbank's description of the German IBAN is explicit about what happens then: shorter account numbers are padded on the left with zeros to ten digits. The registry example contains the nine-digit account number 532013000, which becomes 0532013000 inside the IBAN.

For code this means the account segment is a string, never a number. Casting 0532013000 to an integer drops the zero, and rebuilding the IBAN from that value produces a different, invalid IBAN. The same applies to the Bankleitzahl, which can start with a zero in principle and must keep its eight digits.

IBAN rules: when BLZ plus account number is not enough

Padding with zeros is the standard rule, but not every German institution derives its IBANs that way. Some map legacy account data to the IBAN differently, for instance by substituting another bank code or a different account number. To make conversion reliable, the German banking industry and the Bundesbank agreed that every payment service provider discloses its method as an "IBAN rule". Each rule gets a four-digit identifier plus a two-digit version. Rule 0000 00 is the standard rule; rule 0001 00 means "no IBAN calculation": the IBAN cannot be derived from the old data at all and has to come from the bank. The rule identifier is what the extended directory carries in field 14, and the Bundesbank publishes the current rules as a PDF.

Concatenating BLZ and padded account number therefore gives the right IBAN for most German accounts and a wrong one for the rest. If you still process pre-SEPA account data, apply the rules. If you only need test IBANs, none of this matters, because you are not converting anything.

Two kinds of check digits

The IBAN check digits in positions 3 and 4

These are the ISO 13616 check digits, computed with MOD 97-10 from ISO 7064 over the rearranged IBAN. Every IBAN validator checks them, and they catch most single-character typos and transpositions. Our https://generaterandomiban.com/en/iban-validator runs this check in your browser and shows which part of the IBAN fails.

The account number's own check digit

Most German account numbers contain a check digit of their own, placed and calculated according to a method the bank chose. There is no single German algorithm. The Bundesbank publishes the list of check-digit calculation methods used in the banking industry (the Prüfzifferberechnungsmethoden), each identified by a two-character code, and field 9 of the Bankleitzahlendatei says which method a given bank applies. Method 00, for example, is a modulus 10 with the weights 2, 1, 2, 1, 2, 1, 2, 1, 2.

This is the layer most IBAN code ignores, and for good reason: validating it means shipping the Bundesbank's full method list and keeping it in step with the directory. It is also the layer this site does not compute. https://generaterandomiban.com/en/ibanpedia/national-check-digits explains which countries have a single published national algorithm; we implement those for 27 countries, from the French clé RIB to the Italian CIN. Germany is not among them, because the check depends on the bank. The account number in a generated German IBAN is random, so a system that applies the Bundesbank methods may reject it as an account number, even though the IBAN check digits are correct.

In practice that only matters when you test against German banking software that implements the method list. Everywhere else, including SEPA payment files and most payment providers' validation, a structurally valid IBAN with the right MOD-97 digits is what gets checked.

What a validator for German IBANs should check

  1. Normalise the input: remove all whitespace, convert to uppercase.
  2. Match ^DE\d{20}$. Anything else is not a German IBAN.
  3. Verify the MOD-97 check digits with arbitrary-precision arithmetic or the chunked remainder (worked through in Python, PHP and Java).
  4. Optionally, look up positions 5 to 12 in the current Bankleitzahlendatei. This tells you whether the bank code exists and gives you its name and BIC.
  5. Only if your product requires it, apply the bank's check-digit method from field 9 to positions 13 to 22.

Steps 1 to 3 need no data and never go out of date. Steps 4 and 5 depend on the quarterly file. None of them tells you whether the account exists or who holds it: that needs the bank, or Verification of Payee at payment time.

German test IBANs

The generator on https://generaterandomiban.com/en/iban-generator/de/germany produces German IBANs with correct MOD-97 check digits. In realistic mode, the default, the bank code is the Bankleitzahl of a real institution from the Bundesbank directory, such as 10070000 (Deutsche Bank), 50040000 (Commerzbank), 12030000 (DKB) or 20050550 (Hamburger Sparkasse), followed by a random ten-digit account number. Three IBANs it gave us while writing this post:

DE32 5004 0000 6275 4956 65
DE46 1203 0000 4137 6321 78
DE62 5001 0517 0766 4795 96

With realistic mode switched off, the bank code is random too (DE98018386971356514947), which is the right input for testing how your code reacts to an unknown Bankleitzahl. No bank issued either kind of IBAN. A realistic one could coincide with an existing account by chance, so never send money to it.

For fixtures, the export endpoint returns up to 100 German IBANs at once, with one column per segment:

curl -o german-ibans.csv "https://generaterandomiban.com/export/de?format=csv&count=50"
iban,iban_print,country,check_digits,bank,account
DE12200505509722771439,DE12 2005 0550 9722 7714 39,DE,12,20050550,9722771439
DE25200505509913085593,DE25 2005 0550 9913 0855 93,DE,25,20050550,9913085593

If you want one well-known value for documentation, the registry example DE89370400440532013000 is the one every library test suite already contains.

Sources

Need a Germany test IBAN?

Generate structurally valid IBANs for 91 countries, with correct check digits, ready to copy or download as CSV, JSON or SQL. They are not issued by any bank.

Generate a Germany IBAN