Guides

How Do QR Codes Work? A Plain-English Guide

Desmond Okafor··8 min read

A QR code can lose a corner, take a coffee stain, or wear a company logo stamped right across its middle — and still scan on the first try. That's not luck, and it's not the camera being clever. It's the single most interesting decision baked into the format, and once you see how a QR code is actually built, that little logo-in-the-center trick stops looking like magic and starts looking like arithmetic.

By the end of this you'll be able to look at any QR code and name what each part is doing — the big corner squares, the speckled data area, the quiet border — and explain why it survives damage. No math degree required. Think of it like reading a map: once you know what the symbols mean, the whole thing opens up.

A QR code is just a grid, and every square has a job

Start with the raw material. A QR code is a square grid of smaller squares, and each of those little squares is called a module. A black module means 1, a white module means 0. So a QR code is, quite literally, a picture of binary — the same 1s and 0s you'd get if you ran text through a text to binary converter, just arranged in two dimensions instead of a single line.

The grid comes in fixed sizes called versions. Version 1 is 21 modules across, version 2 is 25, and they climb in steps of 4 all the way up to version 40 at 177×177. Bigger version, more squares, more room for data. That's the whole trade-off — a code holding a long URL needs more modules than one holding the word hello.

Not every module carries your data, though. A good chunk of the grid is reserved for structure: the patterns that make the code findable and readable. Here's where it gets clever.

The three big squares are how your phone finds north

Look at any QR code and you'll spot three large square targets — top-left, top-right, bottom-left. Those are finder patterns, and they are the reason you can wave your phone at a code sideways, upside down, or from across a café table and it still locks on.

Why three and not four? Because three corners define orientation and the missing fourth tells the scanner which way is up. Picture a map with landmarks at three corners: the moment you identify all three, you know exactly how the map is rotated, even if someone handed it to you upside down. A scanner does the same — it hunts for that distinctive dark-light-dark-light-dark ratio (the finder pattern has a consistent proportion no matter the code's size), pins the three corners, and instantly knows the code's position, rotation, and scale. On larger codes a smaller alignment pattern sits near the fourth corner to correct for the warp you get photographing a curved or tilted surface.

If that clicked, the rest is downhill. The finders solve where is the code and which way is it facing. Everything else is about what does it say.

How your text becomes black and white squares

Say you want a code that opens https://codeutilitykit.com. The encoder does a few things in order.

First it picks a mode. QR supports a numeric mode, an efficient alphanumeric mode (uppercase letters, digits, and a handful of symbols), and a byte mode for everything else — which is what a normal URL with lowercase letters and a slash uses. In byte mode the text is turned into bytes using UTF-8, the same byte encoding the whole web runs on; if you want the deeper story there, see what UTF-8 is. If your data is only digits, numeric mode packs them far tighter, which is why a code holding a plain number can stay small.

Then those bytes get laid into the grid — not left-to-right like reading a page, but along a fixed zig-zag path that snakes up and down two columns at a time, starting from the bottom-right and stepping around the reserved patterns. The path is part of the standard, so every scanner reads it the same way.

There's one more step that trips people up: masking. If the raw data happened to produce a big blank area or a pattern that looks like a finder square, scanners would choke. So the encoder tries several fixed mask patterns — think of them as checkerboards it XORs over the data — and keeps whichever one spreads the black and white most evenly. That's why two codes for nearly identical text can look completely different: same message, different mask. This whole pipeline is exactly what a QR code generator automates for you in a single click; and if the data you're encoding is a link with query parameters, running it through a URL encoder first keeps special characters from breaking the destination.

Why a damaged code still scans

Now the good part — the promise I opened with. Before the encoder finalizes the grid, it calculates error-correction data using a method called Reed–Solomon coding. In plain terms: it works out a set of extra values that let a scanner reconstruct the original message even if some of it arrives garbled or missing.

You choose how much redundancy to spend. There are four levels — L, M, Q, and H — recovering roughly 7%, 15%, 25%, and 30% of the code respectively. Pick level H and nearly a third of the modules can be destroyed and the message still comes back intact. The cost is space: more recovery data means fewer modules left for your actual content, so a high-correction code has to be physically larger or hold less.

It's a bit like writing a phone number down twice on the same sticky note. Coffee soaks half the note, but between the two copies you can still reconstruct every digit. Reed–Solomon is a much smarter version of that idea — it doesn't just duplicate, it stores relationships that can rebuild missing pieces — but the instinct is the same: pay a little extra now so damage later isn't fatal.

The logo in the middle is just planned damage

So how do brands put a logo in the center of their QR code? They're not doing anything special to the format. They're spending the error-correction budget on purpose.

The logo covers some modules, which is exactly the kind of damage level H (or Q) was built to survive. As long as the covered area stays under the recovery threshold and doesn't sit on top of the three finder patterns, the scanner rebuilds the hidden data and never knows the difference. Push the logo too big, or slap it over a corner finder, and the code dies — because now you've broken orientation, not just data. That's the honest limit worth knowing: error correction protects the message, not the finders.

What this means when you make one

Two practical takeaways fall out of all this. If you need a code that'll be printed small, weather a rough environment, or carry a logo, bump the error-correction level up. If you need to cram in maximum data, keep the URL short (or shorten it) so you can use a smaller version that scans faster from farther away.

And the security point, because it matters: a QR code is an encoding, not encryption. Everything in it is readable by anyone — it's closer to Base64 than to a lock. The scrambled look is not secrecy. When a code carries a link, the only question that matters is where that link actually goes.

That's the whole machine. Three squares to find it, a zig-zag path to read it, a mask to keep it legible, and Reed–Solomon redundancy so a stain or a logo can't kill it. Want to watch it happen? Type anything into the QR code generator, then cover part of the result with your thumb and scan it — the message comes through anyway. That's the arithmetic doing its job.

Try the tools

Frequently Asked Questions

How do QR codes work in simple terms?

A QR code is a grid of tiny black and white squares. Black counts as a 1, white as a 0, so the grid is really a picture of binary data. Your phone's camera finds the three big corner squares to line the code up, reads the small squares in a set order, converts the bits back into text or a URL, and acts on it. The error-correction data mixed in means it still reads even if part of the code is dirty or hidden.

What are the three big squares in the corners of a QR code?

They're called finder patterns. Their job is orientation: because there are exactly three (not four), a scanner can tell which way is up and correct for the code being rotated, tilted, or photographed at an angle. A smaller alignment pattern near the fourth corner helps the scanner correct for warping on bigger codes.

How much data can a QR code hold?

It depends on the size (the 'version', from 21×21 up to 177×177 modules) and the data type. At maximum size a QR code holds up to about 7,089 numeric digits, roughly 4,296 alphanumeric characters, or about 2,953 bytes. In practice most codes store a short URL, so they stay small and easy to scan.

Why does a QR code still scan when it's damaged or has a logo on it?

Reed–Solomon error correction. When the code is built, extra recovery data is calculated and stored alongside the real data. There are four levels (L, M, Q, H); at the highest, about 30% of the modules can be missing and the scanner can still reconstruct the message. A center logo simply eats into that recovery budget on purpose.

Are QR codes encrypted or secure?

No. A QR code is just an encoding, not encryption — anyone with a scanner can read exactly what's stored, the same way anyone can read text. Don't treat the scrambled look as secrecy. If a code carries a link, the safety question is where that link goes, not the code itself.

DO

Desmond Okafor writes for CodeUtilityKit, where the team builds free, privacy-first developer tools that run entirely in your browser. Every guide is written and reviewed by developers who use these tools daily.