How Do QR Codes Actually Work?

You point your phone at a black-and-white square and instantly land on a website, Wi-Fi network, or contact card. But what is actually happening between the pattern and the result? Here is a plain-language breakdown of how QR codes store, protect, and deliver data.

The Basics: A 2D Grid of Modules

A QR code is a two-dimensional matrix made up of small black and white squares called modules. Unlike a traditional barcode that only encodes data in one direction (horizontally), a QR code encodes data both horizontally and vertically. That is why it can pack far more information into a much smaller space.

The smallest QR code (Version 1) is a 21 × 21 grid. The largest (Version 40) is 177 × 177. Each step up adds four modules per side and significantly increases capacity. Most QR codes you encounter in daily life fall somewhere between Version 2 and Version 10 — large enough to hold a URL but small enough to scan quickly.

The black and white modules represent binary data — ones and zeros — arranged according to a strict specification maintained by the ISO (ISO/IEC 18004). Your phone's camera doesn't "see" a picture; it reads a structured data stream.

Finder Patterns and Alignment

Look at any QR code and you will notice three large squares in three of the four corners. These are finder patterns, and they are essential. They tell the scanner where the code begins, how it is oriented, and how large the modules are.

Because there are three finder patterns, a scanner can detect the code from any angle — upside down, rotated 90 degrees, even slightly tilted. This is a big part of why QR codes scan so reliably compared to one-dimensional barcodes, which need to be aligned almost perfectly.

Larger QR codes also include smaller alignment patterns scattered across the grid. These help the scanner correct for distortion — for example, when a code is printed on a curved surface like a bottle or viewed at a steep angle.

How Data Gets Encoded

The actual data in a QR code is encoded in a specific path that winds through the grid, avoiding the finder patterns and other reserved areas. The encoding process works like this:

  1. Choose a mode. QR codes support four encoding modes: numeric (digits only, most efficient), alphanumeric (digits + uppercase letters + a few symbols), byte (any character via UTF-8), and kanji. The mode determines how many bits each character needs.
  2. Convert to binary. Your text, URL, or other data is converted into a binary string according to the chosen mode.
  3. Add error correction. Extra parity data is generated using Reed-Solomon codes (more on this below).
  4. Map to modules. The binary stream is placed into the grid following a precise pattern, with a mask applied to ensure the code has a good balance of black and white modules for reliable scanning.

This is why shorter data produces simpler, easier-to-scan codes. A 20-character URL needs far fewer modules than a 300-character vCard, which results in a less dense pattern and faster reads.

Error Correction: Why Damaged Codes Still Work

One of the most impressive features of QR codes is error correction. Every QR code includes redundant data calculated using Reed-Solomon algorithms — the same math used in CDs, DVDs, and deep-space communication.

There are four error correction levels:

  • L (Low): recovers up to 7% of damaged data
  • M (Medium): recovers up to 15%
  • Q (Quartile): recovers up to 25%
  • H (High): recovers up to 30%

This is why a QR code can still scan even when it is partially scratched, dirty, or has a logo placed over part of it. Higher error correction means more resilience, but it also means more modules are used for parity data, leaving less room for actual content. Most QR code generators default to M or Q as a practical balance.

What Happens When You Scan

When you open your phone's camera and point it at a QR code, several things happen in rapid succession:

  1. The camera detects the three finder patterns and calculates the code's size, orientation, and module dimensions.
  2. The scanner reads the format information (error correction level, mask pattern) from reserved areas near the finder patterns.
  3. It samples every module in the data region, converting each to a 1 or 0.
  4. The error correction algorithm checks for and repairs any corrupted modules.
  5. The binary data is decoded back into text using the encoding mode specified in the code.
  6. Your phone interprets the result — opening a URL, connecting to Wi-Fi, adding a contact, or simply displaying the text.

This entire process takes milliseconds. Modern smartphone cameras are remarkably good at it, even in low light or at an angle, thanks to the structural features built into the QR code specification.

TL;DR

QR codes are 2D grids of black and white modules that encode binary data. Finder patterns let scanners detect orientation instantly, and Reed-Solomon error correction means codes work even when partially damaged. Your phone decodes the whole thing in milliseconds.

Frequently Asked Questions

Can QR codes store any type of data?

QR codes can store text, URLs, phone numbers, Wi-Fi credentials, vCards, email addresses, calendar events, and more. The data is always text-based — what changes is how your phone interprets it.

Why do some QR codes look more complex than others?

More data means more modules, which means a denser pattern. A QR code linking to a short URL will look much simpler than one containing a full contact card. Higher error correction levels also add complexity.

Do QR codes work without internet?

The scanning itself does not require internet — your phone reads the code locally. But if the code contains a URL, you will need internet to open it. Codes that contain plain text, Wi-Fi credentials, or contact info work fully offline.

Ready to create your QR code?

Generate static and smart QR codes right from your iPhone or iPad.

Get MQRG on the App Store

Related Articles