A supermarket scanner does not see numbers. It sees a rapid flicker of light: bright where the beam lands on a pale space, dim where it crosses a dark bar. Everything a checkout terminal knows about a product begins as that pattern of brightness over time. Turning it into a product number is a small chain of physical measurement, simple logic, and error checking, and each link was designed so that a smudged or crumpled label still produces the right answer, or none at all.
The retail symbol most people know is the Universal Product Code, or UPC, with its close relative the European Article Number. Both are linear, or one-dimensional, symbols: information runs along a single line, and the height of the bars only makes the label easier to hit. This is the essential difference from the square grids described in how a QR code stores information, which store data across two dimensions.
How a Scanner Reads the Bars
A traditional scanner contains a laser diode and a moving mirror or spinning polygon that sweeps a red beam across the label in a set of crossing lines, so that at least one line passes over the whole symbol whatever the angle. A photodiode watches the reflected light. Pale spaces scatter much of the beam back; black bars absorb it. The photodiode's output is therefore a waveform that rises and falls as the beam moves.
The electronics convert that waveform into a stream of widths by timing how long the signal stays high or low. Crucially, the scanner does not need to know how fast the beam is moving or how large the label is. It compares widths with one another. A bar that lasts twice as long as its neighbor is twice as wide, regardless of the sweep speed or the label's size. This is why the same code can be printed small on a candy wrapper or large on a carton and remain readable.
Newer scanners often use a small camera instead of a laser. The sensor captures a picture, and software finds the parallel bar edges in the image and measures their spacing. The principles of the resulting measurement are the same, although the light is captured all at once, as described in how digital camera sensors capture images.
What the Bars Mean
In a UPC-A symbol, each digit occupies seven equal-width units, called modules, made up of two bars and two spaces of varying widths. Each bar or space can be one to four modules wide. Because there are only ten digits, a compact table maps each pattern to a digit, and the scanner matches the measured widths against that table.
Two clever details make reading robust. First, the left half and right half of the number use different, complementary encodings. That lets the scanner tell which half it is reading, and therefore recognize a label that is upside down and read it correctly. Second, special guard patterns at the ends and in the middle, made of narrow bars and spaces, mark where the digits begin and help the scanner calibrate. A blank margin, the quiet zone, must surround the symbol, so that the scanner can tell where the bars start.
A UPC-A carries twelve digits, and the last is not part of the product's identity at all. It is a check digit.
Why the Check Digit Matters
The check digit is computed from the other eleven. To calculate it, the digits in odd positions are multiplied by three, the digits in even positions are added as they are, and the result is used to find the number that brings the total to a multiple of ten. Written another way, the weighted sum of all twelve digits, with weights alternating three and one, must end in zero.
When the scanner reads a label, it repeats the calculation. If the result is not zero, the read is discarded and the beam sweeps again. This catches every mistake in a single digit, because changing any one digit changes the weighted sum in a way that cannot be canceled by the weights. It also catches most swaps of neighboring digits. The exception is a swap of two digits that differ by exactly five, such as 0 and 5, where the alternating weights produce compensating changes. The scheme is a compromise: it costs one digit and catches the vast majority of realistic errors, without any need to send the data anywhere else.
The number itself is only an identifier. The barcode does not contain the product's name or price. The checkout system looks the number up in a database and retrieves whatever the store has stored for it, which is why a store can change a price without changing the label.
A Short History
The idea came from Joe Woodland, who in 1949 drew four lines in the sand on a Miami beach while thinking about the dots and dashes of Morse code. He and Bernard Silver filed a patent that year, granted in 1952, covering linear and circular designs. The prototype, which used a powerful lamp and an oscilloscope, was too far ahead of the hardware of its time.
Two developments changed that. The laser, demonstrated by Theodore Maiman in 1960, provided a concentrated beam that could sweep bars quickly. Cheaper electronics made the decoding practical. In the early 1970s, grocery industry groups chose a standard, and in 1973 the rectangular design proposed by IBM's George Laurer was approved over a circular bull's-eye alternative. On June 26, 1974, at a Marsh supermarket in Troy, Ohio, a multipack of chewing gum became the first item sold using a scanner reading the new code.
Everyday Misconceptions
Barcodes are often said to track people or hold hidden personal data. A standard retail symbol holds only a number, and it works the same way for every unit of that product. Systems that follow individual items use different technologies, or add serial numbers to a more elaborate symbol.
Another misconception is that a damaged label fails because the scanner cannot see it. More often the scanner sees it too well: a crease or a scuff changes the measured widths slightly, the check digit fails, and the scanner refuses the result rather than guess. That is a feature. A refusal is far cheaper than charging for the wrong item. The same logic of adding a little redundancy to catch errors underlies the much stronger methods discussed in how file compression shrinks files, where the aim is the opposite: removing redundancy.
In Short
A barcode scanner converts bright and dark stripes into a timed signal, compares the widths of the bars, matches them to a digit table, and verifies the result with a check digit. Nothing about the process depends on knowing the size of the label or the speed of the beam, only the ratios between bars. The design that emerged from a sketch on a beach and a supermarket in Ohio in 1974 remains a model of engineering that trades a little extra data for dependable reads.




