What is a QR code and how does it work?

A plain-English explanation of the squares: finder patterns, error correction, data capacity and what your phone does when it reads one.

Updated 5 December 2026 · 8 min read

A QR code is a square barcode that a camera can read in a fraction of a second. This guide explains what is actually inside one, why a damaged code often still works, and what your phone does the moment it recognises one.

Where QR codes came from

QR stands for Quick Response. The format was developed in 1994 by Masahiro Hara at Denso Wave, a Japanese automotive supplier, to track parts on a production line faster than the standard barcode allowed. A conventional barcode stores data in one dimension — a row of varying-width bars — so its capacity is tiny and it has to be scanned along a single line. Hara's design stored data in two dimensions, which meant far more information in the same square of label, and reading was possible from any angle rather than only head-on.

The company chose not to exercise its patent rights over the format, and in the years that followed QR codes spread from factories to advertising, ticketing and eventually every phone camera on earth. "QR Code" is a registered trademark of DENSO WAVE INCORPORATED; the specification itself is published and free to implement.

What is inside a QR code

Look closely at any QR code and you will see the same structures every time:

  • Finder patterns. The three large squares in three corners. They let the scanner locate the code, work out its orientation, and correct for perspective — which is why a code photographed at an angle still reads.
  • Timing patterns. A dashed line of alternating modules running between the finder patterns, used to work out the grid spacing even when the code is slightly distorted.
  • Alignment patterns. Smaller squares scattered inside larger codes (version 2 and above) that correct for curvature and lens distortion.
  • Format and version information. Small strips of modules that state which error-correction level and which mask pattern are in use, so the scanner can decode the rest correctly.
  • Data and error-correction modules. Everything else: the encoded text plus the redundancy that lets the scanner rebuild missing pieces.
  • The quiet zone. The blank margin around the code. It is not decoration — without it, scanners struggle to find the edge of the symbol. Four modules wide is the standard minimum.

How the data is stored

A QR code is a grid of modules, each either dark or light. The grid size is defined by a version number from 1 to 40: version 1 is 21×21 modules, and each version adds four modules per side, up to version 40 at 177×177. More modules means more capacity and a denser pattern, which is why a very long web address produces a code that looks busy and needs to be printed larger.

Text is packed into the grid using one of four encoding modes, chosen automatically for efficiency:

ModeStoresBest for
NumericDigits 0–9 onlyLong numbers, ticket IDs
AlphanumericDigits, upper-case letters and a few symbolsShort codes, tracking references
ByteAny data as 8-bit bytes, usually UTF-8URLs, text in any language, vCards
KanjiJapanese characters, compactlyJapanese text

Capacity depends on both the mode and the error-correction level. A version 40 code at the lowest error correction holds up to 7,089 numeric characters, 4,296 alphanumeric characters, or 2,953 bytes of binary data. At the highest error correction those figures fall by roughly two thirds. In practice, a URL of 40–60 characters produces a comfortable, easily scanned code at version 3 or 4.

Error correction, and why it matters

Every QR code carries Reed–Solomon error-correction data alongside the real content. The scanner can rebuild modules that are dirty, damaged, covered by a logo or misread because of a shadow. There are four levels:

LevelRecoverable damageTypical use
L — Lowabout 7%Clean digital screens, maximum data
M — Mediumabout 15%General purpose (the usual default)
Q — Quartileabout 25%Print that may scuff, small logos
H — Highabout 30%Logos in the centre, industrial labels

This is the trade-off at the heart of QR design: higher correction means a sturdier code but a denser one, because the redundancy has to fit in the same square. If you add a logo that covers 20% of the centre, you need level H — and you should check the result with a real phone before you print a thousand of them.

Practical rule: use Medium for ordinary links, High whenever there is a logo or the code will be printed on something that gets handled, and never let the foreground colour get close to the background colour. Contrast is worth more than error correction.

What a phone does with the content

The QR code itself does not know what it is for. It holds a string, and the phone decides what to do by looking at how that string begins:

Content starts withPhone behaviour
https://Opens the page in a browser
WIFI:Offers to join the network described
mailto:Opens a new email with address, subject and body filled in
tel:Opens the dialler with the number ready
SMSTO:Opens a new text message to that number
BEGIN:VCARDOffers to save a contact card
geo:Opens the map application at those coordinates
Anything elseShows the plain text, with an option to search or copy it

That is the whole trick behind the nine QR code types on this site: each one is the same square pattern holding a differently formatted string. A "WhatsApp QR code" is simply a code containing a wa.me link; a "vCard QR code" contains a contact record in plain text.

Making one

Any of the nine types can be created with the free QR code generator on this site. Type the content, adjust the colours and size if you want to, and download a PNG or SVG. Then do the one thing that separates a code that works from a code that embarrasses you: scan it with a phone that is not the one you generated it on.

To go deeper, read how to create a QR code for a website, or how to make a Wi-Fi QR code.