How QR codes work: error correction and choosing a version

4 min read

A QR code looks like a grid of black and white dots, but the internals include error-correction codes, encoding-mode switching, alignment patterns, and format information. This article walks through the structure and the choices you make when generating one.

Anatomy of a QR code

Every QR code has fixed structural marks:

  • Finder patterns — the three large squares in the corners (top-left, top-right, bottom-left).
  • Alignment patterns — smaller squares appearing in larger versions.
  • Timing patterns — alternating black/white lines between finders.
  • Format information — encodes the error-correction level and mask pattern.
  • Data + error correction — fills the rest.

Reed-Solomon codes provide the redundancy.

Versions: size in steps

Versions go from 1 to 40, each larger than the last:

VersionModulesMax numeric data (level L)
121×2141 chars
537×37154 chars
1057×57395 chars
2097×971,259 chars
40177×1777,089 chars

The maximum is version 40 — 4,296 alphanumeric or 7,089 numeric characters.

Error correction levels (ECL)

QR codes carry redundancy so they remain readable when partially obscured:

LevelRecoverableNotes
L~7%Most data, least correction
M~15%Standard
Q~25%More correction
H~30%Highest, least data

“30% recoverable” means up to 30% of modules can be missing or wrong and the original data is still readable.

Encoding modes

QR codes switch encoding modes for efficiency:

ModeCharactersBits per charUse
Numeric0–9~3.33Pure numbers
Alphanumeric0–9, A–Z, space, $%*+-./:5.5Caps + digits
ByteAny 8-bit data8URLs, UTF-8 text
KanjiShift JIS kanji13Japanese (special mode)

Numeric is most efficient for digit-only data; Byte handles URLs and UTF-8 text.

Picking a level by use case

Print (posters, business cards)

  • Error correction: Q or H
  • Print suffers wear, fingerprints, and dirt.
  • Build in margin.

Screen display (web, apps)

  • Error correction: L or M
  • Less degradation risk.
  • Pack more data.

QR codes with logos

To embed a logo in the center, use error-correction redundancy to compensate for the obscured area:

  • Logo covers ~10% → level M is enough.
  • Logo covers ~25% → use level H.

H allows 30% recovery, so up to ~25% obscured remains readable.

Mask patterns

Data alone can produce visual imbalances (“too much black”). QR codes XOR data with one of eight mask patterns chosen at encode time to maximize readability. The chosen mask is recorded in the format information.

Sizing a QR code in practice

“50-character URL on a print piece”:

  • Data: 50 bytes (ASCII URL).
  • Byte mode: 50 × 8 = 400 bits.
  • Level H gives ~70% of data capacity.
  • Versions 3–4 fit (33×33 modules).

For a business card with a product URL, version 4 at level H is plenty.

Minimum print size

Rule of thumb:

min size (mm) ≈ modules × 0.4mm × 1.5

Version 4 (33×33) → about 20 mm. Standard business-card QR codes land at 20–25 mm.

For long-distance reading (station posters), aim for “diagonal ≥ reading distance / 10”.

Micro QR and Rectangular Micro QR

Beyond the standard square QR:

  • Micro QR — as small as 11×11, for tiny tags.
  • rMQR (Rectangular Micro QR) — long-rectangle shape for label strips.

ISO-standardized but with limited reader support, so mostly industrial.

Implementation notes

  • Render as SVG when scaling is needed.
  • 300 DPI is enough for print.
  • Quiet zone — leave at least 4 modules of margin around the code.
  • Contrast — the dark/light contrast must be high (don’t put a black code on a dark background).

Summary

  • A QR code is defined by version (1–40), error-correction level (L/M/Q/H), and encoding mode.
  • Print: Q or H. Screen: L or M.
  • Logos in the center work with level H absorbing the loss.
  • Always include a quiet zone.

To turn URLs or text into a QR code, the QR code generator on this site lets you set size and error-correction level.