Skip to content

How do QR codes work?

A QR code is a piece of text, often a web address, written as a square grid of dark and light modules. Your phone's camera spots the three big squares in the corners, reads the grid between them, fixes any errors and turns the pattern back into the original text.

QR code generatorUpdated 4 min read

QR stands for Quick Response. Denso Wave invented it in 1994 to label car parts, then published the specification. It has been an ISO standard, ISO/IEC 18004, since June 2000, and Denso Wave has waived its patent rights for standard QR codes, which is why anyone can make one.

The parts of a QR code

Every QR code has the same fixed parts, and the rest is data:

  • Finder patterns: the three large squares in the top-left, top-right and bottom-left corners. A scanner finds these first to know where the code is and which way up it is. That's why QR codes read from any angle.
  • Timing and alignment patterns: rows of alternating modules and smaller squares that help the scanner map the grid, even on a curved or tilted surface.
  • Format information: a few modules next to the finders that say which error correction level and mask were used.
  • Data and error correction: everything else. Your content, plus extra codewords for repairs.
  • Quiet zone: the blank margin round the outside. The specification asks for four modules of it on every side.

Versions: why some codes are denser

QR codes come in 40 sizes, called versions. Version 1 is 21 × 21 modules; each version adds 4 modules per side, up to version 40 at 177 × 177. A generator picks the smallest version that fits your content.

That's why a long web address gives you a busier code than a short one. With the generator below, https://example.com at the default level M fits in version 2 (25 × 25), while a 94-character address with tracking tags needs version 6 (41 × 41). Denser codes need printing bigger to scan well.

How QR codes are encoded

The standard has four main ways, or modes, to turn characters into bits:

  • Numeric: digits 0–9 only, about 3⅓ bits per digit. Up to 7,089 digits fit in the largest code.
  • Alphanumeric: digits, capital A–Z, space and $ % * + - . / :. About 5½ bits per character, up to 4,296.
  • Byte: any data, 8 bits per character. Up to 2,953 bytes. Lower-case web addresses and other languages use this.
  • Kanji: Japanese characters, 13 bits each, up to 1,817.

A code can mix modes. The text then gets split into 8-bit codewords, error correction codewords are added, and the result is laid out in the grid and masked so there are no large blank or solid areas that would confuse a scanner.

Error correction: why damaged codes still scan

QR codes add Reed–Solomon error correction, the same family of maths used on CDs. You pick one of four levels when you make the code:

  • L: about 7% of codewords can be restored.
  • M: about 15%. Denso Wave says this is the one most often used.
  • Q: about 25%.
  • H: about 30%.

Higher levels make the code denser for the same content. They're what lets a code with a logo in the middle still work: the logo hides some modules and error correction fills them back in. It can't save a code whose corner squares are covered, because the scanner needs those first.

Types of QR code

People mean two different things by "types":

By what's inside. The code is just text, and the phone decides what to do from how that text starts. A web address opens in the browser. Text starting WIFI: joins a network, mailto: starts an email, tel: dials and sms: opens a text. Contact cards use the vCard format. The generator on this page makes links, Wi-Fi, email, phone, SMS and plain-text codes.

Static or dynamic. A static code holds your content directly, so it works for as long as the content does. A "dynamic" code holds a short address belonging to a QR service, which forwards people to your real link. The service can change the destination and count scans, but the code stops working if the service does. See do QR codes expire? for more.

There are also related symbols in the standard family, such as Micro QR, which is smaller and holds far less. Phone cameras read standard QR codes; don't assume they read the others.

Make one and look inside

The code below holds plain text, not a link. Scan it and your phone shows the sentence. Change it to a link, Wi-Fi details or a phone number and watch the pattern change as you type.

QR code generator

Open the full tool

Sources

Questions

How do QR codes work for beginners?

A QR code is text written as a grid of dark and light squares. Your phone's camera finds the three big corner squares, reads the grid, turns it back into text and, if the text is a web address, offers to open it.

Do QR codes need the internet?

Reading one doesn't: the content is in the pattern. But if the content is a web address, you need a connection to open the page. Wi-Fi, text and contact codes work offline.

When you scan a QR code, where does it go?

Wherever the text inside it says. For a link, that's the web address in the code. Some services put their own short address in the code and forward you from there; that's what a dynamic code is.

What are the disadvantages of using QR codes?

People can't read them by eye, so a code can hide a bad link. They need a camera and usually a connection. And a printed static code can't be changed, so a typo means reprinting.