All Guides

7 min read

How QR Codes Work: Encoding and Scanning

Data encoding, error correction, and how phone cameras decode QR patterns.

QR codes look simple on a menu tent or product box: a square pattern and a quick scan. Under the surface, standards define how data becomes modules, how error correction keeps scans working on wrinkled labels, and how your phone turns a camera frame into a URL. This guide explains encoding, Reed Solomon error correction, and the scanning pipeline in plain language. You do not need to implement the math to create reliable codes on OnestQR, but understanding the mechanics helps you avoid choices that break scans in the field.

What a QR Code Actually Stores

A QR code is a two dimensional barcode standardized under ISO/IEC 18004. It stores a sequence of bytes that can represent text, URLs, WiFi credentials, contact cards, or other structured payloads. Version 1 codes start at 21×21 modules; larger versions add rows and columns up to 177×177 for bigger datasets.

Three large finder patterns sit in the corners so software can detect orientation. Smaller alignment patterns appear in higher versions. Timing patterns help the reader map the grid. The remaining modules carry format information, version information, and the actual message bits.

When you create a code on OnestQR, the platform chooses version and error correction level automatically based on payload length and settings. Your job is to keep the printed result large enough and high contrast enough for cameras to read those modules. Sizing guidance lives in QR code best practices.

Encoding Modes: How Data Gets Compressed

QR codes support several encoding modes. The encoder picks the most efficient mode or combines modes in one symbol:

  • Numeric mode: groups digits in sets of three for compact storage. Ideal for long numbers when supported.
  • Alphanumeric mode: supports uppercase letters, digits, and a small set of symbols such as space, $, %, *, +, -, ., /, and :.
  • Byte mode: handles arbitrary 8 bit data, including lowercase URLs and UTF-8 text. Most web links use byte mode.
  • Kanji mode: optimized for Shift JIS Japanese characters.

Shorter encoded payloads produce simpler patterns with larger effective modules at a fixed print size. That is one reason OnestQR dynamic codes use a short redirect URL: the printed pattern stays less dense than encoding a long static link directly. Compare approaches in static vs dynamic QR codes.

Reed Solomon Error Correction

Real world scans are messy. Glare, partial damage, low light, and ink spread can destroy individual modules. QR codes add redundant Reed Solomon error correction codewords so the reader can reconstruct the message even when part of the pattern is unreadable.

Four levels are defined, often labeled L, M, Q, and H:

  • L (Low): recovers roughly 7% damage
  • M (Medium): recovers roughly 15% damage
  • Q (Quartile): recovers roughly 25% damage
  • H (High): recovers roughly 30% damage

Higher correction adds more codewords, which increases pattern density. That is why a logo in the center, a creative color fade, or a very small print size fights against high correction: you gain damage tolerance but need sharper camera resolution to read the extra modules.

Reed Solomon codes treat the data as polynomials over a Galois field. The encoder generates parity symbols from the message polynomial; the decoder locates erasures and fixes bit errors up to half the number of parity symbols for that block. You will never do that math manually, but the takeaway is simple: some redundancy is built in, and there is a limit. Cover too much of the code with a logo or scrape too much ink off a label and no algorithm saves the scan.

Mask Patterns and Readability

After the data and error correction bits are placed, the encoder applies one of eight mask patterns to avoid large solid areas that confuse scanners. The mask is chosen to minimize penalty rules defined in the standard, such as long runs of identical color or finder like patterns in the data region.

Format strings record which error correction level and mask were used so any compliant reader can decode the symbol. This happens invisibly when you export from OnestQR.

From Camera Frame to URL: The Scanning Pipeline

Modern phones use the camera app or a dedicated library to scan QR codes. The pipeline roughly follows these steps:

  1. Capture: the camera grabs a frame at video rate.
  2. Detection: software searches for finder patterns and determines orientation, perspective, and module grid size.
  3. Sampling: the reader maps each module to a bit, often after correcting perspective distortion.
  4. Decoding: format and version information are parsed, the mask is reversed, and error correction rebuilds the original codewords.
  5. Interpretation: the payload is parsed by type. A URL opens the browser; WiFi credentials trigger network join flows on supported OS versions.

For OnestQR dynamic codes, the URL in the pattern points to a redirect server. The server logs the scan, then forwards the user to the configured destination. That extra hop enables analytics described in how to track QR code scans.

What Breaks Scans in Practice

  • Insufficient physical size for the viewing distance
  • Low contrast between modules and background
  • Missing quiet zone margin
  • Extreme perspective on curved packaging
  • Oversized center logos that exceed error correction capacity
  • Specular glare on glossy lamination

Design choices interact with encoding density. Read custom QR code design before you push brand styling to its limits.

QR Codes vs Older Barcodes

One dimensional barcodes encode data in parallel lines. QR codes encode on both axes, which allows more capacity and built in error correction. They also include structured finder patterns so scanners do not need a laser sweep line. That design is why QR codes work from phone screens and paper alike.

Creating Reliable Codes on OnestQR

You do not select Reed Solomon level or mask manually in the dashboard. Focus on inputs that affect real world performance: keep URLs concise via dynamic redirects, maintain contrast, size for distance, and test before print. Start in the free QR code generator and verify scans on multiple devices.

For security implications of malicious payloads, see QR code security and safety.

Frequently Asked Questions

What is Reed Solomon error correction in QR codes?

It is a block error correction scheme that adds redundant codewords so scanners can recover data when modules are dirty, damaged, or blurred, up to a level dependent on L, M, Q, or H setting.

Does a bigger logo need higher error correction?

Logos cover data modules, which mimics damage. Encoders may raise correction automatically, but the better fix is a smaller logo and a larger overall print size.

Why do dynamic codes look simpler than static ones?

They encode a short redirect URL instead of a long destination link, which reduces the number of modules required. See static vs dynamic QR codes.

Can QR codes store WiFi passwords safely?

They store credentials in the encoded payload. Anyone who scans can read them. Use guest networks for public signage. Setup steps are in WiFi QR code setup.

Do all phones decode QR codes the same way?

All compliant readers follow the same standard, but camera quality, autofocus speed, and lighting vary. Always test on more than one device before mass printing.

How much data can a QR code hold?

Maximum capacity depends on version, mode, and error correction level. Marketing URLs rarely approach the limit, especially when you use OnestQR dynamic redirects.

Your next QR code is one click away

Dynamic, trackable, and editable free forever. No signup wall, no forced trial, no ads on your scans.

  • No account required
  • Edit anytime after printing
  • Real-time scan analytics
  • Zero ads on your scans