The article is useful for the programmers who must adapt their information systems to this new standard. Comments and questions are welcome: please reach me at email@example.com.
I thank Mr Wojciech Sosnowski (Poland) and Mr Joassart Benoit (Luxembourg) for valuable comments on the check digits. Mr Alain Dumont (Belgium) has produced a HTML page with a few improvements: the IBAN is introduced in block of 4 characters (paper format); the validation is done for a list of countries.
- What is the IBAN?
- IBAN validation algorithm
- Examples of IBAN validation
- IBAN validating program
What is the IBAN?
The IBAN (International Bank Account Number) is the international standard used to uniquely identify the
account of a customer at a financial institution, proposed by ECBS (European Committee for Banking Standards). This standard allows the ordering bank or to the beneficiary’s bank, to verify the correctness of the data thanks to the presence of the check digits. The IBAN which has a length that depends on the nation a maximum of 34 characters, and cannot contain spaces or special characters like the hyphen or slash, is composed of numbers and capital letters, according to the following scheme:
|Country code||0 and 1||two letters||IT|
|Check digits||2 and 3||two digits||60|
|BBAN of the nation||from 4 to the end||letters and digits||Q0123412345000000753XYZ|
Italian bank account number consists of 27 characters: code
IT, two check digits and Italian BBAN.
The IBAN considered up to now has
base format that is called that way so as to be distinguished from the
paper format. The latter can contain spaces to facilitate the spelling of the string, for example:
IT60 Q012 3412 3450 0000 0753 XYZ.
The European Payments Council has issued a resolution according to which from 1 January 2007, foreign payments between the countries of the European Union and the European Economic Area must use the payment recipient’s IBAN and the recipient bank’s BIC (Bank Identifier Code).
IBAN validation algorithm
- The IBAN must have a minimum of 5 and a maximum of 34 characters.
- It must only contain capital letters of the Latin alphabet from A to Z and digits from 0 to 9. Moreover, in positions 0 and 1 there must be only letters (a valid ISO state code), while in positions 2 and 3 only numbers.
- The first four characters of the original string are swapped with the rest.
- Every character is converted into a code from 0 to 35 according to the following rule. The digit is transformed into the corresponding number, for example
7into 7. The letter
Ais converted into 10,
Binto 11, etc,
Zis converted into 35. The result is a new string made of the numbers that have been obtained.
- The new numerical string is interpreted now as a number. Dividing that number by 97, the remainder 1 must be obtained. In order to facilitate the division of the excessively long numbers, it is possible to break the numerical string into smaller parts, and calculate the remainder of the division of the first part by 97, and then make the new numerical string of the remainder and of the second part and calculate the remainder of the division of this number by 97, etc.
Examples of IBAN validation
Let us consider the string
IT60Q0123412345000000753XYZ and follow the steps of the algorithm:
- This is a string of 27 characters.
- It contains only capital letters and digits. In positions 0 and 1 there are letters IT, while in positions 2 and 3 the number 60.
- Exchanging the first four characters with the rest, you obtain the string
- Converting it into a numerical string,
Qis changed into 26,
0is changed into 0,
1is changed into 1, etc. The result is
- Let us break this numerical string into five parts:
0. The remainder of the division of 26012341 by 97 is 45. The remainder of the division of 4523450000 by 97 is 15. The remainder of the division of 1500753333 by 97 is 82. The remainder of the division of 8243518296 by 97 is 68. The remainder of the division of 680 by 97 is 1.
Therefore the remainder of the division is 1. This IBAN is valid.
Let us consider
IT60 Q012 3412 3450 0000 0753 XYZ. Being in the paper format, this string contains some spaces, therefore the IBAN is invalid.
IT60Q012341234500000753/XYZ contains a special character,
/ and therefore the IBAN is invalid.
Let us consider the string
IT63Q0123412345000000753XYZ. This example is identical to the first one, except for the check digits 63. The numerical string is
260123412345000000753333435182963. The remainder of the division of this number by 97 is 4. Therefore the IBAN is invalid.
IBAN validating program
IBAN validating form
To verify a bank account number, insert it in the following field and click on the button
- IBAN in the site of European Committee for Banking Standards.