Technology
How does a barcode work?
A barcode works by encoding a number as a pattern of black bars and white spaces of varying widths. A scanner shines light across it, measures the reflected pattern, and decodes it into the digits that identify the product.
See it in motion.
Watch a 2-minute animated lesson that shows exactly how a barcode works.
Step by step
- 1The bars and spaces represent digits; their widths form the code.
- 2A scanner's light reflects off the white spaces and is absorbed by the black bars.
- 3A sensor reads the pattern of reflections and converts it back to the number.
- 4That number is looked up in a database to find the product, price, and details.
- 52D codes like QR codes store far more data in a grid of squares.
Frequently asked questions
- What do the numbers under a barcode mean?
- They identify the manufacturer and product. The barcode is just a machine-readable version of those digits so a scanner can read them instantly.
- Does the barcode contain the price?
- Usually not — it holds a product ID. The price lives in the store's database and is looked up when the code is scanned, so prices can change without reprinting labels.
- How is a QR code different from a barcode?
- A barcode is one-dimensional (lines) and stores a small number; a QR code is two-dimensional (a grid) and can hold much more, like links and text.

