Live Tuesday, 21 July 2026
Technology

How QR Codes Work: The Black-and-White Grid Explained

What those square patterns actually store, how your camera reads them instantly, and how to scan them safely.

QR codes are everywhere now, printed on restaurant tables, product packaging, posters, and payment terminals. You point your phone camera at the square pattern, and within a fraction of a second a website opens or a menu appears. The technology behind that instant read is a small marvel of clever engineering that has been around since the 1990s, long before smartphones made it a daily habit. Understanding how a QR code stores information, and how your camera decodes it, also makes it easier to use them safely.

From Barcode to Grid

The familiar striped barcode on grocery items stores information in one dimension: the widths of vertical lines. That limits how much it can hold, usually just a short product number. A QR code, short for Quick Response code, stores data in two dimensions, using a grid of black and white squares called modules. Because it uses both horizontal and vertical space, it can hold far more, from a web address to contact details to a short block of text.

The pattern is not random. Every QR code follows a strict structure so that any compatible reader can interpret it. The data itself is converted into binary, the ones and zeros that computers use, and each black or white square represents part of that binary code.

How Your Camera Reads It

Look closely at a QR code and you will notice three large squares in the corners. These are the finding patterns, and they are the key to the code's speed. When your camera sees them, it instantly recognizes that it is looking at a QR code and works out the code's orientation, even if the phone is held sideways or upside down. Smaller alignment patterns help the reader correct for angle and curvature when the code is printed on a curved surface or photographed at a slant.

Once the reader has locked onto these markers, it maps the grid, reads each module as a one or a zero, reassembles the binary data, and converts it back into the original text or web address. All of this happens in well under a second, which is why the process feels instant.

Why Damaged Codes Still Work

One of the cleverest features of QR codes is built-in error correction. The code deliberately stores extra, redundant copies of its data using a mathematical technique, so that even if part of the pattern is smudged, torn, or covered, the reader can reconstruct the missing information. Depending on the setting chosen when the code is created, a QR code can survive losing up to roughly 30 percent of its area and still be read correctly.

This redundancy is also why companies can place a logo in the center of a QR code without breaking it. The logo covers some modules, but the error correction fills in the gap.

Using QR Codes Safely

Because a QR code simply hides a web address or command inside a pattern, you cannot tell where it leads just by looking at it. That opens the door to a scam sometimes called quishing, where a malicious code sends you to a fake login page or triggers an unwanted action. A few habits keep you safe.

  • Before opening a link, check the preview address your phone shows and make sure it matches the site you expect.
  • Be wary of QR codes stuck over the top of existing ones, especially on parking meters or payment signs, since scammers physically paste their own codes over legitimate ones.
  • Never enter passwords or payment details on a page reached from an unexpected code without confirming it is genuine.
  • Use your phone's built-in camera rather than a random third-party scanner app, which may show ads or track you.

QR codes are convenient precisely because they compress a web link into something a camera can grab in an instant. Treating the destination with the same caution you would give any link keeps that convenience from becoming a liability.

Frequently asked

How much information can a QR code hold?

A single QR code can store several thousand characters of text, though most real-world codes hold just a short web address to keep them easy to scan.

Why do QR codes still scan when they are partly damaged?

They include built-in error correction that stores redundant copies of the data, so a reader can rebuild missing parts even if up to about 30 percent of the code is obscured.

Can a QR code contain a virus?

The code itself is just data, usually a link. The risk comes from where that link leads, so treat an unexpected QR code with the same caution as any unknown link.

Do I need a special app to scan QR codes?

No. The camera app on most modern phones reads QR codes automatically, which is safer than downloading a separate scanner app.