QR Code Technical Guide: Structure, Error Correction & Encoding Modes

QR codes encode data in a two-dimensional pattern of black and white squares (modules). Invented in 1994 by Denso Wave for tracking auto parts, they now encode everything from URLs to Wi-Fi credentials. This guide explains the technical structure behind QR codes and best practices for generating them.

QR Code Structure

Every QR code contains these structural elements:

  • Finder patterns — three large squares in the corners that help scanners detect and orient the QR code
  • Alignment patterns — smaller squares that help correct for perspective distortion (absent in Version 1)
  • Timing patterns — alternating black/white strips that help the scanner determine module density
  • Format information — encodes error correction level and mask pattern
  • Version information — encodes the QR code version (size) for versions 7+
  • Data and error correction codewords — the actual encoded data plus Reed-Solomon error correction
  • Quiet zone — a 4-module-wide white border required for scanner detection

Encoding Modes

QR codes support four encoding modes, each optimized for different character sets:

ModeCharactersBits per CharacterBest For
Numeric0-93.33Phone numbers, IDs
Alphanumeric0-9, A-Z, space, $%*+-./:=5.5Short codes, SKUs
ByteAny byte (ISO 8859-1 / UTF-8)8URLs, text, binary data
KanjiShift JIS double-byte13Japanese text
💡 Optimization: URLs are typically encoded in Byte mode (8 bits/char). But if you uppercase the URL scheme and domain (HTTP://EXAMPLE.COM), the alphanumeric portion uses only 5.5 bits/char — making a smaller QR code. Most servers handle uppercase URLs identically.

Error Correction Levels

QR codes use Reed-Solomon error correction to remain scannable even when partially damaged:

LevelRecovery CapacityData OverheadWhen to Use
L (Low)~7%MinimalClean environments, digital screens
M (Medium)~15%ModerateGeneral purpose (default)
Q (Quartile)~25%SignificantIndustrial/outdoor environments
H (High)~30%MaximumLogo overlays, harsh conditions

Higher error correction increases the QR code's physical size because more redundant data modules are added.

Version and Data Capacity

QR codes range from Version 1 (21×21 modules) to Version 40 (177×177 modules):

VersionModulesNumeric (L)Alphanumeric (L)Byte (L)
121×21412517
537×3720212284
1057×57652395271
2097×972,0611,249858
40177×1777,0894,2962,953

QR Code Best Practices

For Print

  • Minimum size: 2×2 cm for close-range scanning; scanning distance ÷ 10 for the minimum dimension
  • Contrast: Dark modules on light background (not just black-on-white; dark blue on white works too)
  • Quiet zone: Maintain at least 4 modules of white space around the QR code
  • Test before printing: Scan with multiple devices and apps

For Digital

  • Use SVG format for scalability — vector graphics stay sharp at any size
  • PNG minimum: 200×200 pixels for web display, 600×600 for high-DPI screens
  • Avoid JPEG — compression artifacts can interfere with scanning

For Logo Overlays

  • Use High (H) error correction
  • Logo should cover ≤15% of total QR area
  • Place logo in the exact center
  • Add a small white border around the logo

Common QR Code Use Cases

  • URLs: https://example.com/page
  • Wi-Fi: WIFI:T:WPA;S:NetworkName;P:Password;;
  • vCard: Contact information in vCard format
  • Email: mailto:[email protected]?subject=Hello
  • SMS: smsto:+1234567890:Message text
  • Geo location: geo:40.7128,-74.0060

Frequently Asked Questions

Up to 7,089 numeric characters or 2,953 bytes at the lowest error correction. In practice, most QR codes hold URLs of 50-300 characters with medium error correction.
Four levels: L (7% recovery), M (15%), Q (25%), H (30%). Level M is the default. Use H when adding logos on top of the QR code.
2×2 cm for close-range scanning. For larger distances, use: QR size = scanning distance ÷ 10.
Yes, with High (H) error correction. The logo should cover no more than 10-15% of the total QR area. Place it in the exact center.
Static QR codes never expire — the data is embedded in the pattern. Dynamic QR codes can expire if the redirect service stops. Our tool generates static, permanent QR codes.

Generate a QR code

Open QR Code Generator →