tools / regex library / iban
regex pattern · ready to copy

Regex for matching IBAN (International Bank Account Number)

Match IBAN format: 2 country letters, 2 check digits, 11-30 alphanumeric. Format only, not arithmetic.

intermediate javascript / pcre / python4 use cases

The pattern

\b[A-Z]{2}\d{2}\s?(?:[A-Z0-9]\s?){11,30}\b

Test cases

InputResult
DE89 3704 0044 0532 0130 00matches
GB29 NWBK 6016 1331 9268 19matches
FR1420041010050500013M02606matches
12345678901234 (no country prefix)rejects
DE89 (too short)rejects

Edge cases & caveats

ALWAYS run mod-97 IBAN checksum verification after format match — regex format-pass ≠ valid account. Country-specific length varies (DE=22, GB=22, FR=27, etc.).

Common use cases

Try variations against your data
regexlab is a free in-browser tester with side-by-side match highlighting, group inspector, and named-capture export to JS/Python/PCRE.
Open regexlab  

Related

sql injection keywords · ipv4 address · username · bitcoin address · ↗ generate matching IBAN test data