Function Repository Resource:

ValidIBANQ

Source Notebook

Verify an IBAN's validity

Contributed by: Sander Huisman

ResourceFunction["ValidIBANQ"][str]

returns True when the str is a valid International Bank Account Number (IBAN).

Details

IBAN stands for International Banking Account Number and is an internationally agreed system of identifying bank accounts across national borders to facilitate the communication and processing of cross-border transactions with a reduced risk of transcription errors.
Spaces, tabs and whitespace at the end and beginning of str are ignored.
ResourceFunction["ValidIBANQ"] checks if the country code exists (including those countries for which the IBAN system is "under development" and country codes for remote areas or islands). The following country codes are supported: AD, AE, AL, AO, AT, AX, AZ, BA, BE, BF, BG, BH, BI, BJ, BL, BR, BY, CF, CG, CH, CI, CM, CR, CV, CY, CZ, DE, DJ, DK, DO, DZ, EA, EE, EG, ES, FI, FO, FR, GA, GB, GE, GF, GG, GI, GL, GP, GQ, GR, GT, GW, HN, HR, HU, IC, IE, IL, IM, IQ, IR, IS, IT, JE, JO, KM, KW, KZ, LB, LC, LI, LT, LU, LV, MA, MC, MD, ME, MF, MG, MK, ML, MQ, MR, MT, MU, MZ, NC, NE, NI, NL, NO, PF, PK, PL, PM, PS, PT, QA, RE, RO, RS, SA, SC, SE, SI, SK, SM, SN, ST, SV, TD, TF, TG, TL, TN, TR, UA, VA, VG, WF, XK and YT.
ResourceFunction["ValidIBANQ"] checks whether the IBAN has the country-specific size.
ResourceFunction["ValidIBANQ"] checks whether the mod 97 checksum is valid (ISO 7064).
ResourceFunction["ValidIBANQ"] threads over lists.

Examples

Basic Examples (1) 

Check whether an IBAN is valid:

In[1]:=
ResourceFunction["ValidIBANQ"]["NL78SHSH0123456789"]
Out[1]=

Scope (2) 

Spaces and tabs are ignored:

In[2]:=
ResourceFunction["ValidIBANQ"]["NL69\tINGB 01 2345 6789"]
Out[2]=

ValidIBANQ has the Listable attribute:

In[3]:=
ResourceFunction[
 "ValidIBANQ"][{"NL78SHSH0123456789", "GB33BUKB20201555555555"}]
Out[3]=

Properties and Relations (3) 

French Guyana has a separate IBAN country code but the same length requirement as France:

In[4]:=
ResourceFunction["ValidIBANQ"]["GF0630006000011234567890189"]
Out[4]=

ValidIBANQ returns False if the input is manifestly not an IBAN:

In[5]:=
ResourceFunction["ValidIBANQ"][20]
Out[5]=
In[6]:=
ResourceFunction["ValidIBANQ"]["Santa claus"]
Out[6]=

Strings with the correct country code and corresponding length may fail if the account number fails a checksum test:

In[7]:=
ResourceFunction["ValidIBANQ"]["GF0630006000011234547890189"]
Out[7]=

Publisher

SHuisman

Version History

  • 1.0.0 – 04 May 2021

Related Resources

Author Notes

This function does not test country-specific additional checksums, nor does it test whether the account actually exists.

License Information