← Back to blog

QR Code / Barcode / Digital safety

How QR Codes Work: Structure, Scanning, Reliability, and Safety

PetexSpace

A QR Code is not a picture that points to information stored somewhere else. The black and light modules encode the payload itself, along with information that helps a scanner locate, interpret, and recover the symbol. The payload is often a URL, but it can also represent text, contact details, Wi-Fi settings, or other data understood by the scanning application.

QR Code was developed by DENSO WAVE and standardized internationally as ISO/IEC 18004. The commonly seen Model 2 format has 40 versions. Version 1 contains a 21 by 21 module grid. Each higher version adds four modules per side, reaching 177 by 177 at Version 40.

The parts you can see

  • Finder patterns: the three large nested squares help the scanner locate the code and determine its orientation.
  • Separators and quiet zone: light space prevents the finder patterns and full symbol from blending into nearby content.
  • Timing patterns: alternating modules help the scanner establish the grid spacing.
  • Alignment patterns: additional targets help correct perspective and distortion in larger versions.
  • Format and version information: reserved modules describe error-correction and masking details needed for decoding.
  • Data and error-correction modules: the remaining structured path stores the encoded payload and recovery information.
QR Code anatomy showing three finder patterns, timing modules, data area, and quiet zone
The large corner squares locate the symbol. The surrounding quiet zone keeps nearby graphics from confusing the scanner.

How a scanner reads the symbol

  1. The camera captures an image and finds the high-contrast corner patterns.
  2. The scanner estimates orientation, perspective, module size, and the boundaries of the grid.
  3. It samples the light and dark modules, then reads format and version information.
  4. The mask is reversed and codewords are reconstructed in the specified order.
  5. Error correction attempts to recover damaged or unreadable codewords.
  6. The data segments are decoded into text or another payload for the application to interpret.

The scanner needs clean geometry more than visual decoration. Resizing a QR image with smoothing can blur module edges. Stretching it changes squares into rectangles. Placing a logo, text, or pattern over the modules removes data and forces error correction to compensate. A design may scan on one phone under ideal light and fail on another device, print size, angle, or surface.

Error correction is useful, but not magic

QR Code provides four standard error-correction levels: L, M, Q, and H. DENSO WAVE describes approximate restoration levels of 7, 15, 25, and 30 percent of total codewords. Higher correction uses more space, which can make the symbol denser or require a larger version for the same payload.

Those percentages are not permission to cover the same fraction anywhere you like. Damage to finder patterns, severe blur, low contrast, distortion, or a missing quiet zone can prevent the scanner from locating the grid at all. Recovery also depends on how damage is distributed. Test the final printed or displayed result, not only the original file.

Why a QR Code becomes larger or denser

Capacity depends on the version, error-correction level, and data mode. Numeric data can be encoded more compactly than arbitrary bytes. A short URL often produces a simpler symbol than a long URL filled with tracking parameters. Adding more data or choosing stronger correction can move the code to a larger version with more modules.

DENSO WAVE lists a theoretical maximum of 7,089 numeric characters for Model 2 Version 40 at the lowest error-correction level. That limit is not a practical target for phone scanning. A compact payload, adequate physical module size, high contrast, and a four-module quiet zone are usually more useful than maximizing capacity.

How to create a reliable QR Code

  1. Use the shortest accurate payload you control. Remove unnecessary tracking parameters when they are not required.
  2. Keep dark modules on a light, plain background with strong contrast.
  3. Preserve a quiet zone at least four modules wide around a standard QR Code.
  4. Resize with nearest-neighbor or vector output so module edges remain square and crisp.
  5. Do not stretch the symbol or place graphics over structural patterns.
  6. Test at the final display or print size with several devices, distances, angles, and lighting conditions.

You can use the PetexSpace QR Code creator for common payloads, then verify the result with the QR Code reader. Reading your own exported file catches truncation, formatting, and scan problems before the code is shared.

Phone decoding a QR Code and inspecting its destination before opening it
Scanning reveals a payload. It does not prove that the destination is safe, so inspect the result before continuing.

A scan is data, not a trust signal

A QR Code can hide a destination from casual view. Before opening a decoded link, inspect the domain and look for misspellings, unexpected subdomains, or a different destination than the sign or message promised. Be cautious when a code asks for credentials, payment, application installation, device permissions, or urgent action.

  • Prefer the built-in camera preview or a reader that shows the decoded destination before opening it.
  • Do not assume a printed code is trustworthy because the surrounding sign looks professional. A sticker can cover the original code.
  • If the destination asks you to sign in, open the known service independently when practical.
  • Treat downloaded files and configuration prompts with the same caution as links received by email or message.

The essential idea

The three corner patterns help a scanner find the grid. The remaining structure tells it how to read and repair the payload. Reliable codes preserve geometry, contrast, module size, and quiet space. Safe scanning adds one more step: inspect what was decoded before trusting where it leads.

Primary references

DENSO WAVE: QR Code features and structure. DENSO WAVE: error correction. DENSO WAVE: required quiet zone.