How QR Codes Work Under the Hood
A QR code looks like random black and white squares, but every square has a job. Your phone reads the pattern, rebuilds the data hidden inside it, and opens the link or message in about a second. This guide explains how QR codes work, piece by piece, so you can make codes that scan first time, every time.
Try the free QR Code Generator
Use ToolsOfWeb's QR Code Generator to make a free QR code for a link, text, Wi-Fi password or contact — no sign-up, no watermark, in your browser.
What is a QR code, really?
A QR code is a two-dimensional barcode: a grid of black and white squares, called modules, that stores data your phone camera can read. Unlike a traditional barcode, which stores data in one line of stripes, a QR code stores data across the whole grid, so it holds far more information in a small square.
QR stands for Quick Response. The format was invented in 1994 at Denso Wave in Japan to track car parts quickly on factory lines, and it spread because any camera phone can read it without special hardware. Today the same grid carries website links, Wi-Fi passwords, payment details, tickets and contact cards. For the formats and privacy basics, see QR Codes Explained.
How does your phone find a QR code in a photo?
Your phone finds a QR code by looking for its three large finder patterns: the square bullseyes in the top-left, top-right and bottom-left corners. Those patterns look the same from any angle, so the camera can spot the code even when it is rotated, tilted or upside down.
Once the three corners are found, the phone knows exactly where the grid sits and how it is oriented. Smaller alignment patterns inside the grid then correct for perspective: a code photographed at an angle, or printed on a curved cup, still maps back to a straight grid. A thin timing pattern, the alternating black and white line between the finder patterns, tells the reader how many rows and columns the grid has. That is why a code can be scanned from a poster across the room or a business card in your hand, as long as the three corners are visible and in focus.
How is data actually stored inside the grid?
Data is stored as bits: each black module means 1 and each white module means 0. The reader scans the grid in a fixed zigzag order, groups the bits into bytes, and decodes them using a mode marker stored near the finder patterns. Numeric mode packs digits efficiently, and byte mode handles everything else, including lowercase letters and links. Format information near the corners records the error correction level and the mask used, so the code tells the reader how to read itself before the data is touched.
How can a damaged QR code still scan?
A damaged QR code still scans because of Reed-Solomon error correction: part of the grid is not your data at all, but backup copies of it, calculated mathematically. If a corner is torn, a sticker covers a patch, or a logo sits in the middle, the reader rebuilds the missing pieces from the backup data.
There are four levels. Level L recovers about 7% of damaged data, M about 15%, Q about 25% and H about 30%. The trade-off is real: a higher level reserves more modules for backup, so the code holds less of your data and looks denser. That is also why logos work — a logo placed in the centre only survives because the error correction level was set high enough to cover the modules it hides. For printed codes that will be handled, folded or stuck outdoors, choose level H; for a clean on-screen code, level M is plenty.
Why do some QR codes look denser than others?
Some QR codes look denser because they are a higher version: QR codes come in 40 sizes, from Version 1 at 21 by 21 modules up to Version 40 at 177 by 177 modules. A short link fits in a small, sparse grid, while a long paragraph of text needs a bigger, denser one. The generator picks the smallest version that fits your content.
Density also rises with the error correction level, as explained above, and with the character set: byte mode uses more bits per character than numeric mode, so a link full of lowercase letters and symbols packs less efficiently than plain digits. The largest standard code, Version 40 at the lowest error correction level, holds up to 4,296 alphanumeric characters or 7,089 digits (source: the ISO/IEC 18004 QR Code specification, as summarised in Thonky's QR Code Tutorial). In practice, keep codes short: a short link makes a sparse, easy-to-scan grid, and it scans from farther away than a dense one.
One more trick keeps dense codes readable: masking. After the data is laid out, the generator applies one of eight mask patterns that flips selected modules, then scores the result and keeps the mask that avoids large black blobs and confusing patterns. Without masking, a code containing a run of identical bits could produce a solid black block that looks like a finder pattern and confuses the reader.
How do you make a QR code that scans first time?
Make a QR code that scans first time by keeping the content short, the contrast high and the size generous. Use a short link rather than a long one, print black on white rather than a pale colour on a busy photo, and leave a quiet zone — a blank border about four modules wide — around all four sides.
Test before you print. Scan the code on two different phones, at the distance people will actually use, and in the light it will live in. If the code will be printed, size it for the surface with the Image Resizer and print a test copy first: a code that scans perfectly on a bright screen can fail on matte paper under shop lighting. And if you need a simpler one-dimensional code for stock labels or price tags, the Barcode Generator covers that job instead.
Are QR codes safe to scan?
QR codes are only as safe as the content inside them, because the pattern itself is just data. A code can point anywhere: a genuine menu, a phishing page, or a payment request. Your phone shows the decoded link before opening it, so read that preview instead of tapping blindly.
A few habits cover most of the risk. Check that the previewed address matches the business in front of you, never enter a password or payment details from a code stuck over another code on a poster or parking meter, and be wary of codes that promise a prize or demand urgent action. The code format has no built-in safety check, so the preview screen is your safety check. Treat an unexpected QR code the same way you would treat an unexpected link in an email.
FAQs
No. A QR code is just data printed as a pattern. Your phone decodes it offline; only the content inside the code, such as a website link, may need the internet after you open it. A code containing plain text or a Wi-Fi password works with no connection at all.
Because the pattern depends on the content, the version and the error correction level. More text means a denser grid, a higher error correction level reserves more squares for backup data, and a logo in the middle replaces some modules. Different inputs always produce different patterns.
A static QR code never expires: the data is inside the pattern itself, so it works as long as it is printed clearly. Dynamic QR codes are different — they point to a short link on a service, and they stop working if that service closes the link or the account behind it.
The largest standard QR code, Version 40, holds up to 4,296 alphanumeric characters or 7,089 digits at the lowest error correction level, according to the ISO/IEC 18004 specification. In practice, most everyday codes hold far less — a short link or a few lines of text.
Try the free QR Code Generator
Open the QR Code Generator and make a free QR code for a link, text, Wi-Fi password or contact — no sign-up, no watermark, in your browser.
