Skip to content
Pololei
Documentation / National checks

National check digits

The IBAN check digits (ISO 7064 MOD 97-10) protect the whole IBAN. Many countries also have national check digits inside the BBAN. pololei checks them on request:

IbanValidator validator = IbanValidator.standard()
                                       .nationalCheck(NationalCheckMode.IF_SUPPORTED);
validator.isValid("FR1420041010050500013M02606");   // true
validator.isValid("FR8420041010050500013M02607");   // false: RIB key 07 is wrong, the IBAN check digits are fine
ModeCountry with ruleCountry without rule (or BBAN the rule cannot judge)
OFF (default, same as Iban.validate)not checked, NOT_PERFORMEDNOT_PERFORMED
IF_SUPPORTEDPASSED or invalid with INVALID_NATIONAL_CHECK_DIGITS (FAILED)valid, NOT_SUPPORTED
REQUIREDas aboveinvalid with NATIONAL_CHECK_NOT_SUPPORTED

ValidationResult.nationalCheck() returns the status. A failed check reports the rule (rule(), for example FR_RIB_KEY) and the IBAN positions of the check digits (position() to lastPosition()); the message never contains the input. The national check runs after all international checks, so its error comes last.

IbanBuilder.nationalCheckDigits(true) calculates the national check digits when building, also together with buildRandom(Random).

Rules

Positions are BBAN positions (1-based). All rules work on the JVM and in GWT.

CountryRuleCheck positionsAlgorithm
BABA_MOD9715-16ISO 7064 MOD 97-10 over the BBAN: BBAN mod 97 = 1
BEBE_MOD9711-12first 10 digits mod 97; remainder 0 becomes 97
ESES_CCC9-10two weighted mod 11 digits (weights 1, 2, 4, 8, 5, 10, 9, 7, 3, 6): over 00 + entidad + oficina and over the account number; 11 becomes 0, 10 becomes 1
FIFI_LUHN14Luhn over the first 13 digits (machine format)
FRFR_RIB_KEY22-2397 - ((bank, branch, account) × 100 mod 97); letters A/J=1, B/K/S=2, ... I/R/Z=9
ITIT_CIN1CIN: values of ABI, CAB and account number on odd and even positions, sum mod 26 as letter
MCMC_RIB_KEY22-23as FR (Monaco uses the French RIB)
MEME_MOD9717-18ISO 7064 MOD 97-10 over the BBAN
MKMK_MOD9714-15ISO 7064 MOD 97-10 over the BBAN, digits only (see below)
NONO_MOD1111weighted mod 11 (weights 5, 4, 3, 2, 7, 6, 5, 4, 3, 2), remainder 1 has no valid check digit; bank 0000 (postgiro): Luhn over the 7 digit account
PTPT_MOD9720-21ISO 7064 MOD 97-10 over the BBAN (NIB check digits)
RSRS_MOD9717-18ISO 7064 MOD 97-10 over the BBAN
SISI_MOD9714-15ISO 7064 MOD 97-10 over the BBAN
SKSK_MOD115-20weighted mod 11 = 0 over the prefix (weights 10, 5, 8, 4, 2, 1) and over the basic number (weights 6, 3, 7, 9, 10, 5, 8, 4, 2, 1)
SMSM_CIN1as IT (San Marino uses the Italian BBAN)
TNTN_RIB_KEY19-2097 - ((bank, branch, account) × 100 mod 97)

Special cases

  • North Macedonia (MK): the registry allows letters in the account number (10!c), the MOD 97-10 rule is only defined for digits. A BBAN with letters gets NOT_APPLICABLE: valid with NOT_SUPPORTED in IF_SUPPORTED, invalid in REQUIRED. iban4j fails such IBANs instead. Random IBANs with national check digits contain digits only.
  • Norway (NO): a weighted sum with remainder 1 has no valid check digit; such account numbers are not issued, so every check digit fails and generation draws new values. Postgiro accounts (bank 0000) use Luhn (python-stdnum, stdnum.no.kontonr); iban4j does not know this case.
  • Spain (ES): check digits 10 and 11 become 1 and 0.
  • Belgium (BE): remainder 0 becomes 97.
  • Slovakia (SK): there is no separate check digit field; both parts must be divisible by 11. Generation sets the last digit of each part and draws again if that would have to be 10.

Countries deliberately without rule

  • Netherlands (NL): iban4j applies the eleven test (elfproef). Since 1 January 2020 Dutch banks may issue account numbers that do not pass it (Betaalvereniging), so the rule would reject valid IBANs. pololei has no NL rule (NOT_SUPPORTED).
  • Countries with national check digits whose algorithm is bank specific or not sufficiently documented (for example DE, HU, PL, AL, EE) have no rule. Their check digits are available as BbanField.NATIONAL_CHECK_DIGITS where the position is known (see bban-fields.md).

An application that needs a rule for one of these countries, or a different rule, adds its own NationalCheck to an IbanValidator with nationalRule(...); it replaces the built-in rule of the country for that validator only.

Test data and sources

NationalChecksTest checks for every country the example of the SWIFT IBAN registry (release 100) and, except for MC and SM, at least one IBAN from a second, independent source: published accounts of organisations and test vectors of python-stdnum 2.2. Every algorithm was additionally cross-checked against an independent Python implementation written from the descriptions above. For negative cases the test changes a national check digit and recalculates the IBAN check digits, so the IBAN stays internationally valid.

CountrySecond source
BABA391610000205360069, account listing on xtransfer.com
BEBE29001510480764, Rode Kruis-Vlaanderen SEPA mandate form (2024); BE32123456789002, python-stdnum stdnum.be.iban
ESES5000491837542210249123, donation account published by RTVC (2023); 1234 1234 16 1234567890, python-stdnum stdnum.es.ccc
FIFI0557134520027557, Suomen Punainen Risti, Turunmaan piiri
FRFR7610278012500001648634055, OCOVAS donation form (CHRU Strasbourg)
ITIT38R0760103000000000900050, IT60P0200805255000104428939, Italian Ministry of Foreign Affairs (esteri.it, 2016)
MEME25510000000006234133, python-stdnum stdnum.me.iban
MKMK07300701000001228, Red Cross of the Republic of North Macedonia (ckrm.org.mk)
NO0000.4090403 (postgiro), python-stdnum stdnum.no.kontonr
PTPT50003500270008240223053, Cruz Vermelha Portuguesa (Millennium bcp press release, 2019)
RSRS35205007080003980905, Crveni krst Srbije (eurohoops.net, 2014)
SISI56029220019831742, Rdeči križ Slovenije (bizi.si)
SKSK5411000000002945456524, Slovenská katolícka charita (teraz.sk); CZ test vector 034278-0727558021 of python-stdnum (same algorithm)
TNTN5905000000001508508829, Croissant-Rouge tunisien (webdo.tn, 2023)
MC, SMregistry example only; the algorithm is the French and Italian one

The accounts are only used as test vectors; whether they are still in use does not matter.