Start free 14 days free
QR codes 9 min

How a QR code works: the mechanism explained in plain terms

Modules, finder patterns, error correction, versions and camera scanning: how a QR code actually works, explained for restaurant owners.

What is a QR code and what is it made of?

A QR code is a two-dimensional barcode. Where a traditional barcode lines up vertical bars that can only be read along a single axis, a QR code stores information along two axes: width and height. That is what accounts for the difference in capacity between the two formats.

It was developed in 1994 by engineer Masahiro Hara at Denso-Wave, a subsidiary of the Toyota group. The goal was to track parts on assembly lines faster than barcodes allowed. Hence the name: quick response.

In practice, it is a square grid made up of small black and white cells called modules. Each module carries one bit: black for 1, white for 0. Put together, those modules form a binary message. The grid holds the information as patterns that are anything but random, even if the human eye only sees a drawing.

The technology has been royalty-free from the start. Denso-Wave chose not to charge for its use, which explains why these codes now turn up everywhere: ticketing, mobile payment, social media, logistics labels, digital business cards, restaurant menus.

The structure of the matrix: what the patterns are for

Blow a QR code up and you will see it is organised. Three large squares sit in the corners, a white area surrounds the whole thing, lines of dots run across the matrix. Every element has a specific job.

The finder patterns in three corners

These are the three concentric squares placed in the top left, top right and bottom left. They let the reader locate the code within the image and work out its orientation. The fourth corner is deliberately left empty: that asymmetry is what indicates which way round the code should be read.

The practical upshot: you can scan a QR code upside down, tilted at 45 degrees or photographed at an angle. The software straightens the matrix before decoding it. That is a real advantage in the dining room, where nobody holds their phone perfectly flat over the table.

The other markers in the grid

  • The quiet zone: the white margin around the code, at least 4 modules wide. Without it, the reader cannot tell where the matrix begins.
  • The timing patterns: the alternating black and white lines that connect the finder patterns and set the exact scale of a single module.
  • The alignment patterns: extra small squares that correct distortion when the code is printed on a curved surface or photographed at an angle.
  • The format area: a 15-bit band placed around the main finder pattern. It states the error correction level and the mask that has been applied.

This format area is read first. Without it, the device would have no idea how to interpret the rest of the data. It is in fact duplicated in two places, so it survives a localised smudge.

Versions and how much data is stored

There are 40 versions of QR code. Version 1 measures 21 modules per side, version 40 measures 177. The higher the version, the more content the code can hold, but the finer the modules become for the same printed surface.

Capacity also depends on the encoding mode used. Numeric mode, limited to digits, is the densest: up to 7,089 characters. Alphanumeric mode, which accepts capital letters and a few symbols, tops out at 4,296 characters. Byte mode, the one used for a URL or accented text, drops to 2,953 characters.

These figures are theoretical maximums, reached with the weakest error correction. In practice, a generator automatically picks the smallest version capable of holding your data. That is why a short URL produces a visually simple code, while a long string produces a dense one that is hard to read from a distance.

On the ground, the rule holds consistently: the shorter the encoded address, the faster the scan. A menu QR code pointing to a 25-character URL is read in a fraction of a second, even on an older device.

Reed-Solomon error correction: why a damaged code still works

This is the most interesting mechanism of all. The data is not simply written into the matrix: it comes with redundancy bits calculated by the Reed-Solomon algorithm, the same principle used on CDs and in satellite transmissions.

Four correction levels are available:

  • Level L: around 7% of the surface can be destroyed or covered.
  • Level M: around 15%. This is the default setting in most tools.
  • Level Q: around 25%.
  • Level H: around 30%, at the cost of a larger matrix.

The decoder does not just spot the errors, it rebuilds them. A splash of sauce, a dog-eared corner, a scratch on the table tent: as long as the finder patterns remain visible and the damage stays below the threshold for the chosen level, the code still works. This is also what makes it possible to place a logo in the middle of a QR code without making it unreadable.

One word of caution: level H does not license everything. If the logo covers a finder pattern, no amount of correction will save it. Some heavily decorated codes become unreliable depending on the light.

What happens when you scan with your camera

Since iOS 11 and Android 9, reading is built in: no dedicated app to install. You open the camera, point it, and a notification appears. Within a few dozen milliseconds, the phone runs through several operations.

  • It captures an image, converts it to greyscale and then to pure black and white (binarisation).
  • It looks for the three finder patterns and deduces the code's position, size and tilt.
  • It straightens the grid, reads the format area and removes the mask applied to the modules.
  • It reassembles the binary stream, applies Reed-Solomon to repair whatever is damaged, then turns the bits into characters.

The result is a text string. If it starts with http, the system offers to open the corresponding web page. If it contains a number, it offers to call it. Users never have to type anything at all: that is the whole point.

The principle is identical for a photo already saved in the gallery. On Samsung devices, Google Lens and the built-in reader do the same job. On a computer, you need a browser extension or you upload the image to an online decoder. The mechanics do not change, only the point of entry.

Static or dynamic QR code: the distinction that matters

Two types of code coexist, and the difference is not cosmetic. It determines what you will be able to do with your menu six months from now.

A static QR code encodes the data directly into the matrix. The address is physically etched into the black and white modules. Changing the destination means generating a new code and reprinting every piece of material.

A dynamic QR code encodes a short redirect URL. The code points to a server, which then forwards to the final page. The matrix never changes, but the destination can be edited in two clicks from a dashboard.

CriterionStatic QR codeDynamic QR code
Encoded contentThe final data, hard-codedA short redirect URL
Changes after printingImpossible, requires reprintingImmediate, no need to touch the printed item
Matrix densityHigh if the address is longLow, so scanning is faster
Scan statisticsNoneNumber of scans, times, device
Reliance on a serviceNone, the code stands aloneThe redirect service has to stay live

How a dynamic QR code works in practice

The customer scans, their browser calls the short URL, the server responds with a redirect and displays the intended page. The operation adds a few dozen milliseconds, which nobody notices. Along the way, the server logs the event: date, time, type of phone, sometimes the phone's language.

For a restaurant owner, that data changes the conversation. You know how many covers actually look at the menu, at what time, and whether tourists switch to English. That is exactly what the online menu management features built for this use case are for.

Creating, securing and using a QR code without getting it wrong

How to create a QR code

The principle is straightforward: you pick a content type (URL, text, wifi, business card, phone number), you enter it, the tool calculates the matrix and hands you an image. Plenty of free services offer this. To generate a code built to last, go for a tool that offers dynamic mode and a vector export, otherwise large-format printing will come out blurry.

Drawbacks and limits

The QR code is not perfect. You need a network connection to open the page, enough light, and a clean surface. Older customers cannot always manage the process on their own. A code that is too small, printed under 2 cm per side, becomes hit-and-miss.

There is also a risk of tampering. Bad actors stick a sticker over the original code to redirect people to a fraudulent site. The defence is basic: check your table materials in the dining room, print the domain name in plain text under the code, and use a recognisable domain. A QR code cannot install software by itself; the danger comes from the page that opens afterwards, not from the matrix.

Uses beyond the menu

QR codes can be used for plenty of other services: access to the venue's wifi, leaving a review, allergen information, bookings, payment. They can store a full text offline when no connection is available. They can also carry a one-off marketing campaign, a game or a loyalty card.

Putting it to work on a restaurant menu

On a table, the QR code replaces the server handing out paper menus. The customer takes out their phone, points it at the table tent, and the menu appears. No app to install, no account to create.

Dynamic mode really comes into its own here. You change the dish of the day at 11am and the menu is up to date on every table by 11:01. Run out of fish? You hide the line. A price increase? It applies everywhere, without reprinting 60 table tents at €1.50 apiece.

The digital format also makes compliance easier, particularly when it comes to displaying mandatory information and allergens, which on paper has to be redone with every change. And it opens the door to automatic translation for foreign customers.

One last point that often gets overlooked: the quality of the printed item. Print the code at 3 cm per side minimum, on a light background, with its white margin intact, and test it on at least three different phones before rolling it out in the dining room. If you are starting from scratch, setting up a menu accessible by QR code usually takes less than a day, photos included.

Related reading

See all