Generate account number and keep original country
- 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.