UPC / EAN Barcode FAQ & Tutorial
UPC/EAN Overview & Standards
The UPC and EAN barcodes have been in use since the 1970s to encode Global Trade Item Numbers (GTIN), which uniquely identify a product for retail checkout or tracking purposes. UPC, UCC, EAN, JAN, GTIN-8, GTIN-12 and GTIN-13, ISBN and Bookland barcodes are all created from the same symbology type, commonly known as the UPC/EAN barcode. GS1 DataBar (formerly RSS-14) is a smaller and more advanced barcode type that may be used in retail checkout systems after January 1, 2010.
To be fully GTIN compliant, all UPC and EAN numbers should be stored in databases as 14-digit numbers and filled in with zeros for the spaces to the left as shown in Fig: 1. For example, a UPC-A barcode of 123456789012 would be represented as 00123456789012 in the database of a GTIN compliant system. When encoding complete GTIN-14 numbers, GS1 DataBar should be used. DataBar Expanded should be used when it is necessary to encode additional information such as weight, expiration dates and country of origin or serial numbers.
* GS1 DataBar (previously known as RSS-14) barcode encodes 13 digits with the required AI of 01 and a DataBar check digit. The last digit of the GTIN-14 is a MOD 10 check digit and is not encoded in the DataBar symbology. If the full 14-digit GTIN is needed after reading the symbol, it may be generated with a MOD10 calculation. The GS1 DataBar Barcode Symbology may be used in all retail checkout systems after January 1, 2010.
** The UPC-E number of 02349036 displayed in the barcode equals the 00023400000900 UPC-A number after it is expanded by the UPCE suppression rules. Visual Basic source code to the compression algorithm may be obtained by examining the UPCe7To11 function in the IDAutomation Visual Basic Source Code, which is used to automate printing for the IDAutomation UPC Barcode Font.
Printing UPC & EAN Barcodes
Several Barcode Integration Guides are available that suggest one or more barcode printing options. These integration options should be examined to determine whether to use barcode components, applications or fonts for the printing of barcodes. A few of the Barcode Integration Guides offered include the following:
The IDAutomation UPC/EAN Font Advantage Package is a single font used to create all UPC-A, UPC-E, EAN-8, EAN-13, JAN, ISBN and Bookland barcodes. The font meets ANSI, ISO and IEC 2000 specifications (ISO 15420:2000) and is supplied with several barcode font tools, plug-ins and source code samples for easy application integration. When creating a single barcode, the online font encoder may be easily used with the UPC/EAN Barcode Font.
IDAutomation offers many other barcode generation products. For a thorough evaluation of these products, visit the Barcoding for Beginners FAQ & Tutorial.
Reading or Scanning UPC/EAN Barcodes
The most common method of reading barcodes is with a barcode scanner. Most barcode scanners recommended by IDAutomation perform keyboard emulation and receive power from the USB port, so that no external power supply is required. When a barcode is scanned using keyboard emulation, the scanned data appears at the cursor as if it had been entered from the keyboard.
Most barcode scanners have the ability to read UPC and EAN barcodes by default, such as the hand-held IDAutomation USB Barcode Scanner with DataBar. This scanner dependably reads the IDAutomation UPC/EAN Font when printed at any size allowed by GS1, which is from 12 to 32 points.
UPC & EAN Character Sets
The character set for this symbology is best described by viewing the UPC/EAN Barcode Font Specifications. This site demonstrates how the symbols are created from the characters found in the different character sets.
For easy application integration, IDAutomation provides several Font Tools that are free to use with IDAutomation barcode fonts. Therefore, references to the character sets should not be necessary. When creating a single barcode, IDAutomation recommends using the Online Barcode Font Encoder.
MOD 10 Check Character Calculation
The check digit is also referred to as the check character and checksum, and it is always the last digit in the GTIN number. The manual calculations described below are rarely necessary because IDAutomation provides several font tools, plug-ins and source code samples that are free to use with IDAutomation fonts, which automatically format text to the barcode fonts. Additionally, the check digit option in all components and applications calculates and includes the checksum automatically.
A modulus 10 check digit is used for consistency verification in all UPC-A, UPC-E, EAN-13 and EAN-8 barcode types. The check digit calculation for UPC-E requires the original UPC-A number.
The UPC/EAN system uses a unique process to determine the check digit, which is determined by the following modulus 10 algorithm:
The following Visual Basic code is an example of calculating the MOD10 check digit:Factor = 3
WeightedTotal = 0
For I = Len(DataToEncode) To 1 Step -1
CurrentCharNum = Mid(DataToEncode, I, 1)
WeightedTotal = WeightedTotal + (CurrentCharNum * Factor)
Factor = 4 - Factor
I = (WeightedTotal Mod 10)
If I <> 0 Then
CheckDigit = (10 - I)
CheckDigit = 0
Related Information Links