IBAN - International Bank Account Number

What is the IBAN number of my Irish account ?

To find out your IBAN number with ease, just fill out this form:

Bank: Bank of Ireland or Allied Irish Banks
Bank branch code: - -
Bank account number:
IBAN:

Disclaimer: use this IBAN generator at your own risk. The ECBS reccomends that customers obtain this information from their own bank.

What is an IBAN ?

(Taken from the European Commission's website - europa.eu.int)

IBAN stands for International Bank Account Number. An IBAN is not a new account number, but simply a new format for an existing bank account number that will be recognised internationally. It has been developed by the European Committee for Banking Standards to improve the efficiency of cross-border payments with regard to speed, quality and cost.

The IBAN is being introduced in Europe to facilitate the automatic processing of cross-border payments. IBANs include all the necessary details for a receiving bank to apply the payment directly to a beneficiary's bank account without any manual intervention. An IBAN contains information relating to the country, bank and branch of the beneficiary as well as the account number itself.

A comparison with a telephone number can help illustrate this. For local calls the basic phone number is sufficient, for international calls the country and area code are required. Similarly with payments, the basic account number can be used domestically, but the IBAN should be used for international payments.

Irish IBAN format

(Taken from European Committee for Banking Standards website - Ireland specific , General IBAN information - www.ecbs.org. Both links are to PDF files.)

The IBAN number has both an electronic format and a paper format. The electronic format is composed of 22 contiguous alphanumeric characters. The paper representation of the IBAN is composed of 22 alphanumeric characters structured into groups of 4 characters separated by blanks.

Example:

Electronic Format Paper Format
IE29AIBK93115212345678 IE29 AIBK 9311 5212 3456 78

This can be further broken down into the following structure:

Identifier Length Start Position
ISO Country Code 2 Letters 1
IBAN Check Digits 2 Digits 3
Bank identifier 4 Letters 5
Bank - branch code 6 Digits 9
Account Number 8 Digits 15

ISO Country Code

This is the 2 letter country code specified in ISO 3166 for the country in which the bank/branch servicing the IBAN resides. For Ireland it is always 'IE'.

The check digits

The check digits are constructed with the following algorithm:

Preliminary Step

Create an Artificial IBAN composed of the country code followed by "00" and the BBAN (after removing all non-alphanumerics). For Ireland, the BBAN is the bank identifier, followed by branch code, followed by account number).

For example, AIBK 93-11-52 1234 5678 becomes IE00AIBK93115212345678.

Step 1

Move the first four characters of the IBAN to the right of the number.

Result: AIBK93115212345678IE00.

Step 2

Convert the letters into numerics in accordance with the following conversion table. Basically, A becomes 10, B becomes 11 etc up to Z becoming 35.

A = 10 G = 16 M = 22 S = 28 Y = 34
B = 11 H = 17 N = 23 T = 29 Z = 35
C = 12 I = 18 O = 24 U = 30  
D = 13 J = 19 P = 25 V = 31  
E = 14 K = 20 Q = 26 W = 32  

Result: 1018112093115212345678181400.

Step 3

Apply MOD 97-10 (see ISO 7064).

Calculate the modulo 97 and subtract the remainder from 98. If the result is one digit, then insert a leading zero.

Result: 1018112093115212345678181400 % 97 = 69.

98 - 69 = 29.

Bank identifier

The bank identifier is the first four positions of the SWIFT address, which can be checked at http://www.swift.com/biconline. The bank identifier for Bank of Ireland is "BOFI", the bank identifier for Allied Irish Banks is "AIBK".

Branch code

This is the number found on your PASS card labelled 'CODE NUMBER'. For example, the Branch code for the Bank of Ireland in the University of Limerick is '90-45-79'.

Account number

Well, this one at least is fairly self explanatory!!

Where can I find an implementation of this algorithm?

You could view the JavaScript source on this web page or you could use this C snippet:


/* Silly programme to generate an Irish IBAN number from a sort code and an account
 * number 
Copyright (C) 2003 Martin Gallwey

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

*/
#include <stdio.h>
#include <unistd.h>

const int g_nBufLen = 512;
static const char * g_pNumberDescriptions[8] =
{
	"first",
	"second",
	"third",
	"fourth",
	"fifth",
	"sixth",
	"seventh",
	"eighth"
};

int calculateMod97 ( char *pInput )
{
	char pTmp[12], pResult[3];
	int nInputLength = strlen ( pInput ), nProcessed = 0;
	int nResult;
	int nAmount = 9;
	pTmp[0] = '\0';

	while ( nProcessed < nInputLength ) 
	{
		if ( nProcessed + nAmount > nInputLength )
			nAmount = nInputLength - nProcessed;

		strncat ( pTmp, pInput + nProcessed, nAmount );
		nResult = atol ( pTmp ) % 97;
		snprintf ( pTmp, 3, "%d", nResult );
		nProcessed += nAmount;
		nAmount = 7;
	}
	return nResult;
}

void printHelp( const char * pProgramme)
{
	printf ( "IBAN generation programme	version 0.1\n" );
	printf ( "Usage: %s -s <Bank sort code> -b <boi or aib> -a <account number>\n", pProgramme );
	printf ( "  -s Specify the 6 digit bank sort code\n" );
	printf ( "  -b Specify the name of the bank: BOI or AIB\n" );
	printf ( "  -a Specify the 8 digit account number\n" );
	exit ( -1 );
}

void checkString ( const char *pString, const int nExpectedLength, const char *pDescription)
{
	int i;
	if ( strlen ( pString ) != nExpectedLength )
	{
		fprintf ( stderr, "The %s must be %d digits long\n", pDescription, nExpectedLength );
		exit ( -1 );
	}
	for ( i = 0; i < nExpectedLength; ++i )
	{
		if ( !isdigit ( pString [i] ) )
		{
			fprintf ( stderr, "The %s character in the %s is not a number\n", 
					g_pNumberDescriptions[i], pDescription );
			exit ( -1 );
		}
	}
}
int main ( int argc, char * argv[] )
{
	int c, i, j, nEnd, nResult, nStringLength;
	const char *pSortCode, *pAccountNumber;
	char pBankCode[5];
	char pBuffer[g_nBufLen], pIBAN[g_nBufLen];

	if ( argc != 7 )
		printHelp ( argv[0] );

	while ( ( c = getopt ( argc, argv, "b:s:a:h" ) ) != EOF )
	{
		switch ( c )
		{
			case 'b':
				if ( strncasecmp ( optarg, "BOI", 3 ) == 0 )
					snprintf ( pBankCode, 5, "BOFI" );
				else if ( strncasecmp ( optarg, "AIB", 3 ) == 0 )
					snprintf ( pBankCode, 5, "AIBK" );
				else
				{
					fprintf ( stderr, "'%s' is not a recognised bank.\n", optarg );
					exit ( -1 );
				}
			break;
			case 's':
				checkString ( optarg, 6, "sort code" );
				pSortCode = optarg;
			break;
			case 'a':
				checkString ( optarg, 8, "account number" );
				pAccountNumber = optarg;
			break;
			default:
			{
				printHelp( argv[0] );
			}
		}
	}
	snprintf ( pIBAN, g_nBufLen, "%s%s%sIE00", pBankCode, pSortCode, pAccountNumber );

	for ( i = 0, j = 0, nEnd = strlen ( pIBAN ); i < nEnd; ++i )
	{
		if ( isdigit ( pIBAN[i] ) )
			pBuffer[j++] = pIBAN[i];
		else
		{
			snprintf ( &pBuffer[j], 3, "%d", pIBAN[i] - 'A' + 10 );
			j += 2;
		}
	}
	pBuffer [j] = '\0';
	nResult = 98 - calculateMod97 ( pBuffer );
	snprintf ( pIBAN, 23, "IE%.2d%s%s%s", nResult, pBankCode, pSortCode, pAccountNumber );
	printf ( "IBAN is %s\n", pIBAN );
	exit ( 0 );
}


Why this web page ?

While in Australia, I needed to figure out my IBAN for my account back home in the Bank of Ireland. I did the logical thing and emailed BOI, but they managed to give me the wrong SWIFT code, the wrong IBAN number (I knew this because other banks told me they were invalid) and the wrong phone number for someone to ring (sorry, Miss Irate Dub from Tallaght! I won't ring again!) ! So, I decided to figure it out for myself. This web page just details my discoveries.

Update, 20/01/04: The Register details an attempt by Bank of Ireland to get this webpage shut down here.

Update, 15/11/05: Markus Hofman pointed out that the javascript version of the above code did not add a leading zero if a check digit was less than 10. The C version handled this correctly, but the JavaScript needed to be updated. Thanks, Markus!