Skip to Main Content

Barcodes: The Universal Product Code

Feature Column Archive

4. The Universal Product Code

The universal product code (UPC) is another familiar barcode that incorporates a system of error detection. The standard code used on items sold in American supermarkets (with the exception of items that are small and typically cylindrical, for which a special variant code was developed) consists of 11 information digits and a check digit. (The European version of this system is somewhat different.) Originally, the code was organized into four blocks, but because of the popularity of the code and the breadth of its use, the original standard has had to be modified so as to flexibly code the desired information. In any case the check digit works as follows: add the digits in the odd positions of the string which forms the code sequence, and multiply by 3; now take the digits in the even positions, sum them, and add to the previous answer. Finally, the check digit is chosen so that when it is added to the value, the result is a number which is divisible by 10 (ends in a zero).


Find the check digit (i.e. the value for the ? ) for the UPC number:

3 05212 90500 ?

The digits in the odd positions are 3, 5, 1, 9, 5, and 0. These sum to 23, which tripled yields 69. The digits in the even positions are 0, 2, 2, 0, and 0. These sum to 4, which, when added to 69, gives 73. Thus, the check digit is 7, because 73 + 7 = 80 is divisible by 10.

Symbolically, if we denote the code string, including the check digit by:


We compute the check digit u12 so that:

R = 3(u1 + u3 + u5 + u7 + u9 + u11 )+ (u2 + u4 + u6 + u8 + u10 + u12)

is congruent to zero modulo 10. If one is dealing with a legal UPC code, then R 0 mod 10 holds for the code.

  1. Introduction
  2. Barcodes
  3. Zip codes
  4. The Universal Product Code
  5. ISBN Numbers
  6. The Ultimate System
  7. References