Skip to content

Images

How QR Codes Work and Why Some Won't Scan

QR codes look like noise, but every square has a job, including repairing damage. Learn how they work and how to fix a code that won't scan.

  • ToolsBench Team
  • 6 min read

A QR code looks like static, but every square in that grid is deliberate. Understanding roughly how they work explains why some codes scan instantly and others fail, no matter how you angle your phone. QR stands for "quick response", and the format was created in 1994 by Denso Wave, a Japanese company, to track car parts on factory lines. It was designed to be read fast and from any angle, and those goals shaped everything about the pattern.

The three corner squares aren't decoration

Those three larger squares in three of the four corners are called finder patterns. They let a scanner instantly work out the code's position, size and orientation, even if the photo is taken at an angle or the code is rotated. Without them, a scanner would have to guess which way is up. With them, it is solved in a fraction of a second.

The missing fourth corner matters too. Because only three corners carry the big squares, the scanner can tell exactly how the code is turned. Larger codes also include a few smaller squares called alignment patterns, which help the scanner correct for a curved surface or a skewed camera angle. Rows of alternating dark and light modules, called timing patterns, act like a ruler so the scanner can count the grid accurately.

What is actually stored in the grid

Each small square is called a module, and each module is one bit of information: dark or light. The code stores your text as a stream of bits, then adds format information (which error correction level and mask were used), and a block of extra data used for repairs. QR codes come in 40 sizes called versions. Version 1 is a 21 by 21 grid, and each step up adds 4 modules per side, ending at version 40, which is 177 by 177. A short URL fits in a small version, while a long paragraph needs a much denser grid.

There is also a masking step. The generator tries several mask patterns that flip modules in a regular way, then keeps the one that avoids large blobs of one color or patterns that look like the finder squares. That is one reason a QR code looks like random noise even when the content is simple.

QR codes can survive being partially destroyed

This is the part most people don't expect. QR codes use Reed-Solomon error correction, the same family of math used on CDs and in deep-space communication. The format defines four levels: L recovers roughly 7% of the code, M about 15%, Q about 25% and H about 30%. That means a real chunk of the code can be smudged, scratched or covered and it will still decode correctly.

This is why some codes carry a logo in the middle. The code was generated with enough redundancy to survive it. The trade-off is that higher correction levels need more modules for the same content, so the code gets denser and each module gets smaller when printed at the same size.

Why a code sometimes won't scan

Most failures come down to a few causes:

  • Low contrast. Light gray on white, or a bright color on a slightly different bright color, leaves the scanner unable to tell dark from light. Solid dark on solid light is safest. You can check a color pair with our color contrast checker.
  • Inverted colors. A light code on a dark background is read by some scanners and ignored by others. If it matters, use dark modules on a light background.
  • No quiet zone. The blank border around the code helps the scanner find its edges. The standard recommends a border about four modules wide, so don't crop it tight or place text right against it.
  • Too small or too dense. A code with hundreds of modules printed at the size of a stamp cannot be resolved by a phone camera from arm's length.
  • Glare and curves. A glossy sticker on a bottle can wash out part of the pattern. Matte finishes scan better.
  • Too much content. A long URL forces a denser code. Shorter links give bigger, easier modules.

How to decide what to put in a QR code

Keep the payload short. A QR code can hold a URL, plain text, a wifi login, a contact card or a phone number. For printed material, a short, clean URL is almost always the best choice, because it produces a simple pattern that scans from farther away. A rough rule of thumb is that each doubling of viewing distance calls for a code roughly twice as big, so a code on a poster read from a few meters needs to be much larger than one on a business card.

One more consideration: a code that encodes a URL directly (a static code) cannot be changed after printing. If the link might change, point the code at a short address you control and update where that address leads.

A quick sanity check before printing

If a QR code is going somewhere important, such as packaging, a poster or a menu, test the exact printed proof from a normal viewing distance with two or three different phones. It costs nothing and catches the "looked fine on my laptop screen" problem before it becomes a batch of unscannable flyers. Test in poor light too, because that is where weak contrast shows up.

Need to generate one? Our QR code generator lets you pick colors and size and download a PNG, all rendered locally in your browser. If you want to check what an existing code contains, the QR code scanner decodes an uploaded image. For product labels and inventory, a linear code may suit better, which our barcode generator handles.

Common mistakes

  • Testing only on a screen and never on the printed result.
  • Stretching the code to a non-square shape, which distorts the grid.
  • Putting a large logo over the code without checking that it still scans.
  • Using a very long tracking URL that makes the pattern dense.
  • Forgetting the blank border.

Frequently asked questions

Do QR codes expire?

A static QR code, one that stores its content directly in the pattern, does not expire. It works as long as the thing it points to still exists. A code can seem to stop working when the website it links to goes offline, or when a paid service that hosts redirects is cancelled.

Can a QR code be dangerous to scan?

The code itself is just data, but the link inside could lead to a fake or harmful page. Check the address your phone shows before opening it, and be cautious with codes stuck over other codes on posters or parking meters.

What size should a QR code be?

There is no single answer, since it depends on viewing distance and how dense the code is. A code around 2 centimeters wide works for close, handheld scanning, and larger is better for anything read from farther away. Always test the printed result.

Keep reading

More on Images