Every IBAN contains two check digits (positions 3 and 4) that act as a built-in error-detection mechanism. These digits are calculated using the MOD-97 algorithm defined in ISO 7064. The checksum catches over 99% of transcription errors — including transposed digits, missing characters, and single-digit mistakes — before a payment is even sent. This guide walks through the algorithm step by step, explains why MOD-97 was chosen over simpler alternatives, provides multiple worked examples, and covers edge cases you should know about. For background on IBANs themselves, see our guide on what an IBAN is and how it works.
You might wonder why the IBAN standard uses MOD-97 rather than something simpler like the Luhn algorithm (MOD-10), which is used for credit card numbers. The answer comes down to error detection capability. Simpler checksums have significant blind spots:
The designers of the IBAN system, working under ISO 13616, chose MOD-97 specifically because international bank transfers involve large sums of money and even a single misdirected payment can be costly and time-consuming to recover. The higher detection rate justifies the slightly more complex arithmetic. Additionally, MOD-97 works naturally with the alphanumeric characters in IBANs (country codes contain letters), whereas MOD-10 is designed strictly for numeric strings.
The MOD-97 check digit system provides the following guarantees:
Single substitution errors — 100% detection
If any single character in the IBAN is changed to a different character (for example, a 5 becomes a 6, or an A becomes a B), the MOD-97 check will always detect the error. This is the most common type of transcription mistake.
Transposition of adjacent characters — 100% detection
If two adjacent characters are accidentally swapped (for example, 34 becomes 43), the MOD-97 check will always catch it. This is the second most common error when manually typing or reading an IBAN.
Other errors — approximately 99% detection
For more complex errors — such as multiple character substitutions, non-adjacent transpositions, insertions, or deletions — the detection rate is approximately 99 out of 100. The probability that a random error produces a valid checksum by coincidence is about 1 in 97.
Let's walk through the algorithm using the German IBAN DE89 3704 0044 0532 0130 00 as an example.
Step 1: Rearrange the IBAN
Move the first four characters (country code + check digits) to the end of the string. Remove all spaces.
3704 0044 0532 0130 00 DE89
Step 2: Convert letters to numbers
Replace each letter with its position in the alphabet plus 9. A = 10, B = 11, C = 12, … Z = 35. This conversion is defined by the ISO 13616 standard and ensures that every character in the IBAN can be represented as a number for the modular arithmetic that follows.
D = 13, E = 14 → 3704 0044 0532 0130 00 131489
Step 3: Compute MOD 97
Treat the entire numeric string as a single integer and calculate the remainder when divided by 97. For very large numbers, you can process the number in chunks — take the first 9 digits, compute MOD 97, prepend the result to the next chunk, and repeat.
370400440532013000131489 MOD 97 = 1
Step 4: Verify the result
If the remainder equals 1, the IBAN is valid. Any other result means the IBAN contains an error.
The numeric string produced by an IBAN can easily exceed 30 digits, which is far too large for standard integer types in most programming languages (a 64-bit integer can hold at most 19 digits). The solution is the chunking method, which processes the number in manageable pieces. Here is how it works in pseudocode:
remainder = ""
for each chunk of up to 9 digits in the numeric string:
number = integer(remainder + chunk)
remainder = string(number MOD 97)
result = integer(remainder)
Let's apply this to our German IBAN example. The full numeric string is 370400440532013000131489:
370400440 → 370400440 MOD 97 = 29295320130 → 295320130 MOD 97 = 70700013148 → 700013148 MOD 97 = 72729 → 729 MOD 97 = 1The final remainder is 1, confirming the IBAN is valid. This chunking approach works in any programming language using basic integer arithmetic — no big-number library needed.
Let's verify the French IBAN FR76 3000 6000 0112 3456 789P 185. French IBANs are 27 characters long and may contain a letter in the account number portion. For a full reference on country-specific formats, see our guide on IBAN format by country.
Step 1: Rearrange
Move FR76 to the end:
3000600001123456789P185FR76
Step 2: Convert letters
P = 25, F = 15, R = 27. The numeric string becomes:
300060000112345678925185152776
Step 3: Compute MOD 97 using chunking
Process in chunks of 9 digits, carrying the remainder forward each time. The final result:
300060000112345678925185152776 MOD 97 = 1
Step 4: Verify
The remainder is 1 — the French IBAN is valid. Note how the letter P in the account number was converted to 25 during step 2. This demonstrates that the algorithm handles alphanumeric IBANs seamlessly.
When a bank generates a new IBAN, it follows a similar process:
00, and append the BBAN (bank + account number).06).For example, to generate check digits for a German account, a bank would start with DE00370400440532013000, rearrange to 370400440532013000131400, compute 370400440532013000131400 MOD 97 = 9, and then calculate 98 – 9 = 89. The check digits are 89, giving us the final IBAN DE89 3704 0044 0532 0130 00.
There are several edge cases worth understanding when working with IBAN check digits:
Can check digits be 00?
No. Valid check digits range from 02 to 98. The formula is 98 – (numeric string MOD 97). Since MOD 97 produces a remainder between 0 and 96, the check digit result ranges from 2 (when the remainder is 96) to 98 (when the remainder is 0). A check digit of 00 or 01 is impossible under the standard and should be treated as an immediate validation failure.
Leading zeros in check digits
When the calculated check digit value is a single digit (2 through 9), it must be left-padded with a zero. For example, a check value of 6 becomes 06. The check digit field is always exactly two characters wide. Some common IBANs with leading-zero check digits include certain Belgian IBANs (country code BE) and Danish IBANs (country code DK).
Check digit 97 and 98
The values 97 and 98 are both valid check digits. A check digit of 98 occurs when the BBAN portion, after rearrangement and letter conversion, happens to be exactly divisible by 97 (remainder = 0). A check digit of 97 occurs when the remainder is 1. Both are perfectly normal.
In practice, every bank and payment processor implements IBAN validation as an automated check at the point of entry. When you type or paste an IBAN into a banking application, the software runs the MOD-97 validation before the payment instruction is even submitted. This provides immediate feedback, preventing common data-entry errors from ever reaching the payment processing system.
The implementation typically involves three layers of validation:
Most modern banking software runs all three checks in under a millisecond. Languages with native big-integer support (such as Python or JavaScript with BigInt) can compute the MOD-97 directly on the full numeric string. Languages without native support for arbitrarily large integers use the chunking method described above, which requires only standard 32-bit or 64-bit integer arithmetic.
It is important to note that IBAN validation confirms the format and checksum are correct — it does not confirm that the account actually exists at the specified bank. A valid IBAN could refer to a closed account or a non-existent account number that happens to produce a correct checksum. Account existence verification requires a separate check against the bank's internal systems, which is typically performed only during payment processing.
The MOD-97 checksum detects all single-character errors and nearly all transposition errors (two adjacent characters swapped). It is far more robust than simpler check-digit schemes. This is why banks can reject invalid IBANs before processing, saving time and preventing costly misdirected payments. According to European banking industry estimates, IBAN validation prevents millions of erroneous payment instructions from entering the clearing system each year, saving significant costs in manual investigation and fund recovery.
00 and 01 are mathematically impossible under the ISO 13616 standard. If you encounter an IBAN with check digits of 00 or 01, it is invalid regardless of what the rest of the string looks like.You do not need to calculate check digits manually. Paste any IBAN into our IBAN validator and the tool runs the MOD-97 check automatically, showing you whether the IBAN is valid along with a full breakdown of its components.
Back to all guides.