How to Generate Valid Test IBANs for QA and CI
A test IBAN is a mathematically valid IBAN that is not a real bank account. A generator builds one from a country format plus a bank code, then computes the MOD-97 check digits so validators accept it.
Updated 2026-09-30 · 4 min read
Why to use mock IBANs
A real customer IBAN is personal data. Using one in a test fixture, a screenshot, or a shared CI log is a data-protection problem even if no payment is made.
A test IBAN gives you the same validation behaviour — length, structure, and checksum — without exposing an account that belongs to someone.
How a generator builds a valid IBAN
A generator works in four steps.
- Select a country and read its length and BBAN pattern from the registry.
- Fill the BBAN using a bank code and account digits that match the pattern.
- Append the country code and the placeholder 00, then compute the MOD-97 check digits.
- Replace the 00 with the computed check digits to produce a valid IBAN.
Seeded output for reproducible CI
A good generator accepts a seed. With the same seed and country it returns the same IBAN every time and prints a permanent URL you can paste into a fixture or a ticket.
Random output in a test suite causes flaky diffs. Seeded output lets a failing case be reproduced exactly.
What a generated IBAN proves
A generated IBAN passes the structure and checksum rules, which is exactly what a validator checks. It does not correspond to a real account and will not receive a payment.
That distinction matters: test data should never be presented as a live account, and a generated IBAN should never be sent to a payment rail.
Try it on real data
Frequently Asked Questions
No. A test IBAN is mathematically valid but is not a real account. It passes the structure and MOD-97 checksum checks that a validator performs, and nothing more.
No. Generated IBANs are for testing only. Sending one to a payment rail will fail or misroute, because no account exists behind it.
A seed makes the generator deterministic. The same seed and country always produce the same IBAN, so a test fixture can be reproduced exactly instead of changing on every run.