Skip to main content Skip to complementary content

Generate account number and keep original country

This function generates a bank account number for the original country. As the output depends on different criteria, it may not be a valid bank account number.
An IBAN number is composed of several elements. Here is the terminology used for the data masking functions:
  • Black: Country code
  • Coral: Check digits
  • Light blue: Bank/branch code
  • Dark blue: Account number
  • Gray: National check digits. Their position in the IBAN number depends on the country.

    Some countries do not use national check digits.

Input account number

To determine the original country, the function analyzes the first two characters. For example, if the first two characters are SE, the output will be a Swedish bank account number.

As the function only analyzes the first two characters, it is not required to have a bank account number as a input. See the first example.

Logic of the function

If the input is...

Then...
a valid IBAN number the function generates an IBAN number from the same country as the input value.
a valid US account number the function keeps the first nine digits and randomly masks the other digits.
not a valid account number the function generates a French IBAN number.

Output account number

The format and the check digits of the generated account number are conform to the corresponding country.

For some countries, the national check digits are also conform to the country. To know which national check digits are handled, see this list.

National check digits from other countries are not handled.

As the bank/branch code is randomly generated, it may not be valid.

Here are two examples:

Here are two examples:

Input value Example of a masked value
BE BE78496464962486
091000019 6564833713 091000019 3602742991

In the first example, the two characters correspond to the country code of Belgium, the masked value is a valid Belgian IBAN number.

In the second example, the input value is a valid US account number, the masked value is a valid US account number.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!