What Is a QR Code?

A QR code is a square grid of black and white squares that stores text — usually a link — in a pattern a camera can read from any angle, and read correctly even when part of it is dirty or torn.

What the pattern actually holds

A QR code is not a picture of a link. It is the link, written in binary and laid out as a grid. Each small square — a module — is one bit: black for one, white for zero. A reader finds the grid, reads the modules in a fixed order, and reassembles the bytes.

That is why a QR code works with no network and no lookup table. Nothing is stored on a server anywhere. The code you print carries its whole payload in the ink.

The three corner squares

The three big squares in the corners are finder patterns. They exist so a camera can locate the code in a cluttered photo and work out how it is rotated. Each one is a black square inside a white ring inside a black ring — a ratio of 1:1:3:1:1 that almost never occurs by accident in the real world.

Three corners, not four, is deliberate. Three points define an orientation, and the missing fourth corner is what tells the reader which way up the code is. That is why you can scan one sideways, upside down, or reflected in a window and get the same answer.

Two smaller helpers sit alongside them. Alignment patterns — the little squares scattered through larger codes — correct for the curve when a code is stuck on a bottle or photographed at an angle. Timing patterns, the dotted lines running between the finders, tell the reader how wide one module is, which is how the same code scans from 10 cm and from 10 metres.

The quiet zone

The blank margin around a code is part of the code. It is called the quiet zone, and the specification asks for at least four modules of clear space on every side. Without it a reader cannot tell where the grid stops and the poster starts.

This is the single most common reason a printed code fails. Nothing is wrong with the pattern; the design just put a border, a fold, or a line of text too close to the edge. Every code this site exports carries its quiet zone inside the image, so cropping to the edge of the file still leaves the margin intact.

Error correction, and why a torn code still scans

QR codes use Reed–Solomon error correction, the same family of maths that keeps a scratched CD playing. The data is written with redundancy, so a reader can reconstruct bytes it never actually saw.

Level Recovers up to Use it when
L 7% A clean screen, or a print that will stay clean
M 15% The sensible default for most printing
Q 25% Menus, tables, anywhere it gets handled
H 30% A logo sits on top of the code, or it lives outdoors

Redundancy is not free. Raising the level adds modules, which makes the code denser at the same physical size. A code at level H holding a long link has to be printed noticeably larger than the same link at level M.

This is also the trick behind a code with a logo in the middle: the logo is covering real modules, and level H is what buys back the ability to lose them.

Versions, and how big the grid gets

A QR code’s version is just its size, from version 1 at 21×21 modules to version 40 at 177×177. The encoder picks the smallest version your data fits into at the error correction level you asked for.

The practical consequence is that short links scan better. A 25-character link might fit in version 2. The same link with tracking parameters bolted on can push it to version 5 or 6, roughly tripling the module count and shrinking every module at the same printed width. If a code has to be small, shorten what goes in it.

What a QR code cannot do

It cannot change. The pattern is the data, so a printed static code points where it pointed the day you made it, forever. And it cannot count: nothing in the format reports anything back, so a static code can never tell you how many people scanned it.

Both of those need a dynamic code, which stores a short redirect link in the pattern and keeps the real destination on someone’s server.

QR code vs barcode vs NFC tag

QR code1D barcodeNFC tag
What reads itAny phone cameraA laser scanner, usuallyA phone held within a few centimetres
Holds aboutUp to 4,296 charactersAround 20 charactersKilobytes, and rewritable
Survives damageYes — up to 30% can be missingNo — one scratch across the bars kills itYes, unless the chip breaks
Costs to makeNothing, it is just inkNothing, it is just inkCents per tag, and someone has to stick them on
Works offlineYes, the data is in the patternYesYes

Frequently asked questions

What does QR stand for?

Quick Response. Denso Wave, a Toyota subsidiary, invented the format in 1994 to track car parts down a production line faster than a barcode could be scanned, and chose not to enforce its patent, which is why anyone can make one for free.

How much data fits in a QR code?

At the largest size and the weakest error correction, 4,296 alphanumeric characters or 7,089 digits. In practice you want far less: every extra character adds rows and columns, and a denser code has to be printed larger to stay readable.

Why does a QR code still scan when part of it is missing?

Reed–Solomon error correction stores the data more than once, spread across the grid. At the highest level roughly 30% of the code can be destroyed and a reader still recovers the full message.

Do QR codes expire?

The pattern does not. A static QR code holds its data forever. What expires is whatever it points at — a link whose page has been deleted gives you a perfectly good scan and a dead destination.

Can a QR code contain a virus?

Not on its own — it holds text, not code. The risk is the destination: a code can open a link that phishes you. Read the URL your camera shows you before you tap it, or check the code first with a scanner.

Do QR codes need the internet to work?

Scanning does not. The data is in the pattern, so a phone in airplane mode still reads it. Following a link the code contains is what needs a connection.

Related tools

Last updated .