Explainer
What is a QR code?
A QR code is a two-dimensional barcode that stores text as a grid of black and white squares. This guide takes one apart — the corner markers, the data area, the repair information — and explains why that structure decides how much you can encode.
Updated
A QR code is a grid of black and white squares that stores a short piece of text. Point a camera at it, and software finds the grid in the image, reads the squares as ones and zeros, reassembles the original characters, and hands them to whatever app knows what to do with them. That is the whole mechanism. The name is short for Quick Response, which was a promise about decoding speed rather than about anything you do with it.
The format arrived in 1994 at Denso Wave, a Toyota subsidiary, because ordinary barcodes had run out of room. A standard retail barcode holds about twenty digits and can only be read along one axis, so a scanner has to be lined up with it. Assembly lines needed to track more information than that, from parts moving past at awkward angles. Adding a second dimension solved both problems at once: data stacked in two directions instead of one, and a shape distinctive enough that software could locate and straighten it without human help.
The parts of the pattern
Look at any code and the first thing you notice is the three large squares in the corners. Those are finder patterns, and they exist so that software can answer “is there a code in this photo, and which way up is it” before trying to read anything. Each one is a ring structure whose ratio of dark to light bands is the same when scanned through the middle along any line. That ratio is rare in ordinary photographs, so scanning software can sweep an image for it cheaply. Three corners rather than four is deliberate — the missing fourth corner tells the decoder the code’s rotation.
Between and around those corners sit several smaller structures. Timing patterns, the alternating dark and light line running between two finder patterns, let the decoder work out how wide one square is in this particular photograph, which is what makes scanning at an angle possible. Alignment patterns, the smaller rings that appear once the code passes a certain size, correct for the way a curved or tilted surface distorts the grid. Format information, tucked beside the finder patterns, records the error correction level and the mask pattern so the decoder knows how to interpret the rest.
Everything left over is the data area, filled in a zigzag from the bottom right corner upward. Individual squares are called modules, and the count along one edge is what the specification calls the version. Version 1 is 21 modules square; version 40 is 177. Each step up adds four modules to a side.
How characters become squares
Before anything is drawn, the encoder picks a mode based on what you gave it. Numeric mode packs three digits into ten bits, which is why a phone number encodes far more compactly than it looks. Alphanumeric mode covers digits, uppercase letters and nine punctuation marks at eleven bits per two characters. Byte mode handles everything else, including lowercase letters, at eight bits per character. There is a fourth mode for Kanji, inherited from the format’s Japanese origins.
That hierarchy has a practical consequence people rarely expect. A URL typed in
uppercase can qualify for alphanumeric mode and produce a visibly smaller grid
than the same URL in lowercase, which forces byte mode. Domain names are
case-insensitive, so HTTPS://EXAMPLE.COM/OFFER and its lowercase twin reach the
same page while the uppercase one encodes in noticeably fewer bits. The path
after the domain usually is case-sensitive, so this only helps when the path is
short or absent.
The repair information
A meaningful share of every code is not your data at all. It is Reed–Solomon error correction: extra symbols calculated from the data, arranged so that a decoder can rebuild the original even when part of it is unreadable. You choose how much of this to include, and the choice trades capacity against durability. Getting that trade-off right is the single most consequential decision when generating a code, and it has its own guide.
Error correction is also why a logo can sit in the middle of a code without breaking it. The logo is not “supported” by the format in any way — it simply destroys some modules, and the redundancy quietly repairs them. Push past what the redundancy can absorb and the code stops working, with no warning at the moment you generate it.
Quiet zone
The specification requires a clear margin of four modules on every side, called the quiet zone. It is not decoration. The decoder uses that margin to work out where the code ends and the background begins, and a code butted against a border, a photograph or a block of text frequently fails for this reason alone. It is the most common avoidable mistake in printed material, and it usually survives testing because the designer scans the file on screen, where the white page provides a margin the printed layout does not.
Static and dynamic
Everything described so far is a static code: the characters live in the pattern, permanently. The alternative encodes a short link belonging to a redirect service, which forwards visitors to a destination you can change later. That is genuinely useful when a campaign target moves, and it is the only way to get scan analytics — but the printed code now depends on a third party continuing to exist and continuing to serve your account. The full comparison covers where each one belongs.
Where it sits among barcodes
QR is one of several two-dimensional formats. Data Matrix is more compact at tiny sizes and dominates electronics component marking. PDF417 is what most driving licences and boarding passes use. Aztec is common on rail tickets. QR won the consumer space for one reason that has nothing to do with technical merit: Apple and Google built decoding into the default camera app, so there is no app to install first. If you are weighing it against the one-dimensional barcodes on retail packaging, the practical differences are larger than they look.
What this means when you generate one
Three things follow from the structure. Shorter input produces a physically larger, more forgiving pattern at the same printed size, so trimming tracking parameters off a URL is real engineering rather than tidiness. Higher error correction protects against damage but costs capacity, pushing the grid denser. And the quiet zone is part of the code, not the layout around it. Get those three right and almost everything else takes care of itself.