Sanalda.comBETA

How does a barcode scanner read the bars?

Added: 3 November 2026

A barcode scanner measures changing reflected light from dark bars and light spaces, then interprets the pattern using a defined standard. Bar widths and order encode data. In many retail systems, the price comes from a database queried using that identifier.

Operating principle and essential concepts

1. Turning light into a signal A laser scanner may sweep a narrow beam across a code. Dark bars and lighter spaces reflect different amounts of light, which a detector converts into an electrical signal. An imaging scanner instead captures a picture with a camera-like sensor and processes its pixels. In both cases, the goal is to recover the sequence of bars and spaces reliably. Visible blackness alone is not a complete specification; reflectance at the illumination wavelength also influences whether the printed pattern can be detected. 2. Spaces carry information too Counting black bars does not decode a one-dimensional barcode. Relative bar and space widths, start and stop patterns, and the rules of the symbology all matter. Different barcode families follow different rules, so two patterns containing the same number of bars need not carry the same information. Clear regions around the code help separate it from surrounding print. Adding graphics too close to the bars or cropping the pattern can prevent automated reading even when a person can still read the accompanying number. 3. Product identifiers and prices Common GS1 retail barcodes encode a machine-readable trade-item identifier. Checkout software uses that identifier to retrieve a product record containing its name, price and other information. The same printed code may therefore correspond to different prices in different stores without the code itself changing. Some specialized formats can include weight, amount or other fields, so it is also incorrect to say that every barcode contains only one product number. Its defined data structure determines what the pattern is intended to represent.

Examples, measurement conditions and limitations

4. The role of a check digit Some numbering systems include a digit calculated from the other digits by a specified rule. A scanner or application can use it to detect some reading and entry errors. A check digit does not detect every possible error and is not a cryptographic signature. A mathematically valid code does not establish that a product is genuine: a copied valid pattern may also scan successfully. Authenticity and supply-chain verification require other mechanisms. A barcode’s basic purpose is to carry information in a standardized, machine-readable representation. 5. Why scanning sometimes fails Low contrast, scratches, tears, glare and unsuitable scaling can damage the pattern. Surface curvature and scanning angle can also matter. Enlarging an image does not repair distorted bar proportions. Sensor resolution and focus range impose further limits. Assessing print quality therefore requires more than checking whether one scanner reads the code once. Standards-based verification can examine pattern quality at different locations as well as the structure of the encoded information. A successful isolated scan is useful evidence, but is not a complete quality assessment. 6. The connection with QR codes Two-dimensional symbols such as QR codes use a pattern in two axes rather than encoding only through horizontal bar widths. They can have different capacity and error-correction methods. This does not make every decoded link safe: interpreting a symbol does not verify the trustworthiness of the address inside it. The science involves three distinct stages: detecting a pattern optically, decoding data according to rules, and interpreting that data through another system. Keeping those stages separate explains what the scanner measures and what subsequent software supplies.

Related topics

How do white dwarfs form?Why does limescale accumulate in a kettle?What is a phase-change material used for?What are meteors and meteorites?How does a solar storm affect Earth?Why is Earth's core hot?How does peer review work?What do probiotics do?Is the Moon moving away from Earth?How do hailstones grow?How does generative AI work?Why does apoptosis remove cells in a controlled way?What does serotonin do?How do genes influence height?How are potentially hazardous asteroids detected?Where is the Kuiper Belt?What does pH indicate?Why was Pluto reclassified as a dwarf planet?How does an infrared thermometer measure temperature from a distance?How does a fusion reactor work?Why does fatigue fracture occur?How is circadian rhythm regulated?Why can humans not normally hear ultrasound?What is thermodynamics?What is gravity?Why do stars twinkle?Why is yawning contagious?What does nanotechnology mean?How does herd immunity develop?Can volcanoes trigger earthquakes?
Revision history

3 November 2026 — Article added.