JavaScript / ECMAScript

IBAN (International Bank Account Number) in JS

Validate IBAN bank account identifiers: 2-letter country code, 2 check digits, 11–30 alphanumerics.

Try it in the JS tester →

Pattern

regexJS
^[A-Z]{2}\d{2}[A-Z0-9]{11,30}$

JavaScript / ECMAScript code

jsJavaScript
const re = new RegExp("^[A-Z]{2}\\d{2}[A-Z0-9]{11,30}$", "");
const input = "GB29NWBK60161331926819";
const matches = [...input.matchAll(re)];
console.log(matches.map(m => m[0]));

Uses `String.prototype.matchAll` for global iteration (Node 12+ / all modern browsers).

How the pattern works

^[A-Z]{2} matches the ISO country prefix (e.g. DE, GB, FR). \d{2} matches the two-digit check sum. [A-Z0-9]{11,30}$ matches the remaining bank/account portion which varies by country between 11 and 30 characters. This validates structure but does NOT verify the mod-97 checksum — pair with a checksum function for full validation.

Examples

Input

GB29NWBK60161331926819

Matches

  • GB29NWBK60161331926819

Input

DE89370400440532013000

Matches

  • DE89370400440532013000

Input

1234567890

No match

Same pattern, other engines

← Back to IBAN (International Bank Account Number) overview (all engines)