Security Tools

IBAN explained: how the mod-97 check catches typos and what each part means

An IBAN looks like a random string, but every character has a job. This guide breaks one apart, walks through the mod-97 check by hand, shows how many typing mistakes it catches and explains why a valid IBAN is not the same as a real, working account.

By the Toolcloak team9 October 20263 min read
In this article
  1. Taking an IBAN apart
  2. Lengths by country
  3. The mod-97 check, step by step
  4. What mistakes does it catch?
  5. Valid does not mean real
  6. Writing and typing IBANs well

The International Bank Account Number (IBAN) is a standard way to write a bank account so payments can cross borders with fewer errors. Most of Europe, the Middle East and parts of Africa, Asia and South America use it. India does not; Indian transfers use an account number plus an IFSC code.

Taking an IBAN apart

The standard example from the specification is GB82 WEST 1234 5698 7654 32. Spaces are added only to make it easier to read. In the machine form there are none: GB82WEST12345698765432.

GB82WEST12345698765432, piece by piece
  1. 1GBCountry code (United Kingdom), two letters from ISO 3166.
  2. 282Two check digits, calculated from the rest of the IBAN.
  3. 3WESTBank code (here, four letters identifying the bank).
  4. 4123456Sort code: identifies the branch.
  5. 598765432The account number itself.

The last three pieces together are the BBAN, the Basic Bank Account Number. Its layout differs from country to country.

Paste an IBAN to check its length, format and check digits.Open IBAN Validator

Lengths by country

Each country fixes one total length. A string of the wrong length cannot be a valid IBAN for that country, which is the first thing a validator checks.

IBAN length in characters, selected countries
15NO16BE18NL22DE22GB24ES27FR31MT

Norway has the shortest at 15 and Malta one of the longest at 31. The UAE is 23 and Saudi Arabia 24.

The mod-97 check, step by step

The check digits come from a calculation that anyone can repeat. A validator moves the first four characters to the end, turns letters into numbers, and takes the remainder when divided by 97. A valid IBAN always leaves 1.

Checking GB82WEST12345698765432
  1. 1Move the first four characters to the endGB82 goes last: WEST12345698765432GB82
  2. 2Turn letters into numbersA = 10, B = 11 … Z = 35. W=32, E=14, S=28, T=29, G=16, B=11.
  3. 3Build one long number3214282912345698765432161182
  4. 4Divide by 97 and keep the remainderThe remainder is 1, so the IBAN passes.

The number is too long for ordinary calculators, so software divides it in chunks. The remainder is the same.

StepWorkingResult
Put 00 in place of the check digitsWEST12345698765432GB00Number ends in ...1100
Take that number mod 973214282912345698765432161100 ÷ 97Remainder 16
Subtract from 9898 − 16Check digits 82

This is how check digits are created: the same method in reverse. Anyone can repeat it, which is why a validator needs no database.

What mistakes does it catch?

We tested the example IBAN. Changing any one of its 16 digits to any other digit gives a failing check in all 144 cases. Swapping each of the 14 pairs of different neighbouring digits also fails every time. Real-world mistakes, such as typing one wrong digit or swapping two, are therefore caught almost every time.

Our test of the example IBAN
144 of 144Single digit changedAll detected
14 of 14Neighbouring digits swappedAll detected
1 in 97Chance a random string passesAbout 1.03%
98.97%Random strings caughtBy this check alone

The 1-in-97 figure is for random strings. Real typing errors are caught far more reliably than that.

Out of 97 random strings of the right length, how many pass?
  • Fail the check96
  • Pass by luck1

Mod 97 leaves one of 97 possible remainders, so about one random string in 97 happens to leave 1.

Valid does not mean real

What a validator can and cannot tell you
It can confirmThe format
  • Country code exists and length is right
  • Characters are allowed for that country
  • Check digits are consistent
It cannot confirmThe account
  • That the account is open
  • That it belongs to the right person
  • That the bank accepts payments there

Before a large first payment, confirm the details with the payee through a second channel, such as a phone call to a known number.

Writing and typing IBANs well

  1. Group in fours when writing by hand or on paper: GB82 WEST 1234 5698 7654 32.
  2. Remove spaces and dashes before pasting into a system.
  3. Use capital letters. Lowercase is usually accepted but capitals are standard.
  4. Copy and paste rather than retyping when you can.
  5. Check the first two letters. They should match the country of the account.

Questions people ask

What is an IBAN?

An International Bank Account Number is a standardised way to write a bank account number. It starts with a two-letter country code and two check digits, followed by the country's domestic bank and account details.

How long is an IBAN?

It depends on the country and ranges from 15 to 34 characters. Germany and the United Kingdom use 22, France 27 and Norway 15.

How does the IBAN check digit work?

The first four characters are moved to the end, letters become numbers (A = 10 to Z = 35), and the resulting number is divided by 97. A valid IBAN leaves a remainder of 1.

Does a valid IBAN mean the account exists?

No. Validation only proves the format and check digits are consistent. The account could be closed, wrong or fraudulent.

Does India use IBAN?

No. Indian domestic transfers use an account number and an IFSC code. For international transfers the receiving bank may ask for an account number and a SWIFT/BIC code.

Are spaces part of an IBAN?

No. Spaces are added only for readability, usually in groups of four. Remove them when entering an IBAN into a form.