A barcode scanner uses light to read printed lines and convert them into numbers your register can understand
A barcode scanner works by shining a beam of light across the black and white bars printed on a product or package. The scanner detects how much light bounces back from each bar — black bars absorb light, white bars reflect it. The scanner converts these light and dark patterns into electrical signals, which it then translates into the numbers and letters that appear below the barcode. Those numbers are sent to the register or computer, which looks them up in a database to find the product name, price, and inventory information.
The entire process takes less than a second. You do not need to scan a barcode perfectly straight or at a specific angle — most scanners can read a barcode from several directions and distances, which is why checkout lines move as quickly as they do.
Key Takeaways
- Barcode scanners use a light source and a sensor to detect the pattern of black and white bars, then convert that pattern into numbers.
- The numbers are sent to a database that matches them to product information, price, and inventory records.
- Most barcode scanners use either a laser or an LED light source, with laser scanners reading from farther away.
- The barcode itself contains no information about price or product name — it is only a unique identifier that points to a database record.
- Different barcode formats (UPC, EAN, Code 128) encode information differently, but all work on the same light-reflection principle.
How the light and sensor detect the barcode pattern
Inside a barcode scanner is a light source — either a laser or an LED — and a sensor that measures reflected light. When you pass the barcode in front of the scanner, the light bounces off the bars and spaces. Black bars absorb most of the light, so the sensor receives a weak signal. White spaces reflect the light, so the sensor receives a strong signal. The scanner reads this pattern of strong and weak signals as it moves across the barcode.
The sensor converts the light intensity into electrical pulses. A computer chip inside the scanner counts the width of each pulse and the space between pulses. Because barcode standards define exactly how wide each bar and space should be, the chip can determine which number or letter each bar pattern represents. Once the entire barcode has been read, the scanner sends the complete number string to the register or computer.
Laser scanners versus LED scanners
Laser scanners use a focused beam of laser light and can read barcodes from up to 24 inches away. They are common in grocery stores and retail environments where items move quickly across a checkout counter. The laser beam is narrow and precise, which allows the scanner to read even small or damaged barcodes. Laser scanners are also faster at reading multiple barcodes in succession.
LED scanners use a light-emitting diode instead of a laser and typically work from closer range — usually 2 to 6 inches. They are less expensive than laser scanners and are often built into handheld devices or mobile phones. LED scanners consume less power, which makes them better for battery-powered equipment. Both types work on the same principle; the difference is mainly in how far away the barcode can be and how much the scanner costs.
What the barcode number actually contains
The barcode itself is just a visual representation of a number. That number is a unique identifier — it does not contain information about price, product name, or where the item was made. Instead, the barcode number is a lookup key. When the scanner sends the number to the register, the register queries a database that says "barcode 012345678901 = one box of cereal, $3.99, item code 4521." If the database does not have that barcode, the register will not know what the item is, even though the scanner read it correctly.
This is why a product can have the same barcode in different stores but different prices. The barcode is the same; the database entry is different. It is also why a barcode can become invalid if a product is discontinued or if a retailer removes it from their system. The scanner and barcode work perfectly, but the lookup fails because the number no longer points to anything in that store's database.
Different barcode formats and how they differ
The most common barcode format in retail is UPC (Universal Product Code), which is 12 digits long and used primarily in North America. EAN (European Article Number) is 13 digits and used internationally. Both formats encode their numbers using the same light-reflection principle — the scanner does not care which format it is reading, as long as the bars and spaces follow the standard width rules for that format.
Code 128 is a different format used for shipping labels, inventory tracking, and warehouse management. It can encode letters, numbers, and symbols, whereas UPC and EAN encode only numbers. The scanner reads Code 128 the same way it reads UPC — by measuring bar and space widths — but the decoding rules are different because Code 128 uses a different set of bar patterns to represent each character.
A scanner designed for retail UPC barcodes can usually read EAN barcodes as well, because the hardware (light and sensor) is the same. However, a scanner may need to be configured to recognize which format it is reading, so it knows which decoding rules to explore. This is why some scanners have settings or require a setup barcode to be scanned before they will read a new format correctly.
Why some barcodes fail to scan
A barcode fails to scan when the scanner cannot detect a clear difference between the black bars and white spaces. This happens when the barcode is damaged, faded, or printed at the wrong size. If the bars are too thin, the scanner may not be able to distinguish one bar from the next. If the barcode is printed at an angle or curved around a rounded product, the light may not reflect evenly, and the sensor may miss parts of the pattern.
Dirt, dust, or a protective label over the barcode can also block the light. Some materials — like shiny or reflective surfaces — scatter light in ways that confuse the sensor. In these cases, the scanner may beep but send no data to the register, or it may send incomplete or incorrect data. A cashier will then have to manually enter the barcode number or look up the product another way.
How the register uses the barcode number after scanning
Once the scanner sends the barcode number to the register, the register's computer looks up that number in a local database or, in some cases, queries a central server. The database returns the product name, price, tax category, and current inventory count. The register displays the product name and price on the screen so the cashier can confirm the scan was correct. The price is added to the running total, and the inventory count is decremented by one.
Modern registers can also use barcode data for other purposes: tracking which items sell fastest, alerting staff when inventory is low, or flagging items that are on sale or require age verification. All of this happens because the barcode number is a key that unlocks information stored elsewhere. The barcode itself contains none of this information — it is only the address where the information lives.
Frequently Asked Questions
Can a barcode scanner read a barcode from a phone screen?
Yes, if the barcode is displayed clearly on a bright screen. The scanner reads the light and dark pattern the same way it reads a printed barcode. However, some phone screens do not display barcodes with enough contrast, or the screen brightness may be too low. A printed barcode is more reliable because the black ink and white paper create a sharper contrast.
What happens if two products have the same barcode?
This should not happen in a legitimate retail system. Each product is assigned a unique barcode by the manufacturer or distributor. If two products somehow have the same barcode, the register will ring up whichever product is in the database under that number, and the other product will be charged at the wrong price. This is a data error, not a scanner error.
Can a barcode scanner read upside down or sideways?
Most barcode scanners can read a barcode from multiple angles because they detect the pattern of bars and spaces regardless of direction. However, some older or simpler scanners may only read in one direction. Laser scanners at checkout counters are typically designed to read barcodes from several angles, which is why cashiers do not have to orient items perfectly.
Why do some barcodes have numbers printed below them?
The numbers below the barcode are a human-readable version of the same information encoded in the bars. If the scanner fails or the barcode is damaged, a cashier can manually type in those numbers. The numbers and the barcode represent the same product identifier — the barcode is just the machine-readable format.
Do barcode scanners work in bright sunlight?
Laser scanners can struggle in very bright sunlight because the ambient light can overwhelm the reflected signal from the barcode. LED scanners are less affected because they use a different light wavelength. In outdoor retail environments or warehouses with bright lighting, scanners may need to be positioned carefully or the barcode may need to be held closer to the scanner head.