# UPC

Key: `identity.commerce.upc`

Universal Product Code — 12-digit barcode identifier for retail products. Distinct from EAN-13 (13 digits). Includes a Mod 10 check digit.

Page: <https://meridian.online/docs/projects/finetype/types/identity/commerce/upc>

Samples: `042100005264`, `883028594054`, `012345678905`, `614141000036`

## Background

### Origin

GS1 US says the Universal Product Code was invented in the early 1970s, born out of a grocery industry crisis.[[1]](https://www.gs1us.org/upcs-barcodes-prefixes/guide-to-upcs) As supermarkets grew larger, manual price-keying caused checkout delays and inventory errors.[[1]](https://www.gs1us.org/upcs-barcodes-prefixes/guide-to-upcs) In 1973, a group of grocery trade associations formed the Uniform Product Code Council, which defined the numerical format that formed the basis of the code.[[2]](https://en.wikipedia.org/wiki/Universal_Product_Code) The linear barcode design came from IBM engineer George Laurer, who finalised it in 1973.[[1]](https://www.gs1us.org/upcs-barcodes-prefixes/guide-to-upcs) On 26 June 1974, a 10-pack of Wrigley's Juicy Fruit chewing gum was scanned at a Marsh supermarket in Troy, Ohio, the first commercial UPC scan.[[1]](https://www.gs1us.org/upcs-barcodes-prefixes/guide-to-upcs)[[2]](https://en.wikipedia.org/wiki/Universal_Product_Code)

A UPC (technically a UPC-A) consists of 12 digits uniquely assigned to each trade item.[[2]](https://en.wikipedia.org/wiki/Universal_Product_Code) The international GS1 organisation assigns the digits used for both the UPC and the related EAN barcode.[[2]](https://en.wikipedia.org/wiki/Universal_Product_Code) GS1 US describes the GTIN as the identifying number and the UPC as the scannable element of the barcode.[[1]](https://www.gs1us.org/upcs-barcodes-prefixes/guide-to-upcs) The first 6 to 10 digits are a GS1 Company Prefix, assigned by GS1 to the brand owner.[[1]](https://www.gs1us.org/upcs-barcodes-prefixes/guide-to-upcs) The first digit also serves as a number system character.[[1]](https://www.gs1us.org/upcs-barcodes-prefixes/guide-to-upcs)[[2]](https://en.wikipedia.org/wiki/Universal_Product_Code) The next 1 to 5 digits are an item reference number assigned by the brand owner.[[1]](https://www.gs1us.org/upcs-barcodes-prefixes/guide-to-upcs) The final digit is a check digit calculated from the preceding 11 digits.[[1]](https://www.gs1us.org/upcs-barcodes-prefixes/guide-to-upcs)

### Use

GS1 US calls UPC-A the flagship 12-digit format used predominantly by retailers throughout North America.[[1]](https://www.gs1us.org/upcs-barcodes-prefixes/guide-to-upcs) Validate the check digit as well as the length: a 12-digit number that fails it is a typo, a mangled code or not a UPC at all. (Meridian's view)

EAN-13 was developed as a superset of UPC-A, adding an extra digit to the beginning of every UPC-A number.[[2]](https://en.wikipedia.org/wiki/Universal_Product_Code) Every UPC-A converts to its EAN-13 equivalent by prepending a 0, and the check digit does not change.[[2]](https://en.wikipedia.org/wiki/Universal_Product_Code) When joining a UPC column to an EAN-13 or GTIN column, pad both to the same length with leading zeros before comparing them. (Meridian's view)

UPC-E is a shorter version of the UPC, developed for small packages where a full 12-digit barcode may not fit.[[2]](https://en.wikipedia.org/wiki/Universal_Product_Code) Wikipedia gives UPC-A 042100005264 as the equivalent of UPC-E 425261.[[2]](https://en.wikipedia.org/wiki/Universal_Product_Code) If six-digit codes sit among twelve-digit ones, some may be UPC-E and need expanding before they will match. (Meridian's view)

Excel automatically removes leading zeros, and Microsoft lists product codes among the data this affects.[[3]](https://support.microsoft.com/en-us/excel/keeping-leading-zeros-and-large-numbers) Microsoft suggests using Excel's Get \& Transform (Power Query) to format individual columns as text when importing data.[[3]](https://support.microsoft.com/en-us/excel/keeping-leading-zeros-and-large-numbers) Keep UPCs as text, never as integers, so that leading zeros survive. (Meridian's view) An 11-digit value in a UPC column has probably lost its leading zero, so pad it and test the check digit before rejecting it. (Meridian's view)

### Where you'll meet it

The USDA's FoodData Central branded food file has a gtin\_upc field, defined as the GTIN or UPC code identifying the food.[[4]](https://fdc.nal.usda.gov/docs/Download_Field_Descriptions_Oct2020.pdf) In that file, duplicate codes signify an update to the product, and the publication\_date field distinguishes when each update was published.[[4]](https://fdc.nal.usda.gov/docs/Download_Field_Descriptions_Oct2020.pdf)

## Sources

1. [What is a UPC Code? \| GS1 US](https://www.gs1us.org/upcs-barcodes-prefixes/guide-to-upcs) — organisation
2. [Universal Product Code](https://en.wikipedia.org/wiki/Universal_Product_Code) — secondary source
3. [Keeping leading zeros and large numbers](https://support.microsoft.com/en-us/excel/keeping-leading-zeros-and-large-numbers) — documentation
4. [FoodData Central Download Field Descriptions](https://fdc.nal.usda.gov/docs/Download_Field_Descriptions_Oct2020.pdf) — dataset
