A test IBAN is an International Bank Account Number whose check digits are correct but which belongs to no account. This generator builds them for ten European countries: the two IBAN check digits are computed with the ISO 13616 mod-97 algorithm, and for Belgium, France, Italy, Portugal and Spain the national check digits inside the account number are computed too. Your validation library accepts them, so the code after validation gets tested.
That second layer is where most IBAN generators fall short. Popular libraries such as ibantools (JavaScript) and python-stdnum check the national digits for those countries, and an IBAN with random digits in their place fails there.
How to use it
- Tick the countries your product supports — add one you do not support to test the rejection.
- Choose grouped (
DE89 3704 …, as banks print it) or unbroken (as systems store it). Test your input field with both. - Toggle SWIFT/BIC, bank name and account holder to match the fields your form collects.
- Export the batch as JSON, CSV or SQL. The seed makes the same IBANs come back next time.
What you can control
- Ten countries with their correct total length and BBAN structure: Germany (22), France (27), United Kingdom (22), Spain (24), Italy (27), Netherlands (18), Belgium (16), Switzerland (21), Sweden (24) and Portugal (25).
- ISO 13616 mod-97 check digits on every IBAN, computed rather than faked.
- National check digits for Belgium (mod 97), France (RIB key), Italy (CIN letter), Portugal (NIB check digits) and Spain (two control digits).
- Grouped or unbroken display.
- SWIFT/BIC codes in the correct 8- or 11-character shape, with the matching country code.
How the mod-97 check works
Take the documentation example GB82 WEST 1234 5698 7654 32:
- Move the first four characters to the end:
WEST12345698765432GB82. - Replace each letter with two digits, A = 10 through Z = 35. W = 32, E = 14, S = 28, T = 29, G = 16, B = 11:
3214282912345698765432161182. - Take that number modulo 97. A valid IBAN leaves a remainder of exactly 1.
To generate check digits, set them to 00, run the same steps, and subtract the remainder from 98. The number is too large for a 64-bit integer, so validators process it a few digits at a time:
function ibanValid(iban) {
const s = iban.replace(/\s+/g, "").toUpperCase();
const rearranged = s.slice(4) + s.slice(0, 4);
let remainder = 0;
for (const ch of rearranged) {
const value = ch >= "A" ? String(ch.charCodeAt(0) - 55) : ch;
for (const digit of value) remainder = (remainder * 10 + Number(digit)) % 97;
}
return remainder === 1;
}
In Python, stdnum.iban.validate("GB82WEST12345698765432") does the same and also applies the national rules.
Testing ideas
- Length per country. Feed a Belgian 16-character IBAN and an Italian 27-character one into the same field. A
maxlength="22"copied from a German example truncates the Italian one silently. - Spaces and case. Paste grouped, unbroken and lowercase versions. A good field normalises all three before validating.
- Country allow-list. If you only accept SEPA countries or only EUR accounts, check that a GB or CH IBAN produces the right message.
- Storage. Store the unbroken form and display the grouped one. Generate both and confirm round-tripping does not double the spaces.
What this is not
The check digits are genuine; the accounts are not. No bank holds them, the bank codes are not in any registry, and a transfer to one fails at clearing. For the algorithms behind every check digit on this site, read Check digits that test data must satisfy.