Select Page

# C - Calculating Mod 10 Check Digits

The LOINC code is a numeric code with a Mod 10 check digit. The algorithm for calculating a Mod 10 check digit is as follows:

Step 1

Using the number 12345, assign positions to the digits, from right to left.

Example:
1st = 5
2nd = 4
3rd = 3
4th = 2
5th = 1

Step 2

Take the odd digit positions counting from the right (1st, 3rd, 5th, etc.).

Example:
531

Step 3

Multiply by 2.

Example:
1062

Step 4

Take the even digit positions starting from the right (2nd, 4th, etc.).

Example:
42

Step 5

Prepend the results of Step 4 to the results of Step 3.

Example:
421062

Step 6

Add the digits of Step 5 together.

Example:
4 + 2 + 1 + 0 + 6 + 2 = 15

Step 7

Find the next highest multiple of 10.

Example:
20

Step 8

Subtract the value of Step 6 from the value of Step 7. Thus, 5 is the Mod 10 check digit for 12345.

Example:
20 - 15 = 5

## Calculating the check digit for LOINC Parts, Answers, and other identifiers with characters

We use a variant of the basic Mod 10 algorithm to calculate LOINC parts and answer identifiers because those identifiers contain the alpha prefixes “LP” and “LA” (which stand for LOINC Part and LOINC Answer). A detailed description of the method is available here:

https://wiki.openmrs.org/display/docs/Check+Digit+Algorithm

This same method could be used for calculating check digits for user-assigned “X codes” (that contain a leading “X” character) as well.