Check the validity and checksums of IBAN bank account numbers.
The International Bank Account Number (IBAN) is an internationally agreed system of identifying bank accounts across national borders to facilitate the communication and processing of cross-border transactions.
It consists of up to 34 alphanumeric characters comprising a Country Code, two Check Digits, and a Basic Bank Account Number (BBAN) containing bank and routing details.
How does a payment form instantly know you mistyped your IBAN without making a slow network request to a bank?
It uses the Mod-97-10 algorithm. To validate an IBAN, the algorithm moves the four initial characters (Country Code and Check Digits) to the end of the string. It converts the letters to integers (A=10, B=11, Z=35), resulting in a massive integer.
It then performs a modulo 97 operation (number % 97). If the remainder is exactly 1, the IBAN is mathematically valid.
The integer generated during the Mod-97 check can be over 60 digits long. This introduces a major engineering problem in JavaScript.
JavaScript's native Number type is a double-precision float. It loses precision (corrupting the math) for any integer larger than 9,007,199,254,740,991 (16 digits). To correctly calculate the modulo of a 60-digit number in the browser, modern implementations must use the BigInt primitive (e.g., 123456789n % 97n === 1n).
A common misconception in fintech engineering is confusing validation with verification. The Mod-97 algorithm validates the checksum—it proves the number was typed correctly.
It does not verify that the bank account actually exists, that it belongs to the user, or that it is open and active. Verification always requires a backend network request to a banking API.
If the Mod-97 checksum calculation on an IBAN returns a remainder of 1, what does that mean?