What Is a QR Code? How QR Codes Work
By ScanHatch · Published · 6 min read
A QR code is a square, two-dimensional barcode that stores text: often a web address, but also WiFi details, contact cards or plain messages. Any phone camera can read one in a fraction of a second, and it still works when part of it is dirty or covered.
This guide explains what the parts of a QR code do and what actually happens between pointing your camera and seeing a link, without assuming any technical background.
Where QR codes came from
QR stands for Quick Response. The code was developed in 1994 by Denso Wave, then part of the Japanese car-parts maker Denso, to track components on production lines faster than traditional barcodes allowed. A linear barcode holds a couple of dozen characters and must be scanned along one line; a QR code stores data in both directions, so it can hold far more and be read from any angle.
Denso Wave chose not to enforce its patent, and the format is published as the international standard ISO/IEC 18004. That openness is a large part of why QR codes spread from factories to menus, tickets and payment terminals. “QR Code” itself remains a registered trademark of Denso Wave.
The parts of a QR code
Every square in a QR code is called a module. Some modules carry your data, but many have fixed jobs that help the scanner find and read the code:
| Part | What it looks like | What it does |
|---|---|---|
| Finder patterns | Three large squares-within-squares in the corners | Let the scanner find the code and work out its angle and orientation |
| Separators | A one-module white border around each finder pattern | Keep the finder patterns distinct from the data |
| Timing patterns | Alternating dark and light lines between the finder patterns | Tell the scanner how big each module is, so it can map the grid |
| Alignment patterns | Smaller squares (from version 2 upwards) | Help correct distortion when the code is curved or photographed at an angle |
| Format information | Strips next to the finder patterns | Record the error-correction level and the mask pattern used |
| Version information | Two small blocks (version 7 and above) | Record the code's size, for larger codes |
| Quiet zone | The blank margin around the code | Separates the code from its surroundings; the standard asks for 4 modules |
Everything else is data and error-correction information, laid out in a zigzag path that fills the remaining space.
Versions: why QR codes come in different sizes
QR codes come in 40 sizes called versions. Version 1 is a grid of 21 × 21 modules, and each version adds four modules per side, up to version 40 at 177 × 177. The generator picks the smallest version that fits your data.
Example
The address https://example.com/menu fits in a version 2 code (25 × 25 modules). A 113-character link with tracking parameters needs version 6 (41 × 41), or version 10 (57 × 57) at the highest error-correction level. More data means more, smaller modules for the same printed size.
That's why short links scan more easily: at the same printed width, a code with fewer modules has bigger modules, which phone cameras resolve more reliably.
How the data is encoded
Before anything is drawn, the text is converted into bits using one or more encoding modes. Each mode is efficient for a particular kind of character:
| Mode | Characters | Maximum in a version 40 code (lowest error correction) |
|---|---|---|
| Numeric | Digits 0–9 | 7,089 digits |
| Alphanumeric | 0–9, capital A–Z, space and $ % * + - . / : | 4,296 characters |
| Byte | Any bytes, usually UTF-8 text including lowercase and emoji | 2,953 bytes |
| Kanji | Japanese Kanji characters | 1,817 characters |
Those maximums are rarely useful in practice: a code holding thousands of characters is dense and hard to scan. Most real QR codes hold under 100 characters.
Error correction: why damaged codes still scan
QR codes include extra Reed-Solomon error-correction data, which lets the scanner rebuild missing or misread parts. There are four levels: L, M, Q and H, which restore roughly 7%, 15%, 25% and 30% of the data. Higher levels make the code bigger for the same content. This is also how a logo can sit in the middle of a code: it covers modules, and error correction fills in the gap. QR code error correction explained goes into the details.
Masking: why every code looks random
If data were drawn directly, some codes would contain large solid blocks or patterns that look like finder patterns, confusing scanners. So the encoder applies one of eight mask patterns, flipping modules in a regular pattern, and picks the mask that produces the most even-looking result. The format information records which mask was used so the scanner can undo it.
What happens when you scan a code
- The camera looks for the three finder patterns, which are distinctive at any angle and size.
- From their positions it works out the code's orientation, and uses the timing and alignment patterns to map every module, even if the code is tilted or on a curved surface.
- It reads the format information to learn the error-correction level and mask.
- It removes the mask, reads the data and error-correction codewords, and repairs any errors.
- It decodes the bits back into text, then decides what to offer you: open a link, join WiFi, add a contact, or just show the text.
The code itself doesn't do anything. It's just stored text. Your phone decides how to act on it, which is why a phone asks before opening a link or joining a network. You can see exactly what a code contains, without acting on it, with the QR code scanner or the QR decoder for images.
Other kinds of QR code
- Micro QR: a smaller variant with one finder pattern, for tiny items. It holds up to 35 digits.
- rMQR (rectangular Micro QR): a rectangular version for narrow spaces such as the edge of a label.
- Frame QR, iQR and SQRC are further Denso Wave variants for special uses; they're uncommon outside Japan.
The codes people meet day to day, and the ones the ScanHatch QR Code Generator makes, are standard QR codes (formally QR Code Model 2).
What QR codes can't do
- They can't hold files, photos or videos. Those are too big; codes link to them instead.
- They don't expire by themselves, and they can't be edited once printed. What changes is where a link points, which is the idea behind static and dynamic QR codes.
- They can't prove a link is safe. A QR code is only as trustworthy as whoever put it there.
Frequently asked questions
Do QR codes need the internet?
No. The code's content is stored in the pattern, so a phone can read it offline. Opening a link it contains needs a connection, but reading WiFi details or a contact card doesn't.
Can a QR code be read upside down?
Yes. The three finder patterns tell the scanner the code's orientation, so it can be read at any angle.
Is there a limit to how many QR codes can exist?
No. A QR code is just a way of drawing text, so there's no central register and nothing to run out of.