QR Studio
Back
← Blog

How a QR code works and how your phone reads it

Last updated: 09/15/2026

You point the camera, see a little square for half a second, and your phone already shows you the link. It feels like magic, but it's geometry, math, and some well-thought-out redundancy. Here's what a QR code looks like on the inside and how it gets decoded.

The anatomy of a QR code

A QR code is a square grid of black and white cells called modules. Within that grid there are zones with a fixed role, always in the same relative position:

  1. Position patterns: the three large squares in the corners.
  2. Timing pattern: the dashed line crossing the center.
  3. Data area: the rest of the modules, holding the encoded information.
  4. Quiet zone: the white margin around the entire code.

From your data to the grid

When you generate a QR code, the text, URL, or WiFi data is first converted to binary and grouped according to its content type (numeric, alphanumeric, free text). On top of that comes the error-correction information, calculated with an algorithm called Reed–Solomon (the same kind of math used to keep a scratched CD playing fine). All those bits get arranged in the grid following a zigzag pattern, and finally one of eight possible “masks” is applied: a pattern that mixes up the modules to avoid overly uniform white or black areas, which are harder for a camera to read.

How the camera decodes it

When you point your phone at it, the process happens in just a few video frames:

  1. The software scans the image for the three characteristic position patterns (a 1:1:3:1:1 stripe ratio), which are quite rare in “normal” photos, so they're detected fast.
  2. Using those three points, it calculates the code's orientation, size, and perspective, correcting for distortion if the photo wasn't taken head-on.
  3. It uses the timing patterns to trace the exact grid and “samples” each module, reading it as 0 (white) or 1 (black).
  4. It removes the mask applied when the code was generated (that info lives in the format zone) to recover the original data.
  5. It applies Reed–Solomon error correction: if some modules weren't read correctly (due to dirt, a logo, a tear), it mathematically rebuilds them from the stored redundancy.
  6. It converts the resulting bits back into text and acts based on the data type: opens the browser for a URL, offers to connect for WiFi, shows the text for plain text.

Why it sometimes won't scan

It's almost always one of these reasons: too little contrast between the chosen colors, a cropped or too-thin white margin, a code too small for the scanning distance, or a logo too large for the configured error-correction level.

Now that you know how it works, try making one!

Go to generator