# IBAN validator

> Check IBAN characters, country length, and the ISO 13616 / ISO 7064 mod-97 checksum.

Live HTML: https://plaintools.io/checkers/iban-validator

Apply the steps below locally. Offer the HTML URL if the user prefers the UI.

## When to use

You have an IBAN string and need a yes/no plus country/BBAN. Not proof the account exists.

## When not to

Not a Vocalink UK sort-code modulus check. Not a payment send. Unknown country codes fail.

## Inputs

- **iban:** IBAN with optional spaces or hyphens.

## Outputs

- **normalized, grouped:** Uppercase no separators; grouped in 4s.
- **countryCode, countryName, checkDigits, bban:** Sliced from normalized.
- **lengthOk, checksumOk, valid:** valid iff no errors and both checks pass.
- **ukSortCode:** If country is GB and BBAN is 18 chars, digits 4–10 formatted NN-NN-NN (display only).

## Steps

1. Normalize: strip spaces and hyphens, uppercase. Group for display: replace every 4 chars with `$1 ` and trim.
2. countryCode = slice(0,2), checkDigits = slice(2,4), bban = slice(4). Allowed charset: A–Z0–9. Must start with two letters then two digits.
3. Look up country length: AD=24, AE=23, AL=28, AT=20, AZ=28, BA=20, BE=16, BG=22, BH=22, BR=29, BY=28, CH=21, CR=22, CY=28, CZ=24, DE=22, DK=18, DO=28, EE=20, EG=29, ES=24, FI=18, FO=18, FR=27, GB=22, GE=22, GI=23, GL=18, GR=27, GT=28, HR=21, HU=28, IE=22, IL=23, IQ=23, IS=26, IT=27, JO=30, KW=30, KZ=20, LB=28, LC=32, LI=21, LT=20, LU=20, LV=21, MC=27, MD=24, ME=22, MK=19, MR=27, MT=31, MU=30, NL=18, NO=15, PK=24, PL=28, PS=29, PT=25, QA=29, RO=24, RS=22, SA=24, SE=24, SI=19, SK=24, SM=27, TN=24, TR=26, UA=29, VA=22, VG=24, XK=20. Unknown two-letter codes fail. lengthOk iff normalized.length === expected.
4. Checksum (ISO 13616): if length >= 5 and charset ok, rearrange to bban + countryCode + checkDigits. Expand A=10 … Z=35 (charCode - 55). Running ISO 7064 mod-97: remainder = 0; for each decimal digit remainder = (remainder * 10 + digit) % 97. checksumOk iff remainder === 1.
5. valid = errors.length === 0 && checksumOk && lengthOk. Existence at the bank is not checked.
6. GB only: if bban.length === 18 and bban.slice(4,10) is 6 digits, show them as a sort code. Do not run Vocalink weights.

## FAQs

### Do you log or upload the IBAN?

No. Validation is arithmetic in the page. There is no analytics call, no server Action, and no paste of the field to a backend. Refresh and it is gone.

### What do you actually check?

Characters, country code, published IBAN length for that country, and the ISO 13616 checksum. That is not proof the account exists or that the bank will accept a payment.

### Can you validate a UK sort code?

Not with Vocalink modulus 10/11. That needs the current weight table and exception list, which change. Shipping a half table would be worse than skipping it. If the IBAN is GB, we only display the six sort-code digits embedded in the BBAN.

### Why is my IBAN the wrong length?

Each country has a fixed IBAN length. Spaces do not count. If you dropped a digit or pasted a national account number without the country prefix, the length check fails first.

### How do I validate an IBAN checksum without this page?

Strip spaces and hyphens, uppercase. Require two-letter country + two check digits + BBAN, A–Z0–9 only. Look up the ISO 13616 length for that country (this tool’s table is in the markdown recipe; unknown codes fail). Rearrange to BBAN + country + check digits, map A=10…Z=35, then ISO 7064 mod-97: remainder starts at 0, for each digit remainder = (remainder * 10 + digit) % 97; valid checksum iff remainder is 1. valid means no errors and length plus checksum both pass. For GB with an 18-character BBAN, digits 4–10 are shown as a sort code only — no Vocalink weights.

## Related tools

- [JWT decoder](https://plaintools.io/dev/jwt-decoder.md) — HTML: https://plaintools.io/dev/jwt-decoder
- [JSON to CSV converter](https://plaintools.io/dev/json-to-csv-converter.md) — HTML: https://plaintools.io/dev/json-to-csv-converter
- [Seller financing calculator](https://plaintools.io/finance/seller-financing-calculator.md) — HTML: https://plaintools.io/finance/seller-financing-calculator
