# Computer science

## IBAN - international standard for bank account number

### Table of contents

- Introduction
- What is the IBAN?
- IBAN validation algorithm
- Examples of IBAN validation
- IBAN validating program
- Resources

### Introduction

In this article you can find an introduction to the new international standard used to uniquely identify the account of a customer at a financial institution, a validation algorithm with some examples, an on-line validation form and a program in JavaScript that implements the algorithm. It is available also the version of the program in PL/SQL di Oracle.

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 alexandre.rodichevski@chiappani.it.

I thank Mr Wojciech Sosnowski (Poland) ans 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?

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, to the ordering bank or to the beneficiary’s one, to verify the correctness of the data thanks to the presence of the check digits. The IBAN has a length that depends on the nation, with a maximum of 34 characters, cannot contain neither spaces nor special characters, like hyphen or slash, is composed of numbers and capital letters, according to the following scheme:

Description | Position | Composition | Example |
---|---|---|---|

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 is made of 27 characters:
code IT

, two check digits and
Italian BBAN.

The IBAN considerated up to now has electronic

or
base format

that is called like that 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 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

7

into 7. The letterA

is converted into 10,B

into 11, etc,Z

is converted into 35. The result in 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 excessive 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, 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

#### Example 1

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

Q0123412345000000753XYZIT60

.Converting it into a numerical string,

Q

is changed into 26,0

is changed into 0,1

is changed into 1, etc. The result is260123412345000000753333435182960

.Let us break this numerical string into five parts:

26012341

,23450000

,00753333

,43518296

and0

. The remainder of the division of 26012341 by 97 is 45. The remainder of the division of**45**23450000 by 97 is 15. The remainder of the division of**15**00753333 by 97 is 82. The remainder of the division of**82**43518296 by 97 is 68. The remainder of the division of**68**0 by 97 is 1.

Therefore the remainder of the division is 1. This IBAN is valid.

#### Example 2

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.

#### Example 3

The string IT60Q012341234500000753/XYZ

contains a
special character /

, therefore the IBAN is
invalid.

#### Example 4

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

Here you can find a validating form and an example of the program implementing the algorithm checking international bank account numbers.

#### IBAN validating form

To verify a bank account number, inserted it in the
following field and click on the button Check

.

### Resources

- IBAN in the site of di European Committee for Banking Standards.

http://www.ecbs.org/iban.htm