---
title: Universal Product Code
slug: universal-product-code
qid: 
snapshot: enwiki-001378790865
content_hash: 
license: CC BY-SA 4.0
source: https://en.wikipedia.org/w/index.php?oldid=1378790865
tags: [20148406, 22899477, 22936795, 22979400, 23050511, 23118434, 23255817, 23508143, 23603337, 24623845, 24745122, 26863021, 28459227, 40377096, 60231913, 64861536, 8733168]
---

# Universal Product Code

> [!note] Provenance
> Snapshot `enwiki-001378790865` · content root `…`
> Derived from <https://en.wikipedia.org/w/index.php?oldid=1378790865> · Licensed CC BY-SA 4.0

The Universal Product Code (UPC or UPC code) is a barcode symbology that is used worldwide for tracking trade items in stores. The chosen symbology has bars (or spaces) of exactly 1, 2, 3, or 4 units wide each; each decimal digit to be encoded consists of two bars and two spaces chosen to have a total width of 7 units, in both an "even" and an "odd" parity form, which enables being scanned in either direction. Special "guard patterns" (3 or 5 units wide, not encoding a digit) are intermixed to help decoding. A UPC (technically, a UPC-A) consists of 12 digits that are uniquely assigned to each trade item. The international GS1 organisation assigns the digits used for both the UPC and the related International Article Number (EAN) barcode. UPC data structures are a component of Global Trade Item Numbers (GTINs) and follow the global GS1 specification, which is based on international standards. Some retailers, such as clothing and furniture, do not use the GS1 system, instead using other barcode symbologies or article number systems. Some retailers use the EAN/UPC barcode symbology, but do not use a GTIN for products sold only in their own stores. Research indicates that the adoption and diffusion of the UPC stimulated innovation and contributed to the growth of international retail supply chains.

The Universal Product Code (UPC or UPC code) is a barcode symbology that is used worldwide for tracking trade items in stores. The chosen symbology has bars (or spaces) of exactly 1, 2, 3, or 4 units wide each; each decimal digit to be encoded consists of two bars and two spaces chosen to have a total width of 7 units, in both an "even" and an "odd" parity form, which enables being scanned in either direction. Special "guard patterns" (3 or 5 units wide, not encoding a digit) are intermixed to help decoding. A UPC (technically, a UPC-A) consists of 12 digits that are uniquely assigned to each trade item. The international GS1 organisation assigns the digits used for both the UPC and the related International Article Number (EAN) barcode. UPC data structures are a component of Global Trade Item Numbers (GTINs) and follow the global GS1 specification, which is based on international standards. Some retailers, such as clothing and furniture, do not use the GS1 system, instead using other barcode symbologies or article number systems. Some retailers use the EAN/UPC barcode symbology, but do not use a GTIN for products sold only in their own stores. Research indicates that the adoption and diffusion of the UPC stimulated innovation and contributed to the growth of international retail supply chains. UPC-A barcodes can be printed at various densities to accommodate a variety of printing and scanning processes. The significant dimensional parameter is called x-dimension (width of single module element). The width of each bar (space) is determined by multiplying the x-dimension and the module width (1, 2, 3, or 4 units) of each bar (space). Since the guard patterns each include two bars, and each of the 12 digits of the UPC-A barcode consists of two bars and two spaces, all UPC-A barcodes consist of exactly (3&nbsp;×&nbsp;2)&nbsp;+&nbsp;(12&nbsp;×&nbsp;2)&nbsp;=&nbsp;30 bars, of which 6 represent guard patterns and 24 represent numerical digits. The x-dimension for the UPC-A at the nominal size is 0.33&nbsp;mm (0.013"). Nominal symbol height for UPC-A is 25.9&nbsp;mm (1.02"). The bars forming the S (start), M (middle), and E (end) guard patterns, are extended downwards by 5 times x-dimension, with a resulting nominal symbol height of 27.55&nbsp;mm (1.08"). This also applies to the bars of the first and last numerical digit of UPC-A barcode. UPC-A can be reduced or magnified anywhere from 80% to 200%. A quiet zone, with a width of at least 9 times the x-dimension, must be present on each side of the scannable area of the UPC-A barcode. For a GTIN-12 number encoded in a UPC-A barcode, the first and last digits of the human-readable interpretation are always placed outside the symbol in order to indicate the quiet zones that are necessary for UPC barcode scanners to work properly. Sum the odd-numbered digits (0&nbsp;+&nbsp;6&nbsp;+&nbsp;0&nbsp;+&nbsp;2&nbsp;+&nbsp;1&nbsp;+&nbsp;5 = 14). Multiply the result by 3 (14 × 3 = 42). Add the even-numbered digits (42&nbsp;+&nbsp;(3&nbsp;+&nbsp;0&nbsp;+&nbsp;0&nbsp;+&nbsp;9&nbsp;+&nbsp;4) = 58). Find the result modulo 10 (58&nbsp;mod&nbsp;10 = 8 = M). If is not 0, subtract from 10 ( ). Thus, the check digit is 2. The check digit equation is selected to have reasonable error detection properties (see Luhn algorithm). UPC-A can detect 100% of single digit errors. A single digit error means exactly one digit is wrong. Let the difference modulo 10 of the erroneous digit and the correct digit be . The value of cannot be zero because that means the digits are the same, but can be any other value in {1, 2, 3, 4, 5, 6, 7, 8, 9}. If the error digit is in an odd position (weight 1), the left hand side of check digit equation changes by and the equivalence is no longer zero. If the error digit is in an even position (weight 3), then the left hand side changes by , but that change is also nonzero modulo 10, so the check digit equation is not satisfied. UPC-A can detect about 89% of transposition errors. Specifically, if and only if the difference between two adjacent digits is 5, the UPC-A can't detect their transposition. If 2 neighboring digits are transposed, then one of the digits will be weighted by 1, and the other digit will be weighted by 3, where is the difference between the two digits. If the digits were in their correct order, they would contribute 1a + 3b = 1a + 3(a+d) = 4a + 3d to the left hand side of the check digit equation. In the transposed order, they contribute 1b + 3a = 3a + 1(a+d) = 4a + d . to the LHS. Subtracting the two contributions gives how much they change the LHS: (4a + 3d) - (4a + d) = 2d An error will be detected as long as the modular change is nonzero; if modulo 10, then the change will not be detected. Consequently, only when the character difference will an error be undetected (when the degenerate "transposition" is not an error). Next consider how often a transposition has a distance of 5. Here is the Table of d-transpositions for UPC-A barcodes, where d \in \{0, 1, 2, \ldots, 9\}: Row Sum contains the number of d-transpositions, therefore the proportion of non-detectable transposition errors is (ignoring the transpositions where ): \frac{10}{18 + 16 + 14 + 12 + 10 + 8 + 6 + 4 + 2}=\frac{10}{90}=11.111\ldots\%. ▯
