IBAN Validator
Validate International Bank Account Numbers (IBAN) using the mod-97 checksum algorithm
About IBAN
The International Bank Account Number (IBAN) is an internationally agreed system of identifying bank accounts across national borders. It was originally developed to facilitate payments within the European Union and has been adopted by most European countries and many countries in other parts of the world. The IBAN consists of up to 34 alphanumeric characters, comprising a country code, two check digits, and a number that includes the domestic bank account number, branch identifier, and potential routing information.
IBAN Structure
An IBAN consists of the following components:
- Country Code: Two-letter ISO 3166-1 country code (e.g., GB for United Kingdom)
- Check Digits: Two digits calculated using the mod-97 algorithm
- Basic Bank Account Number (BBAN): Varies by country, can include:
- Bank identifier (bank code or routing number)
- Branch identifier (branch code or sort code)
- Account number
IBAN Length by Country
IBAN lengths vary by country. Here are some common examples:
| Country | Code | Length | Example |
|---|---|---|---|
| United Kingdom | GB | 22 | GB82 WEST 1234 5698 7654 32 |
| Germany | DE | 22 | DE89 3704 0044 0532 0130 00 |
| France | FR | 27 | FR14 2004 1010 0505 0001 3M02 606 |
| Spain | ES | 24 | ES91 2100 0418 4502 0005 1332 |
| Italy | IT | 27 | IT60 X054 2811 1010 0000 0123 456 |
| Netherlands | NL | 18 | NL91 ABNA 0417 1643 00 |
Mod-97 Validation Algorithm
The IBAN check digits are calculated using the mod-97 algorithm (ISO 7064):
- Move the first 4 characters (country code and check digits) to the end
- Replace each letter with its numeric equivalent (A=10, B=11, ..., Z=35)
- Convert the resulting string to an integer
- Calculate the remainder when divided by 97
- If the remainder is 1, the IBAN is valid
Example Validation
Let's validate IBAN: GB82 WEST 1234 5698 7654 32
Step 1: Remove spaces: GB82WEST12345698765432
Step 2: Move first 4 chars to end: WEST12345698765432GB82
Step 3: Replace letters with numbers:
W=32, E=14, S=28, T=29, G=16, B=11
Result: 32142829123456987654321611 82
Step 4: Concatenate: 3214282912345698765432161182
Step 5: Calculate: 3214282912345698765432161182 % 97 = 1
Result: Valid IBAN!
When to Use IBAN Validation
- Payment Processing: Validate IBANs before initiating SEPA transfers
- Banking Applications: Ensure account numbers are correctly formatted
- E-commerce: Validate customer bank details for direct debit
- Payroll Systems: Verify employee bank account information
- Invoice Management: Check supplier bank details for accuracy
- International Transfers: Validate recipient account numbers
IBAN vs SWIFT/BIC
While related, IBAN and SWIFT/BIC codes serve different purposes:
| Feature | IBAN | SWIFT/BIC |
|---|---|---|
| Purpose | Identifies individual bank accounts | Identifies banks and branches |
| Length | Up to 34 characters | 8 or 11 characters |
| Usage | Required for SEPA transfers | Used for international transfers |
| Format | Alphanumeric with check digits | Letters and numbers (no check digit) |
SEPA and IBAN
SEPA (Single Euro Payments Area) is a payment integration initiative of the European Union. IBAN is mandatory for SEPA transfers, which allow you to send euros to any account in the SEPA zone as easily as domestic transfers. Currently, 36 countries participate in SEPA, including all EU member states and several non-EU countries.
Test IBAN Numbers
Here are some valid test IBANs for different countries:
| Country | Valid Test IBAN |
|---|---|
| United Kingdom | GB82 WEST 1234 5698 7654 32 |
| Germany | DE89 3704 0044 0532 0130 00 |
| France | FR14 2004 1010 0505 0001 3M02 606 |
| Netherlands | NL91 ABNA 0417 1643 00 |
Common IBAN Errors
- Invalid check digits: Most common error, usually from typos
- Wrong length: Each country has a specific IBAN length
- Invalid country code: Not all countries use IBAN
- Invalid characters: Only letters and numbers are allowed
- Transposed digits: Swapping adjacent digits changes the checksum
Limitations
- Verify if the account exists or is active
- Check if the account can receive transfers
- Validate against bank databases
- Verify account holder information
- Process actual payments
Best Practices
- Always validate IBANs on both client and server side
- Strip spaces and convert to uppercase before validation
- Store IBANs without spaces in databases
- Display IBANs with spaces (every 4 characters) for readability
- Implement country-specific length checks
- Consider using IBAN verification services for additional checks
- Never store IBANs in plain text - use encryption
Additional Resources
- IBAN Registry: swift.com/standards/data-standards/iban
- IBAN Calculator: iban.com/calculate-iban
- SEPA Information: ecb.europa.eu/paym/integration/retail/sepa