Test IBAN Examples by Country for Form Validation

Compare German, UK and French test IBAN formats. Use intentionally invalid checksums to exercise validation and avoid real payment identifiers.

Test fixture

DE00 0000 0000 0000 0000 00
GB00 TEST 0000 0000 0000 00
FR00 0000 0000 0000 0000 0000 000

Compare DE, GB and FR layouts

An IBAN starts with a two letter country identifier followed by two check digits, then a country-specific account structure. Germany uses 22 characters in electronic form, the United Kingdom uses 22, and France uses 27. The German remainder is numeric. The UK format begins that remainder with four bank letters. The French account portion can contain letters and digits. Check a maintained copy of the Swift registry when adding countries or refreshing test expectations.

The examples on this page have intentionally invalid check digits of 00. They are useful for checking country and length rules before verifying the checksum rejection. Preserve them exactly so a later change to a fixture does not turn the negative test into an accepted identifier.

Test normalization and checksum independently

For pasted values, decide whether your application accepts spaces and lowercase letters. Normalize the presentation layer first, then check which country formats the product supports. Run the country-specific length and character rules before calling the checksum validator. The example below has a small layout map for these three countries and includes a separate checksum calculation.

Test a missing country prefix, a value with one extra character and a value with punctuation embedded between groups. Add the spaced display form as a separate input. Confirm that the validation message helps users identify the problem without logging the full submitted value.

Use provider fixtures for acceptance cases

A successful checksum only establishes an arithmetic property. Account existence, ownership and payment acceptance need separate checks. Use a fixture issued by your bank or payment provider sandbox when you need a positive end-to-end payout test. For ordinary application tests, assert that the normalized shape is recognized, the deliberately invalid checksum fails, and the app blocks submission before any transfer request is made.

Store the expected validation stage alongside the input. A case that stops at the format check gives different coverage from one that reaches the checksum check.

JavaScript test example

const formats = { DE: /^DE[0-9]{20}$/, GB: /^GB[0-9]{2}[A-Z]{4}[0-9]{14}$/,
  FR: /^FR[0-9]{12}[A-Z0-9]{11}[0-9]{2}$/ };
const value = 'GB00 TEST 0000 0000 0000 00'.replace(/ /g, '');
const shape = formats[value.slice(0, 2)]?.test(value) ?? false;
const digits = (value.slice(4) + value.slice(0, 4))
  .replace(/[A-Z]/g, letter => String(letter.charCodeAt(0) - 55));
const checksum = shape && !value.startsWith(value.slice(0, 2) + '00') && BigInt(digits) % 97n === 1n;
console.assert(shape && !checksum);

Related generators