How a QR Code Works

A simple visual guide to understanding QR codes: anatomy, detection, generation and error correction.

info What is a QR code?

A QR code (Quick Response) is a type of two-dimensional barcode invented in 1994 by the Japanese company Denso Wave. Unlike a traditional barcode that only stores information in one direction, a QR code stores data both horizontally and vertically, allowing it to hold much more information in a small space.

Today, scanning a QR code is part of everyday life: we find them in restaurants, posters, products, business cards and even in cryptocurrency. But how does it really work on the inside?

grid_on Anatomy of a QR code

Before understanding how a QR code is scanned or generated, it helps to know its parts:

Position Patterns (Finder Patterns) The three large squares in the top-left, top-right and bottom-left corners. They allow the scanner to detect the QR code regardless of its orientation or camera angle.
Alignment Pattern A smaller square in the bottom-right corner. It helps correct distortion when the code is on a curved surface.
Timing Patterns Two rows of alternating modules (black-white) connecting the position patterns and allowing the size of each module to be calculated.
Data zone The rest of the grid: each small black or white square represents one bit of information (1 or 0).
Quiet Zone A white border around the entire code that helps the scanner separate it from the background.

qr_code_scanner How a QR code is scanned

When you point your camera at a QR code, several things happen in milliseconds:

Capture
arrow_forward
Location
arrow_forward
Perspective
arrow_forward
Bits
arrow_forward
Decoding
1
1. Image capture The camera continuously captures video frames. Each frame is a grid of pixels with brightness values.
2
2. Pattern location The software searches for the three position squares (Finder Patterns). Their characteristic ratio (1:1:3:1:1) makes them unique and easy to identify even at difficult angles.
3
3. Perspective correction From the three detected corners, the algorithm calculates a mathematical transformation to straighten the code even if the camera is tilted.
4
4. Module reading With the code aligned, the software reads each module and converts it to a bit: black = 1, white = 0.
5
5. Decoding and error correction The bits are grouped into blocks and Reed-Solomon is applied to correct any errors. Finally the data is decoded according to the mode (numeric, alphanumeric, binary or kanji).

grid_view How a QR code is generated

Creating a QR code is the reverse of scanning one:

Input
arrow_forward
Encoding
arrow_forward
Reed-Solomon
arrow_forward
Matrix
arrow_forward
Image
1
1. Data input You enter the text, URL or other content you want to encode.
2
2. Binary encoding The software selects the most efficient encoding mode and converts the data to a sequence of bits.
3
3. Error correction Redundancy bits are added using Reed-Solomon. The higher the chosen level (L, M, Q or H), the more extra bits are added and the more resilient the code is.
4
4. Matrix construction The information is placed in a grid following a spiral pattern, the position patterns are added and a mask is applied to avoid large areas of the same colour.
5
5. Rendering The final grid is converted to the image you download: PNG, SVG, PDF…

shield Error correction: why QR codes survive damage

The Reed-Solomon algorithm allows a QR code to be readable even if up to 30% of its surface is damaged, dirty or covered. That is why you can place your company logo on top without it stopping working, as long as you use level H and do not cover more than 25-30%.

The four available levels are:

L
7%
Digital use, screens. Lightest and smallest code.
M
15%
General use. Good size/resilience balance.
Q
25%
Printing with possible wear or dirt.
H
30%
With logo on top or very adverse environments.

quiz Frequently asked questions about QR codes

A QR code (Quick Response) is a type of two-dimensional barcode invented in 1994 by the Japanese company Denso Wave. It stores information both horizontally and vertically using black and white modules, allowing it to hold up to 7,089 numeric characters or 4,296 alphanumeric characters in a small area.
A QR code encodes data as a pattern of dark and light modules in a grid. When the camera captures it, the software detects the three position patterns (the corner squares), corrects the perspective, reads each module as a bit (black = 1, white = 0) and applies the Reed-Solomon algorithm to correct errors before decoding the information.
Thanks to the Reed-Solomon error correction algorithm, a QR code can recover information even if up to 30% of its surface is damaged, dirty or covered. That is why it is common to add a logo on top of the code without it stopping scanning correctly, as long as correction level H is used and no more than 25-30% is covered.
It depends on the data type and error correction level. The theoretical maximum is: 7,089 numeric digits, 4,296 alphanumeric characters, 2,953 binary bytes or 1,817 kanji characters. For practical use, keep URLs short and text concise so the code is denser and easier to scan at small sizes.
Scanning is reading: the camera analyses the image and extracts the encoded information. Generating is the reverse process: the software takes your data (text, URL, WiFi…), converts it to bits, adds Reed-Solomon redundancy and builds the module grid that you can print or share digitally.
Not always. A QR code can point to a malicious URL or trigger an unwanted action (call, payment, download). Before visiting the link, check the URL shown by the scanner. Our scanner verifies URLs against Google Safe Browsing and VirusTotal and warns you if the destination is dangerous.
It is the amount of redundancy added so the code remains readable even if partially damaged. There are four levels: L (7% tolerance, densest and lightest code), M (15%, general use), Q (25%, for printing with likely wear) and H (30%, ideal for adding logos on top). The higher the level, the larger the code.
help_outline

How does a QR code work?

Discover the anatomy of a QR code, how it's scanned, generated, and why it still works even when damaged.

Read free guide arrow_forward

Free forever

No subscriptions

No account required

No tracking

No data shared with third parties

QR codes never expire

100% Browser-side Detection

All scanning happens directly on your device using JavaScript. No frames or images ever leave your browser.

Fraudulent Link Alerts

QR URLs are checked against Google Safe Browsing and VirusTotal to warn you if the destination is dangerous.