QR Code Technology

How Do QR Codes Work? Structure, Data and Scanning Explained

By MS Khan  ·  Last Updated   ·  8 min
Share
How do QR codes work: an Enqode QR code with its finder patterns and alignment pattern outlined, labelled finder pattern, data and alignment
Quick Summary

A QR code stores data as a grid of dark and light squares. Three corner squares show a phone camera where the code is, the squares in between hold your content as 1s and 0s, and built-in error correction lets the code scan even when part of it is damaged. You can make one in our QR code generator.

How Do QR Codes Work?

A QR code stores data as a grid of dark and light squares. A phone camera finds the code by its three corner squares, reads every square as a 1 or a 0, and turns those bits back into your link, text or contact details.

QR stands for quick response. The code was invented in 1994 by Denso Wave to track car parts, and the same design now opens menus, websites and Wi-Fi networks. If you are new to QR codes, start with what a QR code is. To make your own, use our QR code generator.

The Parts of a QR Code

Every QR code has the same set of parts, wherever it is printed. Some guide the camera, and the rest hold your data.

The parts of a QR code: finder patterns, timing patterns, alignment pattern, format information, the data and error correction area and the quiet zone, labelled on an Enqode QR code

Finder Patterns

The three big squares in the corners are finder patterns. They tell the camera there is a QR code in view, how big it is and which way up it sits, so a code can be read upside down or at an angle.

Timing and Alignment Patterns

Between the finder patterns run two lines of alternating dark and light squares, called timing patterns. They show the camera how big each square is, so it can map the whole grid.

Larger codes also have one or more smaller squares, called alignment patterns. They keep the grid straight when the code is printed on a curved bottle or photographed at a tilt.

Format and Version Information

Next to the finder patterns sit a few strips of format information. They tell the scanner which error correction level and which mask pattern the code uses. Very large codes also carry version information, which says how big the grid is.

Data and Error Correction Area

Every other square holds data. Part of it is your content, and part of it is error correction, a backup that can rebuild the content if some squares are missing.

Quiet Zone

The empty margin around the code is the quiet zone. It separates the code from text, images and edges around it, so the camera knows exactly where the code starts. The standard asks for a margin four squares wide.

How Data Becomes Black and White Squares

Your content is turned into bits, the bits are grouped and protected with error correction, and each bit becomes one square: dark for 1 and light for 0.

  1. The content is encoded. Numbers, letters and other text each have their own compact mode, so digits take less room than a web address.
  2. Error correction is added. Extra codewords are calculated from your data, so missing parts can be rebuilt later.
  3. The bits are placed. They fill the grid in a zigzag from the bottom right corner, around the fixed patterns.
  4. A mask is applied. One of eight mask patterns flips some squares, so the code has no large blank areas or shapes a camera could mistake for a finder pattern.

QR Code Versions and Sizes

QR codes come in 40 sizes, called versions. Version 1 is a grid of 21 by 21 squares, and each version adds four squares a side, up to 177 by 177 for version 40.

The more data a code holds, the bigger the grid. An Enqode QR short link such as enqodeqr.link/s/94iMUVPl fits in a 29 by 29 grid, while a long web address needs a larger one. The largest version holds up to 7,089 digits or 2,953 bytes of text.

Why a Damaged QR Code Still Scans

A QR code can still scan with part of it scratched, dirty or covered, because error correction rebuilds what is missing. There are four levels, and each can recover a different share of the code.

LevelRecovers aboutGood for
L (Low)7%Clean screens and small codes
M (Medium)15%Everyday print
Q (Quartile)25%Most printed codes
H (High)30%Codes with a logo in the middle

The Enqode QR generator uses level Q by default and level H when you add a logo, which is how a logo can sit on top of a code and it still scans. For when to pick each level, read QR code error correction levels explained.

What Happens When You Scan a QR Code

When you point your camera at a QR code, the phone finds it, reads it and acts on it in well under a second.

What happens when you scan a QR code: find the three corner squares, straighten the grid, read the squares as bits, fix any damage, then open the link
  1. Find the code. The camera spots the three finder patterns in the image.
  2. Straighten it. The timing and alignment patterns let the phone square up a code that is tilted or curved.
  3. Read the squares. Each dark square becomes a 1 and each light square a 0.
  4. Fix any damage. Error correction rebuilds any squares that could not be read.
  5. Act on it. The phone opens the link, joins the Wi-Fi network, starts a message or offers to save the contact.

The camera apps on iPhone and Android phones do all of this without a separate app.

Do QR Codes Have to Be Black and White?

No. A QR code works in any colours as long as the squares are much darker than the background. Black on white is simply the safest pair.

Navy on cream, dark green on white or your brand colour on a pale background all scan well. Avoid light codes on dark backgrounds, pale colours with little contrast and busy photos behind the code. You can set your own colours, add a logo and choose a frame in the custom QR code generator, and then scan a test print before you order.

Static and Dynamic: What the Squares Hold

The squares can hold your content itself or a short link to it. A static QR code holds the content, such as a full web address or Wi-Fi details. A dynamic QR code holds a short link, so you can change what it opens after printing and count every scan.

Both work in exactly the same way when scanned. To see how the short link works, read what a dynamic QR code is, and for the simplest kind of code, what a URL QR code is.

Make a QR code people can scan in a split second

Why a QR Code Won't Scan

Most scanning problems come from how the code is printed or shown, not from the code itself. These are the usual causes.

  • Low contrast: a pale code or a dark background. Keep the code dark on light.
  • Too small: small codes need a steady hand and a close camera. Our guide to the minimum QR code size for printing shows how big to go.
  • No quiet zone: text or a border pressed against the code. Leave a clear margin all round.
  • Glare or a curve: shiny laminate or a tight bottle. Use a matte finish and test it in place.
  • Too much damage: a tear or sticker bigger than the error correction can rebuild. Reprint it, or use a higher level next time.

FAQ

No, not to be read. The phone decodes a QR code on its own. It needs the internet only to open what the code points to, such as a web page. Wi-Fi, text and contact codes work offline.

Conclusion

A QR code is a grid of squares with a few fixed patterns that guide the camera and many more that hold your data, backed by error correction. Point a phone at it, and in under a second the squares become a link, a network or a contact.

Turn your link into a QR code that scans first time
Add Enqode QR as a preferred source on Google
#How Do QR Codes Work#QR Code Structure#QR Code Technology#Finder Pattern#QR Code Error Correction#QR Code Scanning
Back to Articles