Last updated
IBAN Format by Country
The IBAN Validator checks format correctness and MOD-97 check digit validity for all 77+ countries that use IBANs. Here are the formats for common countries:
Country Length Example IBAN
-------------- ------ --------------------------------
Germany (DE) 22 DE89 3704 0044 0532 0130 00
United Kingdom 22 GB29 NWBK 6016 1331 9268 19
France (FR) 27 FR76 3000 6000 0112 3456 7890 189
Netherlands 18 NL91 ABNA 0417 1643 00
Spain (ES) 24 ES91 2100 0418 4502 0005 1332
Italy (IT) 27 IT60 X054 2811 1010 0000 0123 456
Switzerland 21 CH93 0076 2011 6238 5295 7
Sweden (SE) 24 SE45 5000 0000 0583 9825 7466
Poland (PL) 28 PL61 1090 1014 0000 0712 1981 2874
Norway (NO) 15 NO93 8601 1117 947
IBAN Structure Breakdown
Every IBAN follows the same structure: country code + check digits + BBAN (Basic Bank Account Number):
/* German IBAN example */
DE89 3704 0044 0532 0130 00
DE → Country code (Germany)
89 → Check digits (MOD-97 validated)
3704 0044 0532 0130 00 → BBAN (bank code + account number)
/* UK IBAN example */
GB29 NWBK 6016 1331 9268 19
GB → Country code (United Kingdom)
29 → Check digits
NWBK → Sort code prefix (bank identifier)
6016 13 → Sort code
3192 6819 → Account number
/* French IBAN example */
FR76 3000 6000 0112 3456 7890 189
FR → Country code (France)
76 → Check digits
30006 → Bank code
00001 → Branch code (code guichet)
12345678901 → Account number
89 → National check digits (RIB key)
MOD-97 Check Digit Validation
The check digits in positions 3-4 are validated using the MOD-97 algorithm. Here is how it works:
/* Validating GB29 NWBK 6016 1331 9268 19 */
Step 1: Remove spaces
GB29NWBK60161331926819
Step 2: Move first 4 characters to end
NWBK60161331926819GB29
Step 3: Replace letters with numbers (A=10, B=11, ..., Z=35)
N=23, W=32, B=11, K=20, G=16, B=11
232311206016133192681916 1129
Step 4: Calculate MOD 97
232311206016133192681916 1129 mod 97 = 1
Step 5: Result must equal 1 for valid IBAN
Result: 1 ✓ — IBAN is valid
/* Invalid IBAN example */
GB29 NWBK 6016 1331 9268 20 ← last digit changed
MOD-97 result: 97 ≠ 1 → INVALID
Common IBAN Validation Errors
The validator provides specific error messages for each type of problem:
/* Error 1: Wrong length for country */
Input: DE89 3704 0044 0532 0130
Error: German IBANs must be 22 characters. This has 21.
/* Error 2: Invalid characters */
Input: GB29 NWBK 6016 1331 9268 1O ← letter O instead of zero
Error: IBANs may only contain letters A-Z and digits 0-9.
Position 22 contains 'O' — did you mean '0'?
/* Error 3: Invalid check digits */
Input: DE00 3704 0044 0532 0130 00
Error: Check digits '00' are invalid for this IBAN.
The correct check digits are '89'.
/* Error 4: Unknown country code */
Input: XX89 3704 0044 0532 0130 00
Error: 'XX' is not a recognized IBAN country code.
/* Error 5: Correct format, valid check digits */
Input: DE89 3704 0044 0532 0130 00
Result: ✓ Valid IBAN
Country: Germany
Bank code: 37040044
Account: 0532013000
IBAN Validation in Code
Implementing IBAN validation in your application:
/* JavaScript IBAN validation */
function validateIBAN(iban) {
// Remove spaces and convert to uppercase
const cleaned = iban.replace(/\s/g, '').toUpperCase();
// Check length (varies by country)
const lengths = {
DE: 22, GB: 22, FR: 27, NL: 18, ES: 24,
IT: 27, CH: 21, SE: 24, PL: 28, NO: 15
};
const country = cleaned.slice(0, 2);
if (lengths[country] && cleaned.length !== lengths[country]) {
return { valid: false, error: `${country} IBANs must be ${lengths[country]} characters` };
}
// Move first 4 chars to end, replace letters with numbers
const rearranged = cleaned.slice(4) + cleaned.slice(0, 4);
const numeric = rearranged.split('').map(c =>
isNaN(c) ? (c.charCodeAt(0) - 55).toString() : c
).join('');
// MOD-97 check (process in chunks to avoid integer overflow)
let remainder = 0;
for (let i = 0; i < numeric.length; i += 7) {
remainder = parseInt(remainder + numeric.slice(i, i + 7)) % 97;
}
return remainder === 1
? { valid: true, country, checkDigits: cleaned.slice(2, 4) }
: { valid: false, error: 'Invalid check digits' };
}
// Usage
validateIBAN('DE89 3704 0044 0532 0130 00');
// → { valid: true, country: 'DE', checkDigits: '89' }
validateIBAN('GB29NWBK60161331926819');
// → { valid: true, country: 'GB', checkDigits: '29' }
Batch IBAN Validation
Validating a list of IBANs before processing a payment batch:
/* Input: payment batch CSV */
Recipient,IBAN,Amount
Alice GmbH,DE89 3704 0044 0532 0130 00,€1500.00
Bob Ltd,GB29 NWBK 6016 1331 9268 19,£800.00
Carol SA,FR76 3000 6000 0112 3456 7890 189,€2200.00
Invalid Co,DE00 1234 5678 9012 3456 78,€500.00
/* Validation results */
✓ DE89 3704 0044 0532 0130 00 — Valid (Germany)
✓ GB29 NWBK 6016 1331 9268 19 — Valid (United Kingdom)
✓ FR76 3000 6000 0112 3456 7890 189 — Valid (France)
✗ DE00 1234 5678 9012 3456 78 — Invalid check digits
1 invalid IBAN found. Fix before submitting payment batch.