← Web Dev Toolkit · Guides

How QR Codes Work: Structure, Error Correction & Capacity

Guide · 8 min read · by the Web Dev Toolkit team

QR codes are everywhere — menus, payment terminals, product packaging, event badges. But under that chessboard of black and white squares there is a well-designed error-correcting system that can still be read when 30% of it is damaged. Here's how it actually works.

Anatomy of a QR code

Every QR code is a grid of modules (the squares), surrounded by a quiet zone of at least four white modules. Inside, three regions matter most:

Versions: how codes grow

QR codes come in 40 versions. Version 1 is 21×21 modules; each version adds 4 modules per side, up to 177×177 for version 40. Bigger versions hold more data but need cleaner printing and larger quiet zones. The table below shows typical maximum capacity at each error-correction level for a moderate version:

Error levelFault toleranceMax digits (v5, 37×37)Max bytes (v5)
L~7%~106~62
M~15%~86~49
Q~25%~66~39
H~30%~48~29

Why error correction matters

Reed–Solomon error correction splits your data into blocks and adds redundancy bytes. The scanner can reconstruct the original payload even if part of the pattern is covered by a logo, scratched, or photographed at an angle. This is why you can safely place a logo in the center of a code made with a high correction level — and why cheap stickers on curved coffee cups still scan.

What limits capacity

Practical tips for scannable codes

⚡ Make your own: generate fully private, spec-compliant QR codes right in your browser with our free QR Code Generator — no uploads, no accounts, PNG download included.

Sources: ISO/IEC 18004 (spec), Thonky's QR tutorial, and practical testing with the Web Dev Toolkit QR generator.