Guide
How Do QR Codes Work?
A QR code isn't magic. It's a grid of black and white squares that encodes data, plus enough redundancy that a phone camera can read it in under a second, even at an angle.
Written by Muhammad Mudassar Saeed · Updated 2026-08-20
"QR" stands for Quick Response. The format was designed in 1994 by a Japanese automotive supplier (Denso Wave) to be read faster than a traditional barcode, in any orientation. Every QR code you've ever scanned, from a restaurant menu to a boarding pass, works the same way underneath.
The parts of a QR code
Look closely at any QR code and you'll notice it isn't just random noise; it has structure:
- Finder patterns: the three bold squares in the top-left, top-right, and bottom-left corners. These are how a scanner locates the code and figures out its orientation, even if the code is rotated or photographed at an angle.
- Timing patterns: thin alternating lines connecting the finder patterns, used to work out the size and spacing of the individual modules (the small squares).
- Quiet zone: the blank margin around the whole code. Scanners use it to tell where the code starts and stops; too little margin and detection gets unreliable.
- Data and error-correction modules: everything else. This is where your actual content (a URL, text, WiFi credentials) is encoded, along with redundant data used for error correction.
How a phone actually reads one
When you point a camera at a QR code, the process happens in a few fast steps: the app locates the three finder squares, uses them to correct for any tilt or rotation, reads the grid of modules as a sequence of black (1) and white (0) values, then runs that data through the QR error-correction algorithm to reconstruct the original bytes, and finally decodes those bytes back into whatever was encoded, usually text or a URL. All of this happens locally on the device; no server is involved in reading the pattern itself.
Why QR codes can survive scratches, dirt, or a logo
QR codes use a method called Reed-Solomon error correction, which adds redundant data to the pattern on purpose. That means a scanner can still reconstruct the original content even if part of the code is damaged, dirty, or covered, up to a defined percentage, depending on the error-correction level you choose. That's also how a logo can sit in the center of a QR code without breaking it: the covered modules are simply reconstructed from the redundant data around them. See our error correction guide for the specific percentages and when to use each level.
Frequently asked questions
Can a QR code contain a virus?
No. A QR code can only encode data such as text, a URL, or contact details. It has no ability to run code or install anything by itself. If there's a risk, it's in where a URL leads, not in the QR code pattern itself. See our guide on whether QR codes are safe for more on this.
How much data can a QR code hold?
The QR standard supports up to roughly 7,089 numeric characters or 4,296 alphanumeric characters at the largest size and lowest error-correction level. In practice, you'll want far less: shorter data produces a smaller, denser-free code that scans faster and more reliably, which is why URLs (rather than long text) are the most common use case.
Do QR codes need an internet connection to work?
No. Reading and decoding a QR code happens entirely on the device, offline. An internet connection is only needed afterward, if the decoded content is a URL you choose to open.