Whenever you are paying for your purchases, be it at the supermarket, the convenience store or Uniqlo, the cashier will be scanning the barcodes to record your purchase. Many of us have wondered how this red beam of light manages to read the black bars. We will be breaking down how does the red light scan the barcodes.
How does a barcode reader read the barcodes?
Firstly, there is an organisation that regulates the barcode system. This organisation is called GS1, and thanks to them, the barcode system can read barcodes anywhere in the world. Secondly, the barcode is separated into black and white bars, not just black ones. There are a total of 95 black and white bars. The longer ones (total 11 bars) in the beginning, middle and end of the bar code splits the barcode into “left” and “right” for the machine to read.
As for the remaining 84 bars, it is divided into 12 times 7 bars, with every 7 bars representing a specific number for the machine to read. To make things even more complicated, there is a different combination of black and white bars on the left and right section of the barcode, which represent a specific number. Memorise the table below if you want to read your barcode next time.
However, this difference makes sense for the barcode reader. Your cashier does not always align, make sure the barcode is “upright” when scanning your item. To fix these issues, codes on the left still have an even number of white bars, and those on the right will have an odd number of white bars. By counting the number of white bars, the machine will know where to start reading from.
What do the numbers represent?
The first three digits are always country codes. These 3 numbers are the standardised form of where to product is from.
The 4th to 11th digit will be the company code + product code. This is also known as the company prefix and item reference number.
You can have anywhere from 1 to 7 digits for your company code and product code (which means there is an overlap). As expected, the shorter your company code is the more expensive it will be due to its limited availability. On the flip side, you have a lot more capacity for your product codes. In fact, it’s cheaper per universal product code (UPC) if the maximum capacity is utilised.
Depending on the number of products the business has in its inventory, it could be a wiser decision to get a shorter but more expensive company prefix upfront.
GS1 regulates the company codes, but the product code has no standardised format, so it is up to the company to decide. All they need to do is to register is in GS1’s database. As for the last digit, it is used as a checksum, to make sure the numbers barcode is “real” and the machine read it correctly.
The formula to check is as follows:
Step 1: Add up all the numbers in the odd position.
Step 2: Multiply the sum by 3.
Step 3: Add up all the numbers in the even number to step 2.
Step 4: Minus this from the nearest 10.
And that’s how the barcode reader translates the barcode into numbers.
Simple for a machine but not so easy for a human, huh?
This post is also available in: 简体中文 (Chinese (Simplified))