Devkitrdevkitr
Generators

How QR Codes Work — Structure, Encoding & Error Correction

2025-12-057 min read

QR codes (Quick Response codes) are two-dimensional barcodes that can store text, URLs, contact information, and more. Invented in 1994 by Denso Wave for tracking automotive parts, they've become ubiquitous in payments, marketing, and digital authentication.


QR Code Structure


Every QR code contains these structural elements:


Finder Patterns

The three large squares in the corners (top-left, top-right, bottom-left) help scanners detect and orient the code regardless of angle.


Alignment Pattern

Smaller squares used in larger QR codes (version 2+) to help correct geometric distortion.


Timing Patterns

Alternating black and white modules between finder patterns that help the scanner determine module coordinates.


Data and Error Correction

The remaining area contains the encoded data along with error correction information.


Quiet Zone

A white border around the QR code (minimum 4 modules wide) that helps scanners distinguish the code from its surroundings.


Data Encoding Modes


QR codes use different encoding modes optimized for different types of content:


  • Numeric — digits 0-9 only (most efficient: 3.3 bits per character)
  • Alphanumeric — digits, uppercase letters, and some symbols (5.5 bits per character)
  • Byte — any 8-bit data including UTF-8 (8 bits per character)
  • Kanji — Japanese characters (13 bits per character)

  • Error Correction Levels


    One of QR codes' most powerful features is Reed-Solomon error correction, which allows data recovery even if parts of the code are damaged:


  • Level L (Low) — recovers up to 7% damage
  • Level M (Medium) — recovers up to 15% damage
  • Level Q (Quartile) — recovers up to 25% damage
  • Level H (High) — recovers up to 30% damage

  • Higher error correction means more redundant data, which makes the QR code larger. Level M is the default for most use cases. Level H is used when codes may be partially obscured (like adding a logo in the center).


    QR Code Versions


    QR codes come in 40 versions, from 1 (21x21 modules) to 40 (177x177 modules):


  • Version 1 — 21×21 modules, stores ~25 alphanumeric characters
  • Version 10 — 57×57 modules, stores ~395 alphanumeric characters
  • Version 40 — 177×177 modules, stores ~4,296 alphanumeric characters

  • Common Use Cases


  • Payments — mobile payment systems (Alipay, Apple Pay, UPI)
  • URLs — linking to websites, apps, or content
  • Wi-Fi — sharing network credentials without typing passwords
  • vCards — sharing contact information
  • Authentication — two-factor authentication (TOTP setup)
  • Inventory — product tracking and logistics
  • Tickets — event entry and boarding passes

  • Best Practices for Creating QR Codes


  • Use the lowest QR version that fits your data (smaller = easier to scan)
  • Use high contrast (black on white is most reliable)
  • Include a quiet zone of at least 4 modules
  • Test scanning at different sizes and distances
  • Use error correction level M or higher for printed materials
  • If adding a logo, use error correction level H

  • Generate QR codes instantly with our QR Code Generator.


    Related Articles

    Back to Blog