EndureQR

Basics

What is a QR code? How the pattern works and what it can hold

QR codes look like random noise, but every square has a job. Here is how the pattern stores data, how a phone reads it and why a damaged code can still scan.

Updated · 7 min read

A QR code (short for Quick Response code) is a two-dimensional barcode that stores information in a square grid of dark and light squares called modules. A phone camera reads the pattern and turns it back into text, such as a web address, a WiFi login, a contact card or a short message. QR codes were invented in 1994 by Denso Wave, a Japanese company, to track car parts through factories. Today the built-in camera on most smartphones can read them.

How does a QR code work?

A QR code stores data in both directions, across and down, and a phone camera decodes that pattern back into text. A traditional barcode stores data in one direction only, as a row of lines of different widths, so a QR code holds far more in the same space. A product barcode carries a short number. A QR code can carry thousands of characters.

When you make a code, the generator turns your content into a stream of bits, adds extra error correction data, and lays the result out in a grid that follows the international standard ISO/IEC 18004. It then applies one of eight mask patterns, which shuffles light and dark modules so the code avoids large blank areas or shapes that could confuse a scanner.

How a phone reads a QR code

Reading a code reverses the process:

  1. The camera captures an image and the software looks for the three large squares in the corners.
  2. From their positions it works out the size, angle and orientation of the code. This is why a QR code scans upside down or at a slant.
  3. It reads the format information to learn which error correction level and mask were used.
  4. It samples every module as dark or light and removes the mask.
  5. It uses the error correction data to repair anything missing or misread, then decodes the content.

All of this happens on the phone, without an internet connection. You only need to be online if the content is a web address and you choose to open it.

The parts of a QR code

Every QR code contains the same set of functional patterns. They do not hold your data. They help the scanner find and read the parts that do.

PartWhat it looks likeWhat it does
ModulesThe small dark and light squaresEach one stores a single bit
Finder patternsThree large squares in the top-left, top-right and bottom-left cornersLet the scanner locate the code and tell which way up it is
SeparatorsA thin light band around each finder patternKeep the finder patterns distinct from the data
Timing patternsA row and a column of alternating dark and light modules between the finder patternsShow the scanner how large each module is and where the grid lines fall
Alignment patternsSmaller squares with a dot in the centre, from version 2 upwardsCorrect for distortion when the code is tilted or on a slightly curved surface
Format informationStrips of modules beside the finder patternsRecord the error correction level and mask pattern
Version informationSmall blocks near two corners, from version 7 upwardsRecord the version number of larger codes
Quiet zoneA plain light margin 4 modules wideSeparates the code from anything printed around it

Everything else in the grid is your data and its error correction codewords. The empty fourth corner is deliberate: it is how the scanner knows which way round the code is.

In practice, the finder patterns and the quiet zone are the parts that custom designs most often damage. Shapes that disguise the corner squares, or a layout that crops the margin, are common reasons a code looks fine but will not scan. Our guide to QR code design best practices covers what is safe to change.

How much data can a QR code hold?

The largest QR code can hold up to 7,089 digits or 2,953 bytes of general text, though most real codes hold far less. QR codes come in 40 versions. The version describes the size of the grid, not a newer edition of the format. Version 1 is 21 by 21 modules, and each version adds 4 modules per side, up to 177 by 177 for version 40.

How much a code can hold depends on its version, its error correction level and the kind of characters you store. The standard has four main encoding modes: numeric (digits only), alphanumeric (digits, capital letters and a few symbols), byte (any text, including lower case and accented characters) and kanji. The limits for the largest code at the lowest error correction level are:

ContentMaximum in a version 40 code at level L
Digits only7,089 characters
Alphanumeric4,296 characters
Byte (general text)2,953 bytes
Kanji1,817 characters

Real codes rarely come close to these limits. A generator picks the smallest version that fits your content. More content means more modules, which means smaller modules at the same print size. That is why a long web address needs a larger print than a short one. See QR code size for printing for the numbers.

Why do damaged QR codes still scan?

Damaged QR codes still scan because they carry extra error correction data that lets the scanner rebuild what is missing. QR codes use Reed-Solomon error correction, a well-established method also used in CDs and other digital storage. The generator adds extra codewords calculated from your data. If part of the code is scratched, dirty or covered, the scanner uses those codewords to fill the gaps. There are four levels.

LevelData that can be restoredTypical use
L (low)About 7%Clean screens and codes that must hold a lot of data
M (medium)About 15%General use and a common default
Q (quartile)About 25%Labels and signs that may get dirty or worn
H (high)About 30%Codes with a logo, or harsh conditions

Higher levels are more robust, but the extra codewords take up space, so the same content produces a denser pattern. A centre logo works only because error correction fills in the modules it covers. The EndureQR free QR code generator switches to level H automatically as soon as you upload a logo.

Who invented the QR code?

The QR code was developed in 1994 by Denso Wave, then part of the Japanese automotive parts maker Denso, by a team led by engineer Masahiro Hara. Factories tracked car parts with ordinary barcodes, which held little data and often had to be scanned several times per box. The team wanted a code that could hold more and be read quickly from any angle, which is where the name Quick Response comes from.

Denso Wave holds a patent on the format but chose not to enforce it for standard codes, so anyone could create and read them without a licence fee. "QR Code" itself is a registered trademark of Denso Wave. The format was later published as the international standard ISO/IEC 18004, which is why codes from any generator work with any scanner.

From factories, QR codes spread to tickets, packaging, advertising and payments. They became an everyday tool once phone cameras could read them directly, without a separate scanning app.

Static and dynamic QR codes

Every QR code is read in the same way. What differs is the content stored inside.

  • A static code holds the final content itself: a full web address, a WiFi password, a phone number or plain text. It works without any service behind it, has no scan limit and never expires. It also cannot be changed after printing.
  • A dynamic code holds a short redirect link run by a QR service. The service forwards each scan to a destination you can change at any time, and it can count scans. It works only while the service keeps the redirect running.

Static codes suit content that will not change. Dynamic codes suit menus, campaigns and anything you may need to update after printing. Read static vs dynamic QR codes for a full comparison, or follow our guide on how to make a QR code to create your first one.

FAQ

Quick answers.

Something else? Email hello@endureqr.com and a person will reply within one business day.

QR stands for Quick Response. The name reflects the original goal of a code that a scanner could read quickly and from any angle.

No. The phone decodes the pattern on its own. You only need a connection to open a web address stored in the code.

Yes. Denso Wave, which invented it, chose not to enforce its patent on standard QR codes, so anyone can make and print them without paying a licence fee.

The largest version can hold up to 7,089 digits or 2,953 bytes of general text at the lowest error correction level. Practical codes hold far less, because smaller codes scan more easily.

Yes. The three corner squares tell the scanner the code's orientation, so it can be read at any rotation.

Print it once. Keep it forever.

Make your first dynamic code in a minute. If you ever leave, it keeps working.