Skip to content
HowlumeAll topics

How does a QR code work?

Up to 84 characters at level M in this demo (real QR codes go up to version 40 and about 2,900 characters).

Mask. Big blobs of one colour, or shapes that look like finder patterns, confuse cameras. So the data area is XOR-ed with one of 8 patterns. The encoder tries all eight, scores each with penalty rules, and keeps the lowest: here mask 2. This finished code is real: point your phone camera at it.

v225×25 modules
25 Bof 26 that fit
Mrecovers ~15%
28+16data + EC codewords
A real QR code encoder running in your browser (versions 1 to 5, byte mode). Colours show the layers while building; the last step is the finished, scannable code.

Overview

Short answer

A QR code stores data as a grid of dark and light squares, one bit each. Three corner squares let a camera find and straighten it, and extra error-correction data lets your phone rebuild up to 30% of a damaged or covered code.

Play with the figure, then press Next (or the → key) to go step by step.