How to bar codes work?

“The first time an item was sold using a barcode was 43 years ago, in 1974. What was the item?” The answer to this ridiculously difficult pub quiz question can be found at the end of this post…

Barcodes are so ubiquitous today that you can be forgiven for not considering how they actually work. Fortunately, a number of websites exist that are happy to share all (such as And thanks to the Core Maths Support Programme as well as the CIMT, there are also teaching resources that help students to explore the mathematics behind barcodes in lessons.

In essence, a typical barcode has 12 digits that can be split into 4 groups. The first digit tells you the type of product, the next five identify the manufacturer and the next five tell you the product code. The final digit is the ‘check digit’.

To check the number had been read correctly, the barcode scanner sums the digits in the odd positions, and multiplies by three. The values of the numbers in the even positions are then added to this total. The check digit is the value required to take this figure to the nearest multiple of ten. If this calculation doesn’t give a multiple of ten, the scanner won’t scan the item.

Have a go yourself, what value should the check digit take in the following bar code?

9 12345 12345 X

The Core Maths resource “barcodes” explores these ideas and more, and can be found here: The original Centre for Innovation of Maths Teaching resource can be found here on the STEM Learning site (and on the CIMT site here).

Did you get the check digit in the example above as three? As for the pub quiz question, the first barcoded item ever sold was a packet of Wrigley’s chewing gum, for more detail on this, here’s James May explaining all:

Age11-14, 14-16, 16-19, FE/HE
Report inappropriate content 


Sign in to post comments