nationid - v2.2.1
    Preparing search index...

    Function mod11_10CheckDigit

    • Compute the ISO/IEC 7064 MOD 11,10 check digit for a body of decimal digits. The algorithm is length-generic — supply any positive-length digit string and the function returns the single check digit in 0..9 that, when appended, makes the full string self-checking under the MOD 11,10 scheme.

      Sequence: starting from check c = 10, for each body digit d: p = ((d + c) % 10) || 10, then c = (p * 2) % 11. Final check digit is (11 - c) % 10.

      Parameters

      • body: string

        Digit-only string (/^\d+$/); each char must be '0'..'9'.

      Returns number

      The check digit in 0..9.

      if body is empty or contains a non-digit character.

      import { mod11_10CheckDigit } from "nationid/algorithms";

      // DE USt-IdNr: 8-digit body
      mod11_10CheckDigit("12345678"); // 8 → DE123456788

      // HR OIB: 10-digit body
      mod11_10CheckDigit("3339200596"); // 1 → HR33392005961

      // DE Steuer-ID: 10-digit body (different length from USt-IdNr)
      mod11_10CheckDigit("4703689281"); // 6 → 47036892816