How QR codes work
A QR code looks like random noise, but every square has a job. This guide explains what the parts of a QR code do, how text becomes a pattern and why some codes are dense while others are simple, following the ISO/IEC 18004 standard.
By the QRmora team at LoboGeek · Updated October 19, 2026
A short history
The QR code was invented in 1994 by Denso Wave, then a division of the Japanese automotive supplier Denso, in a team led by engineer Masahiro Hara. Factories tracked car parts with traditional barcodes, which hold only a few dozen characters and had to be scanned one after another. The goal was a code that could hold much more data and be read quickly from any angle. QR stands for Quick Response.
Denso Wave patented the design but chose not to enforce the patent for the standardized code, so anyone can create and read QR codes without paying a license. "QR Code" remains a registered trademark of Denso Wave. The code was standardized in Japan and then internationally as ISO/IEC 18004, first published in 2000 and revised since. Smaller variants exist, such as Micro QR, but the codes you see on menus and posters are the standard QR code described here.
For years QR codes were mostly used in industry and in Japan. They became common elsewhere once phone cameras could read them without a separate app, and once businesses started using them for menus, payments and contactless check-ins.
Modules and the anatomy of a code
A QR code is a square grid of modules: the small dark and light squares. A dark module usually means a binary 1 and a light one a 0. Some modules carry your data, and the rest form fixed structures that help the scanner find, orient and read the code.
Finder patterns are the three large squares in the corners (often called eyes). Each is a 7 × 7 module structure: a dark square ring, a light ring and a dark 3 × 3 center. Read across in any direction, they produce a dark, light, dark, light, dark sequence in the ratio 1:1:3:1:1, which is easy to detect even when the code is rotated or tilted. Because there are only three, the empty fourth corner tells the scanner how the code is oriented. A one-module light separator surrounds each finder pattern.
Timing patterns are two lines of alternating dark and light modules running between the finder patterns, one horizontal and one vertical. They let the scanner count the columns and rows and correct for small distortions in the module size.
Alignment patterns are smaller 5 × 5 squares that appear from version 2 onward. They help the scanner correct perspective and curvature, for example when a code is printed on a bottle or photographed at an angle. Bigger codes have more of them: the largest version has 46.
Format information is a 15-bit strip next to the finder patterns that records the error correction level and the mask used. It is stored twice, in two different places, and protected by its own error-correcting code, because nothing else can be decoded without it. From version 7 onward, two blocks of version information also record the size of the code. Around everything sits the quiet zone, a light margin at least four modules wide.
Versions 1 to 40
The size of a QR code, in modules, is set by its version. Version 1 is 21 × 21 modules, and each version adds four modules per side, up to version 40 with 177 × 177 modules. The formula is 17 + 4 × version, so version 10 has 57 modules per side.
The version is not a quality setting; it is simply the smallest grid that fits the content at the chosen error correction level. Encoders pick it automatically. A version 1 code with medium error correction holds 14 bytes of text, enough for a short word or a phone number. The 18 characters of https://qrmora.com need version 2, and a typical long marketing link with tracking parameters can push a code to version 6 or beyond.
The physical size is a separate decision. The same version can be printed 2 cm or 2 m wide; what changes with the version is how many modules have to fit in that space, and therefore how small each module ends up.
Data modes and capacity
A QR code does not store every character the same way. The standard defines encoding modes, and an encoder can switch between them within one code to save space.
Numeric mode stores digits 0 to 9, packing three digits into 10 bits. Alphanumeric mode stores 45 characters (digits, uppercase letters A to Z, space and $ % * + - . / :) at two characters per 11 bits. Byte mode stores any 8-bit value, which is how lowercase text, URLs with query strings, accents and emoji are encoded; non-Latin characters in UTF-8 take two to four bytes each. Kanji mode stores Japanese characters at 13 bits each.
Each block of data starts with a 4-bit mode indicator and a character count, then the data itself, followed by a terminator and padding to fill the remaining capacity. Because of these modes, capacity depends on the content. The largest code, version 40 with the lowest error correction, holds up to 7,089 digits, 4,296 alphanumeric characters or 2,953 bytes.
Those maximums are far beyond what a phone can scan comfortably. In practice, codes meant for people work best with short content: a short link, a contact card with a few fields or Wi-Fi settings.
Reed–Solomon error correction
QR codes can be read when they are dirty, scratched, partly covered or printed with a logo in the middle. That is thanks to Reed–Solomon error correction, the same family of codes used in CDs, DVDs and deep-space communication.
After the data is converted to 8-bit codewords, the encoder computes extra error correction codewords from them using arithmetic over a finite field. The scanner checks those extra codewords against the data and, if something does not match, can work out which codewords are wrong and what they should be. Each two error correction codewords allow one damaged codeword to be repaired.
The standard defines four levels, named by how much of the code can be restored: L recovers about 7 % of the codewords, M about 15 %, Q about 25 % and H about 30 %. Higher levels spend more of the grid on redundancy, so the same content needs a bigger version. QRmora uses M by default and switches to H when you add a logo.
In larger codes the codewords are split into several blocks, each with its own error correction, and then interleaved across the grid. A stain in one place damages a few codewords from many blocks instead of many codewords from one block, which keeps each block within what it can repair.
Placement and masks
Once the data and error correction codewords are ready, their bits are placed in the grid in a zigzag that starts at the bottom right corner and moves through columns two modules wide, up and down, skipping the finder, timing and alignment patterns and the format and version areas.
The raw result can contain patterns that confuse scanners: large solid areas, long runs of the same color or shapes that look like a finder pattern. To avoid that, the encoder applies a mask, a fixed pattern that flips the color of certain modules, such as every module where the row plus the column is even. There are eight masks. The encoder tries all of them, scores each result with penalty rules for runs, solid blocks, finder-like shapes and an unbalanced ratio of dark to light, and keeps the one with the lowest score.
The number of the mask goes into the format information, so the scanner can undo it before reading the data. That is why two codes with almost the same content can look completely different: a single changed character can lead the encoder to pick a different mask.
Why longer content makes denser codes
More characters mean more codewords, more codewords mean a bigger version, and a bigger version means more modules in the same printed area. If the pattern itself measures 3 cm across, not counting the quiet zone, a version 2 code has modules of about 1.2 mm, while a version 10 code has modules of about 0.5 mm, which a phone camera struggles to resolve from a distance or in poor light.
That is the practical reason to keep content short. Remove tracking parameters you do not need, use a short path on your own domain rather than a long link, and leave optional fields out of contact cards. Where it is not possible, print the code larger. Error correction plays the same role: level H plus a logo makes a denser code than level M without one.
A detail many generators skip: the mode depends on the characters. A link written entirely in uppercase can fit alphanumeric mode and produce a smaller code, but only the domain is case-insensitive; the path after it often is not, so this trick only works when the website accepts it.
Static and dynamic codes
Everything above describes what is physically stored in the pattern. A static code stores your actual content, such as a link, a Wi-Fi network or a contact card, so it works on its own without any service in between, but it cannot be changed after printing. A dynamic code stores a short link that a service redirects to your destination, which lets you change the destination later and count scans, at the cost of depending on that service. Our guide on static vs dynamic QR codes explains when each one makes sense.