Cover of The Barcode: Line, Light, Ledger, a book by Ketineni RamaraoFrom the book The Barcode: Line, Light, Ledger
Chapters 15 and 16. Read the full book free as a PDF.

Why the stripes hit a wall

A linear barcode's message runs along one axis; adding data makes it longer, and the Japan Patent Office's own history puts the practical ceiling at about twenty alphanumeric characters. By the early 1990s, industry wanted more: a whole manifest in one mark, component histories on thumbnail-sized parts, marks that survive damage that would kill a line of stripes, and, for Japanese users, kanji. Two families of two-dimensional code answered: stacked codes like PDF417, literally a pile of tiny one-dimensional rows, and matrix codes, fields of cells read like a chessboard by a camera: UPS's MaxiCode, Data Matrix etched onto circuit boards and surgical tools, the Aztec code on rail and airline tickets.

The factory problem: speed

In the early 1990s DENSO, a Toyota-group components maker hunting for business after Japan's bubble collapsed, tracked parts with barcodes and chafed at the limits: twenty characters per code, several scans per part, no kanji. An engineer named Masahiro Hara concluded that one-dimensional codes were approaching a wall and set out to build a two-dimensional code readable at high speed. The design problem was finding the symbol instantly, at any angle, on parts moving past. Hara's team hunted for a position-detection pattern that almost never occurs in print or nature and settled on the square-within-a-square with a 1:1:3:1:1 run-length ratio across its centre: the three finder squares you see in every QR code's corners. Software locates them, squares up the grid and orients the code in a fraction of a second.

A QR code symbol with its three finder squares, timing patterns and data region
A QR code. Three finder squares set orientation; timing patterns set the grid; the rest is data plus error correction. Symbol: public domain.

The grid and its insurance

Around the anchors, the data lives in a grid of modules that grows by fours, from 21 by 21 to 177 by 177. At the extreme a single symbol holds up to 7,089 numeric characters, 4,296 alphanumeric characters or 1,817 kanji. Timing patterns, the alternating cells running between the finder squares, establish the grid so warped or angled images can be corrected. And the code carries deliberate redundancy: four selectable error-correction levels restore roughly 7, 15, 25 or 30 percent of codewords, which is why a QR code can be torn, stained or partly covered and still decode, and why a logo can sit in the middle of one. Up to sixteen symbols can be chained with structured append for very long messages.

Camera and correction: the two gifts

Two gifts made the matrix codes practical. The first was the camera: by the early 1990s solid-state image sensors were cheap enough to put inside scanners, and a camera, unlike a sweeping laser, sees the whole symbol at once, so software can recover orientation and work around damage. The second was error correction, borrowed from the mathematics of data transmission: matrix codes write their data with deliberate redundancy, so a symbol can be torn, stained or partly missing and still decode. The QR code, the most successful of them all, carries both gifts furthest.

The waiver that made a standard

DENSO WAVE then made the decision that turned a good product into a world standard: it published the specification and waived its patent rights for standardized use, so anyone could print or read QR codes without a license. The code became an AIM standard in 1997, a Japanese industrial standard in 1999, and ISO/IEC 18004 in June 2000. Japanese industry adopted it first for its intended purpose, parts traceability; Japanese camera phones carried it to the public around the turn of the century.

The second act

Global ubiquity arrived with the smartphone and mobile payment. A QR code costs nothing to print and any camera phone can read one, so the code became the world's cheapest point-of-sale terminal: QR-based payment grew through the 2010s into a dominant way of paying for daily life in China and ran through India's UPI system, while the pandemic scattered QR menus, tickets and check-ins across the rest of the world. A symbol built to track carburetors became the most democratized piece of financial infrastructure ever printed, and GS1's Sunrise 2027 program, the plan to move the retail checkout beyond exclusive reliance on stripes, is built substantially on the square Hara's team designed for the factory floor.

Quick answers

What are the three squares in a QR code for?

They are finder patterns: the 1:1:3:1:1 square-in-square ratio almost never occurs in print or nature, so software can locate, orient and square up the code in a fraction of a second, at any angle.

How much data can a QR code hold?

The largest version, a 177 by 177 grid, holds up to 7,089 numeric characters, 4,296 alphanumeric characters or 1,817 kanji. Capacity grows in steps of four modules per side from the 21 by 21 minimum.

Why does a damaged QR code still scan?

Built-in error correction. Four selectable levels let the decoder restore roughly 7, 15, 25 or 30 percent of the symbol's codewords, so torn, stained or partly covered codes still read.

Sources

Invention history and the 1:1:3:1:1 finder ratio per the Japan Patent Office's DENSO profile. Capacities, versions, error-correction levels and standardization dates per DENSO WAVE's own pages. Payment-adoption claims are qualitative per the book.

More from this book

Mechanism · From the book The Barcode: Line, Light, Ledger

How barcodes work

Everything a linear barcode says is said with one trick: time.

Mechanism · From the book The Barcode: Line, Light, Ledger

How barcode scanners work

A barcode is a promise between two machines: the one that prints it and the one that reads it.

History · From the book The Barcode: Line, Light, Ledger

History of the barcode

The barcode was invented in 1949 and mattered in 1974.