A QR code looks like random noise, but every square has a job. Some squares help a camera find the code and straighten it out, some describe how the code was built, and the rest hold your data plus extra information that lets the code survive scratches and smudges. Once you understand those parts, it becomes much easier to make QR codes that scan reliably.
QR stands for Quick Response. The format was created in 1994 by Denso Wave, a Japanese company, to track automotive parts, and it is defined today in the international standard ISO/IEC 18004.
The short answer
- A QR code is a two-dimensional barcode: a square grid of dark and light squares called modules.
- Three large squares in the corners let a scanner find the code and work out its angle.
- Your data, usually a web address, is converted into bits and arranged in the grid.
- Extra error correction data lets the code be read even if part of it is damaged.
- Your phone's camera app decodes the text and then offers an action, such as opening a link or joining Wi-Fi.
The parts of a QR code
Finder patterns
The three big squares in the top-left, top-right and bottom-left corners are finder patterns. Each is 7 by 7 modules: a dark square ring, a light ring and a solid dark center. Their distinctive proportions are easy for software to spot from any angle, and because there are only three (not four), the scanner can also tell which way up the code is. That is why you can scan a QR code sideways or upside down.
Separators and quiet zone
Each finder pattern is surrounded by a thin light border, and the whole code needs a light margin around it called the quiet zone. The standard calls for a margin 4 modules wide. Without it, the scanner can confuse the code's edge with whatever is printed next to it. Our QR code quiet zone guide explains why cropping that margin is a common cause of failed scans.
Timing patterns
Between the finder patterns run two lines of alternating dark and light modules, one horizontal and one vertical. These timing patterns act like a ruler, telling the scanner how big each module is and where the rows and columns fall.
Alignment patterns
Larger codes include one or more smaller squares called alignment patterns. They help the scanner correct for distortion when the code is printed on a curved surface or photographed at an angle. The smallest version of a QR code has none; bigger versions have more.
Format and version information
Next to the finder patterns are small strips of format information. They record which error correction level and which mask pattern the code uses (more on both below), and they are stored twice so they can survive damage. Larger codes, version 7 and above, also include version information that describes the code's size.
Make a free QR code for a link, WiFi or contact card — generated in your browser.
Open the free QR code generator →Versions: how big a QR code can be
QR codes come in 40 versions, which set the size of the grid:
- Version 1 is 21 by 21 modules.
- Each version after that adds 4 modules per side.
- Version 40 is 177 by 177 modules.
The more data you store, the higher the version needs to be, and the denser the code looks. Our guide to how much data a QR code can hold explains the limits and why shorter content gives you a simpler, more scannable code.
How your data becomes squares
1. Choosing an encoding mode
The text is first converted into bits using the most compact mode available:
| Mode | What it stores |
|---|---|
| Numeric | Digits 0 to 9 only |
| Alphanumeric | Digits, uppercase A to Z, space and a few symbols |
| Byte | Any text, including lowercase letters and most web addresses |
| Kanji | Japanese characters |
Numeric mode packs the most characters into a given space, which is why a code holding only a number can be very small.
2. Adding error correction
The data bits are grouped into 8-bit codewords, and the encoder adds extra codewords calculated with Reed-Solomon error correction, the same family of math used on CDs and DVDs. If some modules are dirty, torn or covered, the scanner can rebuild the missing data from those extra codewords.
There are four levels, L, M, Q and H, which can recover roughly 7%, 15%, 25% and 30% of the codewords respectively. Higher levels are more robust but need more modules. See QR code error correction levels for how to choose.
3. Placing the bits
The codewords are laid into the grid in a zigzag path, two columns at a time, starting from the bottom-right corner and skipping the areas reserved for finder, timing and alignment patterns and format information.
4. Masking
Finally, the encoder applies a mask: a fixed pattern that flips some modules from dark to light and back. Without masking, some data could produce large solid blocks or shapes that look like finder patterns and confuse scanners. The standard defines eight mask patterns; the encoder tests them, scores each for problems, picks the best and records its choice in the format information so the scanner can undo it.