Skip to main content
B
Benrio
← Back to guides
Web7 min readApril 2026

QR Codes Explained

How QR encoding works, error correction levels, structural anatomy, and best practices for creating scannable codes.

The History of QR Codes

QR codes were invented in 1994 by Masahiro Hara and his team at Denso Wave, a subsidiary of Toyota. The automotive manufacturer needed a better way to track parts during production. Traditional barcodes could only hold about 20 characters — far too little for the detailed component information Toyota's factories required.

Hara's insight was to extend barcodes into two dimensions. While a standard barcode encodes data in one direction (width of bars), a QR code uses both horizontal and vertical axes, dramatically increasing capacity. The name "QR" stands for "Quick Response" — the team's goal was a code that could be scanned and decoded at high speed. Denso Wave released the specification publicly and chose not to exercise their patent rights, enabling free worldwide adoption.

For over a decade, QR codes remained a niche technology outside Japan. The smartphone revolution changed everything — suddenly billions of people carried cameras with QR-reading software. The COVID-19 pandemic accelerated adoption further, as contactless menus, check-ins, and payment systems became ubiquitous.

How QR Encoding Works

A QR code is a grid of black and white squares called "modules." Each module represents a binary digit — black for 1, white for 0. The data is encoded using Reed-Solomon error correction, which adds redundant information so the code remains readable even when partially damaged or obscured.

QR codes come in 40 versions (sizes), from Version 1 (21×21 modules) to Version 40 (177×177 modules). Larger versions hold more data. A Version 1 code holds up to 41 numeric characters, while Version 40 can store up to 7,089 numeric characters or 4,296 alphanumeric characters.

The encoding process involves several steps: the data is analyzed for the most efficient encoding mode, converted to a binary bitstream, broken into codewords (8-bit blocks), then error correction codewords are calculated and appended. Finally, the data is placed into the module grid following a specific serpentine pattern, and a masking pattern is applied to ensure optimal readability.

Error Correction Levels

One of the most remarkable features of QR codes is their built-in error correction. Four levels are available:

  • Level L (Low): Recovers up to 7% damage. Maximum data capacity.
  • Level M (Medium): Recovers up to 15% damage. The default for most generators.
  • Level Q (Quartile): Recovers up to 25% damage. Good balance of resilience and capacity.
  • Level H (High): Recovers up to 30% damage. Allows logo overlays since significant portions can be obscured.

Higher error correction means the code can survive more damage but holds less data (more space is used for redundancy). Level H is commonly chosen when a logo or image will be placed in the center of the QR code — the error correction compensates for the obscured modules.

QR Code Structure

Every QR code contains several structural elements that help scanners locate and decode it:

  • Finder patterns: The three large squares in the corners (top-left, top-right, bottom-left). These allow scanners to detect the QR code at any angle and determine its orientation.
  • Alignment patterns: Smaller squares distributed throughout larger QR codes (Version 2+) that help compensate for distortion when scanning at an angle or on curved surfaces.
  • Timing patterns: Alternating black and white modules connecting the finder patterns. These help the scanner determine module size and maintain coordinate accuracy across the grid.
  • Format information: Data stored adjacent to finder patterns that tells the scanner which error correction level and mask pattern are used.
  • Quiet zone: A mandatory white border (at least 4 modules wide) around the QR code that helps scanners distinguish the code from surrounding content.

Types of Data

While QR codes can encode any binary data, certain formats have become standardized and are recognized by most smartphone cameras:

  • URLs: The most common use. Scanning opens the link in a browser. Prefix with https:// for automatic recognition.
  • Plain text: Any text content displayed directly to the user.
  • vCard: Contact information (name, phone, email, address) that can be saved directly to the phone's address book.
  • WiFi: Network credentials in the format WIFI:T:WPA;S:NetworkName;P:Password;; that auto-connect the device.
  • Email: Pre-filled email with recipient, subject, and body using the mailto: scheme.
  • SMS: Pre-composed text messages using sms: or smsto: schemes.
  • Geolocation: GPS coordinates that open in the device's maps application.

Best Practices for Creating QR Codes

Creating a scannable QR code requires attention to several practical details:

  • Size matters: The QR code should be at least 2cm × 2cm for close-range scanning. The minimum scanning distance is roughly 10× the QR code width.
  • Contrast is critical: Dark modules on a light background works best. Maintain at least a 70% contrast ratio between foreground and background.
  • Keep data short: Shorter data means fewer modules, which means a simpler code that scans faster and at greater distances. Use URL shorteners for long links.
  • Test across devices: Always test your QR code with multiple phones, apps, and at various distances and angles before deploying.
  • Include a call to action: A QR code alone doesn't tell users what to expect. Add text like "Scan for menu" or "Scan to connect to WiFi."

Dynamic vs Static QR Codes

A static QR code has its data permanently encoded — once printed, it cannot be changed. The URL or text is baked directly into the modules. Static codes work offline and have no dependencies, but updating the destination requires generating and printing an entirely new code.

Dynamic QR codes encode a short redirect URL that points to a management service. The service then redirects to your actual destination. This means you can change where the code points without reprinting it, track scan analytics (time, location, device), and A/B test destinations. The tradeoff is dependence on the redirect service — if it goes down, your code stops working.

Business Use Cases

QR codes have found their way into virtually every industry. Restaurants use them for digital menus, eliminating printing costs and enabling real-time updates. Retail stores link to product reviews, sizing guides, or augmented reality previews. Event organizers encode tickets for contactless entry. Healthcare providers link to patient portals and appointment scheduling. Real estate agents place them on signs linking to virtual tours.

Payment systems like Alipay and WeChat Pay in China processed trillions of dollars through QR codes, demonstrating their reliability at scale. Manufacturing companies use them for inventory tracking, just as Denso Wave originally intended. Education institutions link to course materials, assignment submissions, and campus maps.

The key to successful QR code deployment is providing genuine value on the other side of the scan. Users will stop scanning if QR codes consistently lead to disappointing content. Ensure the linked experience is mobile-optimized, loads quickly, and delivers on whatever promise the call-to-action made.

Try it yourself:

QR Code Generator