# What is actually inside the black squares of a QR code?

> You can scratch a QR code, cover a corner with a thumb, even stick a logo on it, and it still scans. That is not luck. It is a 1990s car factory trick and some very clever maths.

Published 2026-10-07 by Toolcloak. 6 minute read. Original: https://toolcloak.pages.dev/articles/whats-inside-the-black-squares-of-a-qr-code
Related free tool: [QR Code Generator](https://toolcloak.pages.dev/tools/qr-generator)

Look at a QR code on a restaurant table. It is torn at one corner, there is a coffee ring across it, and your phone reads it in half a second anyway. Try that with a barcode on a packet of biscuits and the till will beep angrily.

The difference is that a QR code was designed to be **wrong and still work**. Once you know how, you also know how to make ones that never fail at the worst moment, which is usually the moment after the printer has finished a thousand flyers.

## Born in a car factory

QR stands for Quick Response. It was created in 1994 at Denso Wave, a company in the Toyota group, to track car parts as they moved through factories. Ordinary barcodes held a handful of digits and had to be scanned straight on, one line at a time. The factory needed to hold more and to scan quickly from any angle, on dirty, scuffed parts.

Denso Wave holds the patent but chose not to enforce it and published the standard openly, which is a big reason you now see these squares on everything from bus tickets to wedding invitations.

## Reading the square

Every QR code is a grid of tiny squares called **modules**, each one either dark or light. Here is what your phone does with it in a blink:

**From camera to answer**

1. **Find the three big squares.** These corner marks are the same in every code. They tell the phone where the code is and which way up it is.
2. **Straighten it.** A smaller square pattern helps correct for tilt, curves and perspective.
3. **Read the grid.** Dark and light modules become ones and zeros, in a fixed zig-zag order.
4. **Repair the damage.** Extra error-correction data is used to fix any modules that were unreadable.
5. **Hand over the text.** A link opens, a phone number dials, plain text appears.

Notice that there is no fourth big square. Three corners are enough, and their layout is what tells the phone which way is up, so you can scan a code upside down or sideways and it still reads.

## The part that makes it tough: error correction

Some of the modules in every code are not your data. They are **repair information**, calculated with a type of maths called Reed-Solomon coding (the same family used in CDs and in space communications). If part of the code is damaged, the phone uses the repair information to rebuild what was lost.

When you make a code you choose how much repair information to include:

| Level | Can lose up to | Best for |
| --- | --- | --- |
| **L**, Low | about 7% | Clean screens, short codes you want as simple as possible |
| **M**, Medium | about 15% | A sensible default for most printing and screens |
| **Q**, Quartile | about 25% | Posters, packaging, anything that will be handled |
| **H**, High | about 30% | Codes with a logo in the middle, or outdoor and rough surfaces |

*The percentage is the share of the code that can be unreadable while still decoding. Higher levels cost you extra modules.*

There is a trade. More repair data means more squares, which means each square must be smaller, which makes the code harder to scan from far away. That is the whole game: **robust or simple, pick based on where it will live**.

The logo-in-the-middle codes you see on brands are using that built-in repair capacity on purpose. They cover the centre and trust the error correction to fill it in. That is why they are normally made at level H, and why putting a big logo on a level L code makes it fail.

Try it: [QR Code Generator](https://toolcloak.pages.dev/tools/qr-generator). Paste a link, text, email or phone number, pick a size, download the PNG.

## Shorter content, better code

Codes come in 40 sizes called versions. Version 1 is 21 by 21 modules and each step up adds four to each side, up to 177 by 177 at version 40. The more you put inside, the bigger the version, and the smaller each module is for a given printed size.

**Modules along one side of a QR code**

|  | Modules per side |
| --- | --- |
| Version 1, a few digits | 21 |
| Version 5 | 37 |
| Version 10, a longer web link | 57 |
| Version 25 | 117 |
| Version 40, the maximum | 177 |

*At the top end a code can hold around 7,000 digits or about 3,000 bytes of text. Almost nobody needs that, and a code that dense is hard for a phone to read from a table.*

The practical lesson: **use a short link**. A link of 25 characters makes a code with big, forgiving squares. A link of 250 characters, full of tracking parameters, makes a dense code that needs a steady hand and good light. If your address is long, put a short redirect page on your own site and encode that.

## Static or dynamic?

This distinction decides whether your code will work in five years.

- A **static** code contains the information itself. The link, the text or the phone number is written into the squares. It works forever, needs no account and nobody can switch it off. You also cannot change it afterwards.
- A **dynamic** code contains a short address that belongs to a company, which then redirects the visitor to your real link. You can edit the destination and see scan counts. If you stop paying, the code can die, and so can every poster you printed.

The codes you make here are static. For a menu, a Wi-Fi password, a contact number, a link on a business card, that is usually the right choice. If you truly need scan analytics or a changing target, a dynamic service is the honest answer, but you are renting the code.

## Print rules that save you a reprint

- **Quiet zone.** Leave an empty margin at least four modules wide around the code. Text or a border pressed up against it confuses the scanner.
- **Contrast.** Dark code on a light background. Avoid pale colours and be careful with inverted (light on dark) codes, which some scanners cannot read.
- **Size.** Around 2 cm square is a sensible minimum for things held in the hand. A common rule of thumb for distance is about ten times the code's width, so a 10 cm code works from roughly a metre.
- **Surface.** Glossy, curved or wrinkled surfaces bend the grid. Use higher error correction and test on the real object.
- **Test before the print run.** Scan with two different phones, an older one included, in poor light, from the distance a real person will use.

## A neat trick: Wi-Fi in a code

Phone cameras understand a special text format for Wi-Fi networks. Create a code from plain text in this form:

`WIFI:T:WPA;S:YourNetworkName;P:YourPassword;;`

Replace the name and password, generate the code, print it and stick it near the router. Guests point a camera at it and join without typing a single letter. Our [Wi-Fi QR Code Generator](https://toolcloak.pages.dev/tools/wifi-qr-code-generator) builds that text for you from two boxes. Two cautions: anyone who can see the code can read the password, so this suits a guest network and not your main one. And these online generators, ours included, draw the image through an outside QR service, so a password you care about deserves a generator that works fully offline.

## One last warning

> **Look before you open:** A QR code is just a link in disguise, and you cannot read it with your eyes. Scammers stick fake codes over real ones on parking meters and posters. Your phone shows the web address before it opens. Read it, and be extra careful whenever a code asks for a payment or a login.

## Frequently asked questions

### Do QR codes expire?

A static QR code, which holds the link or text inside the squares, never expires. A dynamic code can stop working if the service that redirects it is cancelled or you stop paying.

### What error correction level should I choose?

Level M is a good default. Use Q or H for printed material that may get scuffed, and H if you plan to place a logo in the middle. Level L suits clean, on-screen codes where you want the fewest modules.

### What size should a printed QR code be?

At least about 2 cm square for things held in the hand, and larger for posters. A common rule of thumb is a distance of roughly ten times the code's width. Always leave a blank margin around it and test the real print.

### Why will my QR code not scan?

The usual causes are too much data (a very long link), low contrast, no blank margin around the code, a code printed too small, or a logo that covers more than the error correction can repair. Shorten the link, raise the error correction and enlarge it.

### Can I put a QR code on a business card?

Yes. Keep the link short, use at least level M, print it at 2 cm or more, and encode a page you control so you can update what visitors see.

