Back to blog

What's Actually Hiding Inside Those Black-and-White Squares? How QR Codes Get Read

September 24, 2026 4 min read

Scanning a QR code has become almost automatic at this point — adding a friend, ordering food, paying for something, pulling up a menu. Point your camera at it and you're redirected instantly. But almost nobody stops to think about how that dense cluster of black-and-white squares actually "hides" all that information.

First, How Is It Different From a Barcode?

The barcode on a product at the grocery store is just a row of lines of varying thickness, with information laid out in a single direction (horizontally). That limits how much it can hold — usually just a string of digits. A QR code encodes information in two directions at once (horizontal and vertical), instantly multiplying its storage capacity dozens of times over. It's not limited to numbers either — it can hold an entire URL, a block of text, or even a WiFi password.

What Are Those Big Squares in the Corners For?

Notice the three prominent square patterns in the corners of a QR code, each looking like a thick square frame — these are "finder patterns" built specifically for scanning devices. No matter whether you're holding your phone tilted, upside down, or at an angle, the scanning software uses these three squares to instantly figure out the code's orientation and boundaries before it starts reading the content inside.

How Do the Black-and-White Squares Actually "Write" Information?

Each tiny square in a QR code (technically called a "module") only has two states — black or white — corresponding to binary 0 and 1. Following a fixed set of encoding rules, the text or URL you want to store gets converted into a long string of 0s and 1s, which then get filled into the grid in order, producing the black-and-white pattern we see. Scanning works in reverse: each square's black or white state gets read back into a string of 0s and 1s, which is then decoded back into the original text.

Why Can a Dirty or Torn QR Code Still Be Scanned?

The QR code standard has a built-in mechanism called "error correction," which deliberately stores extra redundant information during encoding. So even if part of the grid is covered, smudged, or printed poorly, the scanner can still reconstruct the full content using what's left. Plenty of brands stick their logo right in the middle of a QR code, and that's exactly the trick they're using — the part covered by the logo gets reconstructed by the error-correction mechanism.

You Don't Need to Understand the Theory to Make Your Own

Understanding how it works is one thing — actually making one requires none of that math. Use a QR code generator: type in a URL or some text, pick an error-correction level, and in a few seconds you'll have a working QR code. And if you need a traditional barcode for labeling a physical product, a barcode generator can produce one in whatever format standard you need.

Running the numbers: how big is a real QR code

The QR generator tool uses the open-source qrcode library (I tested with version 1.5.4) and offers four error-correction levels, L, M, Q and H, with M as the default. Under the QR standard these levels can recover roughly 7%, 15%, 25% and 30% of damaged data respectively. I generated a real code with the same library for the tool's default URL, https://example.com (19 characters). Levels L, M and Q all produce version 2, a 25 x 25 module grid. At level H the version rises to 3, a 29 x 29 grid, to make room for more error-correction data. With a longer 42-character URL, L and M give version 3 (29 x 29), Q gives version 4 (33 x 33) and H gives version 5 (37 x 37). So for the same content, a higher correction level needs more modules and a denser pattern. This is also why the tool automatically switches L or M to H when you upload a center logo: the modules the logo covers have to be rebuilt from the correction data.

A lot of technology looks like black magic until you actually take it apart — once you do, the logic underneath is often refreshingly simple. Hopefully next time you scan a code, you'll get a little "oh, that's how it works" moment.

Tools mentioned in this article