UPC | EAN Barcode FAQ & Tutorial

Barcode Information | Tutorials | Examples

UPC | EAN Overview | Standards

UPC/EAN BarcodeThe 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.

Consider the Benefits of GS1 DataBar

GS1 DataBar is a barcode type that works just like UPC and EAN barcodes, with enhanced capability. POS systems have been required by GS1 to read DataBar symbols since 2010. The benefits of using DataBar instead of UPC and EAN include:

  • DataBar can be used anywhere UPC POS barcodes are used.
  • Smaller size and quicker scanning.
  • Traceability and product recall capabilities.
  • Better sell-by and expiration date management.
  • Ability to lower food waste.
  • Less chance of scan errors than UPC and EAN symbols.
GTIN Compliance

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.

Fig: 1. The various types of UPC and EAN barcodes with their GTIN capability. The portion of the GTIN displayed in green is what the associated symbol cannot encode.

 Barcode TypeGTIN TypeGTIN StorageBarcode Example
 EAN-8GTIN-800000012345670EAN8
 UPC-AGTIN-1200123456789012UPC/EAN Barcode
 UPC-EGTIN-1200023400000900**UPCe
 EAN-13, JAN, ISBN, ISSN and BooklandGTIN-1301234567890128EAN13
 GS1 DataBar *GTIN-1400123456789012GS1 Databar
 GS1 DataMatrixGTIN-1400012345678905GS1 DataMatrix

* GS1 DataBar (previously known as RSS) 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 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 (VBA) source code to the compression algorithm may be obtained by examining the UPCe7To11 function included with any license purchase of 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:

Featured Product:

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 encoders, 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 Encoders 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 encoders, 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:

  1. Add up the odd numbers (the rightmost character is odd) in the digits and multiply them by 3.
  2. Add up the even numbers.
  3. The check digit is obtained by determining the smallest number, that when added to the sum of steps 1 and 2, will produce a multiple of 10. For example, the check digit for a UPC-A number of 12345678901 is 2 because (3*(1+3+5+7+9+1))+(2+4+6+8+0) = 98 and 98 + 2 =100.
  4. The check digit may be verified online by choosing the “MOD10” button on our barcode font encoder.

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
Next I
I = (WeightedTotal Mod 10)
If I <> 0 Then
CheckDigit = (10 - I)
Else
CheckDigit = 0
End If

This Check Digit calculation may be tested by entering the number into IDAutomation’s Online Font Encoder and choosing the MOD 10 option. GS1 also offers an online GTIN check digit calculator.

Related Information Links