Bank payments

IBAN validator

Paste an IBAN to check its country, length and check digits, and see it formatted in groups of four. The check runs entirely in this page, so nothing you type leaves your browser. It tells you the IBAN is well formed, which is not the same as telling you the account exists.

Spaces and lower case are fine. The check runs in this page; nothing you type is sent anywhere.

Result

Turn on JavaScript to see the result here. The formula and a worked example are below.

What an IBAN is made of

An IBAN (International Bank Account Number, ISO 13616) is four characters of header in front of the domestic account number:

  • Country code, two letters: GB, DE, FR.
  • Check digits, two digits computed from everything else. This is what the validator checks.
  • BBAN, the basic bank account number: the bank, branch and account identifiers in that country's own layout.

Each country fixes its own length, from 15 characters (Norway) to 33 (Russia) in the current registry. On paper it's written in groups of four, GB82 WEST 1234 5698 7654 32; in a file or an API call it's one string with no spaces, GB82WEST12345698765432.

The mod-97 check, step by step

Take GB82 WEST 1234 5698 7654 32, a test IBAN that passes.

  1. Strip the spaces and upper-case it: GB82WEST12345698765432.
  2. Check the length against the country: GB is 22 characters, and this is 22.
  3. Move the first four characters to the end: WEST12345698765432GB82.
  4. Turn each letter into a number, A = 10, B = 11, up to Z = 35. W is 32, E is 14, S is 28, T is 29, G is 16, B is 11, which gives 3214 2829 1234 5698 7654 3216 1182 (spaces added to make it readable).

  5. Divide by 97 and keep the remainder. If it's 1, the checksum is valid. Here it's 1.

That number has 28 digits. A JavaScript number is exact only up to 2^53, about 9 x 10^15, which is 16 digits, so in the browser don't parse it whole. Work through it a digit at a time and keep only the remainder: remainder = (remainder x 10 + next digit) mod 97. The validator above does exactly that. Python's integers have no size limit, so this version, the book's from chapter 34 with the length and check-digit tests added, can take the whole number at once:

IBAN_LENGTHS = {"DE": 22, "FR": 27, "GB": 22, "NL": 18}  # the full table is below


def valid_iban(iban: str) -> bool:
    iban = iban.replace(" ", "").upper()
    if not iban.isascii() or not iban.isalnum():
        return False
    if IBAN_LENGTHS.get(iban[:2]) != len(iban):
        return False
    if not iban[2:4].isdigit() or not 2 <= int(iban[2:4]) <= 98:
        return False
    rearranged = iban[4:] + iban[:4]
    numeric = "".join(str(int(c, 36)) for c in rearranged)  # A=10 ... Z=35
    return int(numeric) % 97 == 1

Where the check digits come from

The bank computes them the same way, run backwards. Put 00 where the check digits go, take the remainder mod 97, and subtract it from 98. For WEST12345698765432 with GB00, the remainder is 16, and 98 - 16 = 82, which is the 82 in GB82. A remainder runs from 0 to 96, so real check digits are always between 02 and 98. The validator rejects 00, 01 and 99 even when the remainder happens to come out at 1.

What a valid checksum proves

It proves the string is well formed. Change any single character (a 3 typed as an 8, a B as an R) and the remainder stops being 1, because the change shifts the number by a multiple of a power of ten that 97, a prime, can't divide. The same argument covers two neighbouring digits swapped: the change is 9 x (difference) x a power of ten. A letter swapped with a neighbouring digit can very occasionally slip through.

It doesn't prove that the account exists, that it's open, or that it belongs to the person whose name you have. A checksum-valid IBAN can be closed, mistyped by the customer into someone else's valid number, or outside the SEPA zone. For euro transfers, Verification of Payee is the check that closes the name gap: the payer's bank compares the name against the IBAN and answers match, close match, no match or other before the money moves. Some countries also put their own check digits inside the BBAN; this validator doesn't check those, and the bank will.

A valid IBAN from a country in the table isn't automatically a SEPA address either. The registry covers countries well outside the 41-country SEPA scope, so for SEPA Direct Debit or SEPA Credit Transfer, check the country as well as the checksum.

When to validate

Twice. At onboarding, when the customer is still on the page and can fix a typo, and again when you build the payment file, because data gets edited, imported and migrated in between. Chapter 34's point is that a bad IBAN caught on your side costs nothing, while one caught by the bank comes back as a reject after you've paid for the attempt. If you collect by direct debit, a rejected collection also means a customer who thinks they've paid and hasn't.

IBAN length by country

89 countries and territories, from SWIFT's IBAN Registry, release 101. SWIFT's registry page refused automated requests on 14 November 2026, so the lengths were read from the registry file as reproduced in python-stdnum and checked country by country against iban.com's structure table. Every one matched. A country missing here has no entry in the registry, so this validator treats its IBANs as unknown.

CountryCodeLength
AndorraAD24
United Arab EmiratesAE23
AlbaniaAL28
AustriaAT20
AzerbaijanAZ28
Bosnia and HerzegovinaBA20
BelgiumBE16
BulgariaBG22
BahrainBH22
BurundiBI27
BrazilBR29
BelarusBY28
SwitzerlandCH21
Costa RicaCR22
CyprusCY28
CzechiaCZ24
GermanyDE22
DjiboutiDJ27
DenmarkDK18
Dominican RepublicDO28
EstoniaEE20
EgyptEG29
SpainES24
FinlandFI18
Falkland IslandsFK18
Faroe IslandsFO18
FranceFR27
United KingdomGB22
GeorgiaGE22
GibraltarGI23
GreenlandGL18
GreeceGR27
GuatemalaGT28
HondurasHN28
CroatiaHR21
HungaryHU28
IrelandIE22
IsraelIL23
IraqIQ23
IcelandIS26
ItalyIT27
JordanJO30
KuwaitKW30
KazakhstanKZ20
LebanonLB28
Saint LuciaLC32
LiechtensteinLI21
LithuaniaLT20
LuxembourgLU20
LatviaLV21
LibyaLY25
MonacoMC27
MoldovaMD24
MontenegroME22
North MacedoniaMK19
MongoliaMN20
MauritaniaMR27
MaltaMT31
MauritiusMU30
NicaraguaNI28
NetherlandsNL18
NorwayNO15
OmanOM23
PakistanPK24
PolandPL28
PalestinePS29
PortugalPT25
QatarQA29
RomaniaRO24
SerbiaRS22
RussiaRU33
Saudi ArabiaSA24
SeychellesSC31
SudanSD18
SwedenSE24
SloveniaSI19
SlovakiaSK24
San MarinoSM27
SomaliaSO23
Sao Tome and PrincipeST25
El SalvadorSV28
Timor-LesteTL23
TunisiaTN24
TurkiyeTR26
UkraineUA29
Vatican City (Holy See)VA22
British Virgin IslandsVG24
KosovoXK20
YemenYE30

Questions

How do you validate an IBAN?

Strip the spaces, check the length against the country, move the first four characters to the end, turn letters into numbers (A = 10 up to Z = 35), and divide by 97. A valid IBAN leaves a remainder of 1.

Does a valid IBAN mean the account exists?

No. The checksum only proves the IBAN is well formed. The account can still be closed or belong to someone else. For euro transfers, Verification of Payee checks the name against the IBAN at the payer's bank before the money moves.

Is my IBAN sent anywhere when I use this validator?

No. The check runs in JavaScript in this page, and the input has no name, so even submitting the form doesn't put it in a URL. You can turn off your network connection and it still works.

How long is an IBAN?

It depends on the country: 15 characters in Norway, 22 in Germany and the UK, 27 in France and Italy, and 33 in Russia, the longest in the current registry. The table on this page lists all 89 countries.

What are the IBAN check digits?

The two digits after the country code, the 82 in GB82. The bank computes them by putting 00 in their place, taking the remainder mod 97 and subtracting it from 98, so they always fall between 02 and 98.

What the book adds

What chapter 34 adds

  • A SEPA credit transfer built as ISO 20022 pain.001, field by field
  • Direct debits as pain.008, Core vs B2B, with mandate references
  • The SEPA zone check that the mod-97 maths can't do
  • SEPA Instant, Verification of Payee and what the 2025 rules changed
  • FedNow, RTP, UPI and Pix side by side

30-day money-back · Instant PDF and EPUB

All 42 chapters