DevTools Hub
All guides

How QR codes work, and how to make one that always scans

What the patterns in a QR code mean, why error correction lets you cover part of it, and the practical mistakes that stop a printed code scanning.

21 July 20262 min read

A QR code is a grid of black and white squares encoding text, with enough redundancy built in that a surprising amount of it can be missing before the message is lost. Understanding the redundancy is what separates a code that scans reliably from one that fails on a sign.

The parts of the grid

The three large squares in the corners are finder patterns; they let a scanner locate the code and work out its rotation, which is why a QR code scans upside down. Smaller alignment patterns correct for the distortion of a code photographed at an angle or printed on a curved surface.

The timing patterns — alternating lines between the finders — tell the scanner how big each module is. Everything else is data and error-correction codewords, which is why two codes holding the same text can look completely different if the settings differ.

Error correction is a budget, not a setting

QR codes use Reed–Solomon error correction at one of four levels, recovering roughly 7%, 15%, 25% or 30% of the code. That redundancy is what lets a code survive a scratch, a fold, or a logo placed over the middle.

It is not free. Higher correction means more codewords for the same message, so the code becomes denser and each module smaller at a fixed physical size. Medium is right for a screen; choose a higher level for print or for anything you intend to cover.

Why printed codes fail

The most common cause is the quiet zone — the blank margin around the code. Scanners need it to find the edges, and designers routinely crop it away to fit a layout. Keep a clear margin of at least four modules.

Next is contrast and inversion. Dark-on-light is what scanners expect; a light code on a dark background fails on many readers, and low-contrast colour pairs fail in poor lighting. Then size: a code needs enough physical area for the camera distance, so a code on a poster read from three metres must be far larger than one on a business card.

In short

Keep the quiet zone, keep it dark-on-light, size it for the reading distance, and raise error correction for print. Then test with a real phone before committing to a print run.

QR Code Generator

Create QR codes for links, text or Wi-Fi networks. Pick your colours and download as PNG or print-ready SVG.

Open the tool

Keep reading