Guide · The bars
How a barcode spells a number
A barcode is the same number printed twice: once in digits for people, and once in bars for a machine. Here is how the bars do it.
The code on almost everything
GS1 Australia describes a barcode as another way of writing numbers and letters, one a machine can read rather than a person. The one on most shop products is the EAN-13. It carries a 13-digit number that GS1 calls a GTIN-13, and it is the usual choice outside North America.
GS1 says this family of barcodes is the oldest and most widely used it looks after, printed on nearly every consumer product in the world. A smaller version, the EAN-8, fits packs too small for the full code. North America mostly uses the UPC-A, which carries 12 digits.
Ninety-five modules
Look closely and the code is a row of 95 equal strips, called modules, each either black or white. Three of the patterns are fixed and mark the code’s edges and middle: 101 at the start, 01010 in the centre and 101 at the end. In the drawing they stand a little taller than the rest, in pink.
That leaves 84 modules, or 42 on each side, and each digit takes seven. Every digit is drawn as two black bars and two white spaces, and each bar or space is between one and four modules wide.
Two halves, read either way
The 13 digits fall into three groups: the first digit, then six on the left and six on the right. The right-hand six always use one set of patterns, the same set a UPC uses.
The left-hand six each have two ways to be drawn, one with an odd number of black modules and one with an even number. Because the left half always opens with an odd pattern and the right half with an even one, a scanner can tell which way round it is reading and read the code backwards just as well.
The digit with no bars
The first digit is never drawn as bars. It is spelled by the mix of odd and even patterns the left six use. A first digit of 9, as on the box on this site, gives the mix odd, even, even, odd, even, odd. A first digit of 0 means every left-hand pattern is odd, which is why every UPC is also an EAN-13 that starts with 0.
You will see the first digit printed out on its own, just left of the bars, in the clear margin around the code.
Who gives out the number
After the prefix comes a company number, handed out by the organisation the prefix names. After that the company numbers its own products. The last digit is a check on all the others, worked out from them by a fixed sum, explained in the next guide.
How big it is
For the UPC-A at its standard size, one module is 0.33 mm wide and the whole symbol stands 25.9 mm tall.