# How is the IBAN check digit calculated correctly?

Each IBAN contains a check digit calculated individually by the bank for the account holder. This check digit makes
it easy to recognize typing errors or numbers when entering and processing the IBAN. The principle is always the
same: A **mathematical operation** processes all available numbers and digits and uses a defined procedure to
calculate one or more check digits.
For the IBAN, the **Modulo 97** method is used for the check digit calculation. Since this is quite complex, the
check digit cannot be calculated in the header.

## Calculation of the check digit:

In Germany, the 8-digit bank code, the 10-digit account number and the country code "DE" are required as a basis for
calculating the checksum.
**If the account number consists of less than 10 digits, it is filled with leading zeros. **

For our example, we use the bank code 10010010 of Postbank in Berlin (BIC: PBNKDEFFXXX) and the account number 987654321.

The calculation always follows the same principle in several steps. First, the bank code and account number are
merged to form the so-called BBAN. In our example, the BBAN is "1001 0010 0987 6543 21". Now the country code and
the check digit set to 00 are placed in front of the BBAN. Thereby we get the IBAN "DE00 1001 0010 0987 6543 21",
but still with empty check digit.
Next, the IBAN is changed so that the country code and check digit are set to the end.

Now all letters must be replaced by numbers. For A = 10, B = 11 etc. up to Z = 35, in our case DE becomes the number
13 14.

After replacing the letters with the numbers, we get the number sequence 100100100100987654321131400.

This number is divided by 97 (Modulo 97 method) and the integer remainder of 98 is subtracted.

As a result, we now receive the calculated check digit of 29.

1 | bank code | 10010010 |
---|---|---|

2 | account number | 987654321 |

3 | BBAN | 100100100987654321 |

4 | IBAN without check digit | DE00100100100987654321 |

5 | Changeover | 100100100987654321DE00 |

6 | Replace letters | 100100100987654321131400 |

7 | Modulo 97 | 100100100987654321131400 mod 97 = 69 |

8 | Subtraction | 98-69 = 29 |

9 | IBAN with check digit | DE29100100100987654321 |