← Science & Technology

How Barcodes Work

What the stripes and numbers on a package mean and how a scanner uses them to identify a product.

How Barcodes Work

A barcode seems to be a simple combination of black stripes and numbers. However, behind this image there is a whole system that allows stores to recognize the product in a split second, find it in the database and add the purchase to the check. To understand the principle of operation, you need to understand what exactly is encrypted in strips and how the scanner light turns them into numbers.

1. What is a barcode?

What is a barcode?

A barcode is a graphical representation of information intended for automatic reading by a special device. The most common variant on products in European stores is EAN-13, consisting of 13 digits.

A - Prefix GS1 The first digits refer to the GS1 prefix, which is associated with the GS1 organization that issued the number. It can often be used to determine which country/organization GS1 issued the number, but it is not necessarily the country of manufacture.

B – Company Code (GS1 Company Prefix) The next part of the number identifies the company or organization that owns this range of numbers. The number of numbers in this part can be different.

C - Product Code (Item Reference) This part is assigned by the company itself for a specific product. For example, different sizes, volumes, tastes or patterns may have different numbers. The numbers themselves do not have to contain encrypted information about the product – it is just a unique identifier.

D – Check Digit (check number) The last 13th digit is calculated mathematically based on the previous 12 digits. The scanner uses it to check if the barcode is correctly read and drawn up.

Black stripes and white gaps have different widths. Their location corresponds to a specific sequence that the scanner can recognize.

The barcode itself does not usually contain the price of the goods. It is the identifier by which the computer finds information about the product in the database of the store.

2. What the numbers under the stripes mean

A number of digits are usually printed under the barcode. EAN-13 has thirteen.

They are used to identify goods and are associated with the GS1 system, an international organization that deals with product identification standards.

Depending on the specific code, digits can denote a part associated with an organization or company, a number of a particular product, and a check digit.

3. Why are the stripes of different thicknesses?

Black bands and white spaces are elements of a specific coding system.

The scanner measures the sequence of transitions between dark and light areas. Differences in their width make it possible to define encoded characters.

Therefore, the barcode cannot simply be replaced with arbitrary black stripes. For each set of digits, there is a certain structure.

In addition, at the edges of the barcode leave a free light space. It is called a “quiet zone” and helps the scanner determine the boundaries of the code.

4. What happens when we bring a product to the scanner

What happens when we bring a product to the scanner

At the time of scanning, the device directs light to the barcode.

Older and some specialized systems use a laser for this purpose. Modern scanners often use LEDs and cameras.

The white barcodes reflect much of the light back, and the black ones absorb more light.

The result is a rapidly changing sequence: light - dark - light - darkness.

It is these changes that the reader fixes.

5. How light turns into numbers

How light turns into numbers

Inside the scanner is a light-sensitive element. It records the amount of reflected light and converts it into an electrical signal.

When the beam passes through a white area, there is more reflected light. When it hits the black stripe, less light returns.

Electronics analyze these changes and define the boundaries between bands and gaps.

Then, a special algorithm compares the resulting sequence with the rules of the EAN-13 standard and restores the original numbers.

6. Why a scanner can read code from different angles

Modern scanners do not usually require the barcode to be set strictly vertically or horizontally.

Laser devices create scan lines, and camera scanners actually take a barcode image and analyze it programmatically.

Therefore, it is enough for the code to get into the reading area.

At the cash registers, the device itself may have several scanning directions. Thanks to this, the goods can be carried through it at almost any convenient angle.

7. What happens after reading

After recognizing the barcode, the scanner transfers the received number to the cash register.

For example, the system receives a certain sequence of numbers. The computer uses it as a database request.

The database contains information about the relevant product: its name, price, category, taxes, discounts and other parameters.

Therefore, the cashier sees on the screen no longer a set of numbers, but a specific product and its value.

8. Why price changes don’t require a new barcode

Let’s say that the store sold an item for 50 kroner and then set a price of 45 kroner.

The barcode itself does not need to be changed.

It continues to refer to the same product. The store simply changes the price information in its computer system.

On the next scan, the cashier again receives the same number, accesses the database and already sees a new price.

That is why the same barcode can remain on the package throughout the period of release.

9. What happens if the barcode is damaged?

If several bands are damaged or part of the image is closed, the scanner may not recognize the code.

However, a small damage does not always mean that the goods cannot be broken. Systems use the structure of the code itself and a check digit to detect errors.

If the reading still fails, the cashier can enter the numbers manually.

In addition, in modern stores, two-dimensional codes are increasingly used, for example QR codes. Unlike conventional linear barcodes, they are capable of storing significantly more information.

10. Why barcodes have become important for trading

Before the advent of automatic scanning, store staff had to enter significantly more information manually. The barcode allowed to automate the identification of goods and significantly speed up purchase processing.

Today, barcodes are not only used at cash registers. They help to account for goods in warehouses, track the movement of products, manage inventories and automate logistics.

The idea remains simple: the barcode turns product information into a sequence that the machine can quickly read, and the computer already associates this sequence with the desired data.