# Chapter 2. Zero-Compressed UPC ⇒ UPC-E

Abstract

To allow the use of UPC barcodes on smaller packages where a full 12-digit barcode may not fit, a 'zero-compressed' version of UPC was developed called UPC-E.

This symbology differs from UPC-A in that it only uses a 6-digit code, does not use middle guard bars, and the end bit pattern (E) becomes 010101.

The way in which a 6-digit UPC-E relates to a 12-digit UPC-A is determined by the last (right-hand most) digit. With the manufacturer code represented by X's, and product code by N's then:

Last digit UPC-E equivalent is UPC-A equivalent is
0 XXNNN0 0XX000-00NNN + check
1 XXNNN1 0XX100-00NNN + check
2 XXNNN2 0XX200-00NNN + check
3 XXXNN3 0XXX00-000NN + check
4 XXXXN4 0XXXX0-0000N + check
5 XXXXX5 0XXXXX-00005 + check
6 XXXXX6 0XXXXX-00006 + check
7 XXXXX7 0XXXXX-00007 + check
8 XXXXX8 0XXXXX-00008 + check
9 XXXXX9 0XXXXX-00009 + check

For example a UPC-E barcode with the number 654321 would expand to the UPC-A 065100004327. You can convert UPC-E back to UPC-A using this web utility.

UPC-E check digits are calculated using this expanded string in the same way as used by UPC-A. The resulting check digit is not added to the barcode, however, but is encoded by manipulating the parity of the six digits which are present in the UPC-E - as shown in the following tables:

Check digit Parity pattern
0 EEEOOO
1 EEOEOO
2 EEOOEO
3 EEOOOE
4 EOEEOO
5 EOOEEO
6 EOOOEE
7 EOEOEO
8 EOEOOE
9 EOOEOE

Digit to be encoded Odd parity pattern Even parity pattern
0 3-2-1-1 1-1-2-3
1 2-2-2-1 1-2-2-2
2 2-1-2-2 2-2-1-2
3 1-4-1-1 1-1-4-1
4 1-1-3-2 2-3-1-1
5 1-2-3-1 1-3-2-1
6 1-1-1-4 4-1-1-1
7 1-3-1-2 2-1-3-1
8 1-2-1-3 3-1-2-1
9 3-1-1-2 2-1-1-3

Our example code 654321, therefore, would become 1-1-1 4-1-1-1 1-2-3-1 2-3-1-1 1-4-1-1 2-2-1-2 2-2-2-1 1-1-1-1-1-1. The resulting barcode would look roughly like this: