products.com.au

Guide · The 13th digit

Work out a check digit by hand

The last digit of a barcode says nothing about the product. It is a check, there so the till can tell it read the other twelve correctly.

Three steps

GS1 sets the sum out in three steps. First, give each of the twelve digits a weight, starting from the left: 1, 3, 1, 3, and so on to the end, and multiply each digit by its weight. Second, add up the results. Third, take that total away from the nearest multiple of ten that is the same or higher. What is left over is the check digit.

GS1’s own example

GS1 works it through on 629104150021. Weighted, the digits give 6, 6, 9, 3, 0, 12, 1, 15, 0, 0, 2 and 3, which add up to 57. The next multiple of ten is 60, and 60 take away 57 is 3. So the check digit is 3.

A second example

Take 400638133393. Its weighted digits add up to 89. The next multiple of ten is 90, which leaves 1, so the full number ends in 1.

Try your own

Any 13-digit barcode can be tested here: its first twelve digits, typed in, should give back the thirteenth printed on it.

The working for this site’s example number, 952123456789.

Digits in odd places, added
31
Digits in even places, added
30
That, times three
90
Both together
121
Up to the next ten
9

The 13th digit is 9

9521234567899

Why it catches mistakes

Every digit counts once or three times, and only the last digit of the total matters. That is enough to catch any single digit read wrongly. It also catches nine in ten cases of two neighbouring digits swapped round; the swaps it misses are the ones where the two digits differ by exactly 5.

The same rule for every length

Count from the right instead and the weights never change, whatever the length of the code: the digit just before the check digit always counts three times. So one rule serves codes of every length.

9521234567899
The example number on this site. Its 13th digit is worked out from the first twelve by the sum on this page.

Sources

  1. GS1, “How to calculate a check digit manually”. gs1.org
  2. Wikipedia, “International Article Number”. Text CC BY-SA 4.0. en.wikipedia.org