How QR Codes Work: A Simple Guide
In this article
QR codes are everywhere—on menus, tickets, and product packaging—but few people know what happens when you scan one. This guide explains the technology behind QR codes in plain language, from how they store data to why they can be read so quickly. By the end, you'll understand the structure of a QR code, how scanning works, and how to create your own.
What You'll Need
- A smartphone or tablet with a camera (most modern devices can scan QR codes natively).
- A QR code to scan (you can find one on a product, poster, or screen).
- Optional: A QR code generator (free online tools or apps) if you want to create your own.
Step-by-Step
- Understand what a QR code is. QR stands for Quick Response. It's a type of 2D barcode that stores information in a grid of black and white squares. Unlike a traditional barcode that holds data in one direction, a QR code stores data in two dimensions, allowing it to hold much more information.
- Know the anatomy of a QR code. Look at any QR code: you'll see three large square patterns in three corners (top-left, top-right, bottom-left). These are finder patterns—they help the scanner identify the orientation and size of the code. The rest of the grid contains the actual data, along with timing patterns, alignment patterns, and error correction bits.
- Learn how data is encoded. QR codes can store different types of data: numeric, alphanumeric, byte/binary (like UTF-8 text), and even Kanji. The mode is indicated by a small set of bits at the start of the data area. For example, a URL is stored as byte data using UTF-8 encoding.
- See how error correction works. QR codes use Reed-Solomon error correction. This means even if part of the code is dirty, damaged, or covered, the scanner can still read the data. There are four levels: L (7% recovery), M (15%), Q (25%), and H (30%). The level is chosen when the code is created—higher levels make the code more robust but reduce storage capacity.
- Scan a QR code with your phone. Open your camera app (on most smartphones, just point the camera at the code). The phone will automatically detect the QR code and show a notification or link. Tap it to open the content. If your camera doesn't auto-detect, you may need to open a dedicated QR scanner app or use the Google Lens feature on Android.
- Understand what happens when you scan. The camera captures the image, the software processes the grid, decodes the data, and then performs the appropriate action—usually opening a URL, connecting to Wi-Fi, or displaying text. The decoding process uses the finder patterns to locate the code, then reads the data modules in a specific order (zigzag from bottom-right upward), and finally applies error correction to fix any damaged bits.
- Create your own QR code. Use a free online QR code generator. Choose the type (URL, text, Wi-Fi, etc.), enter the data, and select an error correction level (M is a good default). Download the generated image. Test it by scanning it with your phone to ensure it works.
Common Mistakes
- Placing QR codes on curved or reflective surfaces. This can distort the image and make scanning fail. Use flat, matte surfaces when possible.
- Using too low contrast. QR codes need high contrast between the dark and light modules. Avoid light-colored codes on white backgrounds or dark-on-dark.
- Making the code too small. If the QR code is too small, the camera may not have enough resolution to read it. A good rule is to keep the code at least 2 cm x 2 cm (0.8 in x 0.8 in) for typical viewing distances.
- Ignoring error correction level. If you plan to put a logo over the code or print it on a surface that might get scratched, use a higher error correction level like Q or H.
- Not testing the QR code. Always test the code with multiple devices and in different lighting conditions before printing it widely.
Tips
- Use a dynamic QR code if you need to change the destination URL later. Dynamic codes redirect to a short link, so you can update the target without reprinting.
- Add a logo or branding to the center of the code, but only if you use a high error correction level (H) to compensate for the covered area.
- Keep the quiet zone clear. The white border around the QR code (called the quiet zone) is essential. It should be at least 4 modules wide—don't crop it off.
- Use a reliable generator. Some free generators add tracking or expiration. Check the terms if you're using it for business.
Troubleshooting
QR code won't scan. Try the following:
- Clean the camera lens and ensure the code is well-lit.
- Move closer or farther away until the code fills the frame but stays in focus.
- If the code is on a screen, increase the brightness and reduce glare.
- If the code is damaged, try a different angle or use a scanner app that allows manual zoom.
- If you're using a custom code with a logo, ensure the logo doesn't cover too much of the data area.
Scanning opens the wrong URL or content. This usually means the code was generated with incorrect data. Double-check the URL or text when creating the code. If you're scanning someone else's code, it might be malicious—be cautious about opening unknown links.
Frequently Asked Questions
Can QR codes store Wi-Fi passwords? Yes, QR codes can encode Wi-Fi credentials in a special format (WIFI:T:WPA;S:ssid;P:password;;). Scanning with a phone camera usually prompts to join the network.
Are QR codes secure? QR codes themselves are just data carriers—they can't execute code. However, they can point to malicious URLs. Always verify the source of a QR code before scanning, especially if it's from an unknown sender.
How much data can a QR code hold? The maximum capacity depends on the version and error correction level. The largest version (40) can hold up to 7,089 numeric characters or 2,953 bytes (roughly 2,953 ASCII characters) at the lowest error correction level.
Why do QR codes have three big squares? Those are finder patterns. They help the scanner quickly locate the code in the image and determine its orientation, so you don't need to align the code perfectly.
Can QR codes be scanned without an internet connection? Yes, scanning works offline because the decoding happens on your device. However, if the QR code contains a URL, you'll need internet to open that link.
What's the difference between a QR code and a barcode? A barcode stores data in one dimension (horizontal), holding about 20-25 characters. A QR code stores data in two dimensions, holding hundreds of times more information and can include URLs, text, and more.