Test a numeric string against the ISO 7064 MOD 97-10 check used internationally for IBAN and similar identifiers.
Algorithm
After removing spaces and non-digits:
- Treat the entire string as a big integer (or process iteratively in chunks for long values).
- Compute remainder mod 97.
- The string is valid when the remainder equals 1.
This is equivalent to moving the check digits to the end, converting letters to numbers (A→10 … Z→35), and requiring divisibility by 97 — the same rule applied to IBAN validation.
When to use it
Validate custom reference numbers that adopt MOD-97, cross-check IBAN implementations you are building, or explain why European bank accounts embed a mathematical checksum.
Limitations
The check confirms format integrity, not that a bank account is open or reachable. Very long inputs are handled as strings of digits; leading zeros matter. Letter conversion follows the IBAN scheme — arbitrary alphabetic payloads without that mapping are outside scope.