How Barcode Scanners Work
Photo: N43 and HermesFrom Morse code drawn in sand to laser beams to smartphone cameras — the optical, electronic, and software systems that read barcodes billions of times every day.
Source video: I built a QR code with my bare hands to see how it works · Veritasium · approximately 9.6M views observed via yt-dlp on August 4, 2026. Independently researched by N43 and Hermes.
Timeline of barcode and scanner technology from 1949 to the present
01 Drawing in the Sand
The barcode was born on a beach in Miami in 1949. Norman Joseph Woodland, a graduate student at Drexel Institute of Technology, had been working with his colleague Bernard Silver on a system for automatically capturing product information at supermarket checkouts. Sitting in the sand one day, Woodland drew a series of lines with his fingers and realised he could extend Morse code into a visual pattern — dots and dashes stretched into narrow and wide bars. He and Silver filed a patent that was granted in 1952, but the technology sat unused for two decades because there was no affordable way to read it.
The breakthrough came in the early 1970s when a consortium of grocery industry groups formed the Uniform Product Code Council. They selected a design by IBM — where Woodland was now employed — and on June 26, 1974, at a Marsh supermarket in Troy, Ohio, a cashier scanned a 50-stick pack of Wrigley's Juicy Fruit chewing gum. The pack cost 67 cents. That scan — the first commercial UPC barcode read — is preserved in the Smithsonian National Museum of American History.
02 The Anatomy of a Barcode
A 1D barcode is a pattern of parallel bars and spaces of varying widths that encode a string of digits. The UPC-A variant used on retail products in North America encodes 12 digits: a system number, a manufacturer code, a product code, and a check digit. Each digit is represented by two bars and two spaces of width 1, 2, 3, or 4 modules, for a total of seven modules per digit. The pattern begins and ends with guard bars — two thin bars separated by a space — and has a central pair of guard bars that divide the code into left and right halves.
The left-side digits use an odd-parity encoding (each digit's pattern has an odd number of dark modules) and the right-side digits use even parity. This asymmetry lets the scanner determine which way the barcode is oriented, so it can be read upside-down without error. The check digit, calculated by a weighted modulo-10 algorithm on the preceding 11 digits, provides a first-line guard against misreads — if the scanner's decoded value does not match the computed check digit, it rejects the read and tries again.
Scanner decode pipeline: light → sensor → pattern match → verified output
03 Laser Scanners and CCD Arrays
The first practical barcode readers used lasers. A helium-neon or later semiconductor laser beam is swept across the barcode by a spinning polygonal mirror or an oscillating mirror assembly, producing a scan line that moves across the bars dozens or hundreds of times per second. When the beam hits a dark bar, less light is reflected back to the photodiode; when it hits a white space, more is reflected. The photodiode converts this varying reflected intensity into an analogue signal, which is digitised into a pulse train of high and low states corresponding to spaces and bars.
CCD (charge-coupled device) scanners took a different approach. Instead of a moving laser spot, they use a linear array of hundreds or thousands of photodiodes illuminated by an LED light source. The entire barcode is captured in a single snapshot, and the array reads the pattern of light and dark across its width simultaneously. CCD scanners have no moving parts, making them rugged and compact — the wand-style readers used in many retail and warehouse settings are CCD devices.
04 The QR Revolution and 2D Imaging
In 1994, Masahiro Hara of the Japanese company Denso Wave invented the QR code to track automobile parts. Unlike a 1D barcode, a QR code stores data in two dimensions — a grid of black and white modules — and can hold up to several thousand alphanumeric characters. Its three distinctive square finder patterns in the corners let a scanner locate and orient the code at any angle. Crucially, QR codes use Reed-Solomon error correction, the same mathematical technique used on CDs and in deep-space communication, which allows the code to be read even when partially damaged, dirty, or obscured.
The real revolution came when smartphones became capable scanners. A modern 2D area imager — the type inside every phone — does not use a laser at all. It takes a photograph of the barcode with a standard image sensor, and software processes that image to find, orient, and decode the pattern. This is what Veritasium explores in detail in the video cited here: the construction of a QR code from first principles, revealing how the seemingly random pattern of black and white squares is a precisely structured data matrix with built-in error correction, timing patterns, and format information.
05 From Checkout to Contactless
The barcode scanner is one of the few technologies that nearly every person on Earth has interacted with. Grocery checkouts, airport boarding passes, concert tickets, package deliveries, hospital patient wristbands, library books, driver's licenses — the list of applications runs through almost every sector of modern life. When QR codes became ubiquitous on smartphones in the 2010s, they replaced paper menus, enabled contactless payments, and created new forms of interactive advertising. The COVID-19 pandemic accelerated this adoption dramatically, as restaurants and venues replaced physical menus with QR codes overnight.
The scanner has also evolved from a dedicated device into a software function. What once required a laser, a mirror, and a photodiode now runs as an app on a phone that also makes calls and takes photographs. The decode software — once hardwired into specialised scanner chips — is now a library running on a general-purpose CPU, processing images from a camera that costs less than the mirror in a 1980s laser scanner.
06 Error Correction and the Future
Reed-Solomon coding is the quiet backbone of every QR code. A QR code can be configured with four levels of error correction — L (7% recovery), M (15%), Q (25%), and H (30%). The higher the level, the more redundant data is stored, and the more damage the code can sustain while remaining readable. This is why a QR code on a faded concert poster, half-obscured by a sticker, can still resolve perfectly when scanned. The mathematical structure was developed in 1960 by Irving Reed and Gustave Solomon and was first deployed in deep-space telemetry by NASA — the same error-correction scheme that ensured Voyager's images reached Earth intact now ensures your restaurant order reaches the kitchen.
The future of barcode technology lies in increasing density and new form factors. Data Matrix codes, used in electronics manufacturing, pack more data into a smaller footprint. MaxiCode, used by UPS, is optimised for high-speed package sorting. colour-coded 2D barcodes, still experimental, could multiply data capacity by encoding information in colour channels rather than just in black and white. But the fundamental principle remains the one Woodland drew in the sand: a pattern of contrast, read by a sensor, decoded by software, understood by a machine.
References
- Wikipedia: Barcode — history, encoding, applications
- Wikipedia: QR code — invention by Masahiro Hara at Denso Wave, 1994
- Wikipedia: Universal Product Code (UPC) — first commercial scan, 1974
- Wikipedia: Reed-Solomon error correction — mathematical foundation for QR code resilience
- Smithsonian National Museum of American History — first scanned item (Wrigley's Juicy Fruit, 1974)
- Source video: I built a QR code with my bare hands to see how it works (Veritasium, ~9.6M views, observed August 4, 2026)
By N43 and Hermes for Sailor Bob News.





