How Do QR Codes Work and Store Information?

How Do QR Codes Work and Store Information?

You’ve probably scanned hundreds of them by now. Restaurant menus, payment apps, concert tickets, COVID check-ins. Those little black-and-white squares are so common that we barely think about how strange they are. A camera pointed at some random-looking pixels somehow knows exactly where to send your browser. No typing, no searching, just instant information. The technology behind that seamless experience is actually pretty elegant, and it’s been around since 1994.

The Short Version

QR codes store information as a pattern of black and white squares that cameras can read from any angle. Each code contains positioning markers (those three large squares in the corners), timing patterns, and data cells that translate to numbers, letters, or URLs. The pattern itself is the data , there’s no database lookup happening. Error correction built into the code means it still works even if part of it is dirty or damaged.

Close-up diagram showing the components of a QR code including position markers, alignment patterns, and data cells

What Makes QR Codes Different from Regular Barcodes

Traditional barcodes, the ones you see on cereal boxes, store information in one direction: left to right. They’re basically vertical lines of varying widths that represent numbers. A typical barcode holds about 20-25 characters, which is enough for a product ID but not much else.

QR codes (Quick Response codes) work in two dimensions. That square gives them way more real estate to pack in data. A single QR code can hold up to 4,296 alphanumeric characters or 7,089 numbers. That’s enough for a URL, a paragraph of text, contact details, or even a small image.

A study by Juniper Research found that by 2022, QR code redemptions via mobile devices reached 5.3 billion globally. The pandemic accelerated adoption, but the technology was already primed for it.

The Three Corner Squares

Those three large squares in the corners aren’t decoration. They’re position markers that tell your camera, “Hey, this is a QR code, and here’s how I’m oriented.” This is why you can scan a QR code from any angle , upside down, sideways, whatever. The phone figures out the orientation instantly.

The fourth corner, bottom-right, has a smaller square or pattern depending on the version. That’s an alignment marker for larger codes.

Reading Direction and Timing

Between those position markers, you’ll see alternating black-and-white patterns. These are timing strips that help the scanner determine how many rows and columns the code has. Think of them as a grid system that keeps everything lined up, even if the code is printed at different sizes or slightly warped.

How Information Gets Encoded

The actual data lives in the rest of those little squares, called modules. Each black or white module represents a binary digit: black is 1, white is 0. Your camera app reads these in a specific pattern (usually starting from the bottom-right and moving in a zigzag), converts them to binary, then decodes that into whatever information was stored.

The QR code doesn’t “link” to anything , it literally contains the URL or data as part of its structure.

Different QR code versions exist, ranging from Version 1 (21×21 modules) to Version 40 (177×177 modules). The version determines how much data fits. Most QR codes you encounter daily are probably Version 3 to 7 , enough for a typical web address without being unnecessarily large.

Character Encoding Modes

QR codes have four main encoding modes:

  • Numeric: Only digits 0-9, most efficient
  • Alphanumeric: Numbers, uppercase letters, and some symbols
  • Byte: Any character, including lowercase
  • Kanji: Optimized for Japanese characters

The code automatically picks the most efficient mode based on what you’re encoding. A phone number uses numeric mode and takes up less space than a URL with mixed characters.

Side-by-side comparison showing a simple QR code and a complex one with logo in center

The Error Correction Secret

Here’s the really clever part: QR codes can still work even when they’re partially destroyed. You’ve probably seen codes with logos printed over the center or ones that are smudged or torn. They often scan fine anyway.

This works because of Reed-Solomon error correction, the same math that makes CDs and DVDs readable despite scratches. When creating a QR code, redundant data gets built into the pattern at four possible levels:

  • L (Low): Recovers 7% of data
  • M (Medium): Recovers 15% of data
  • Q (Quartile): Recovers 25% of data
  • H (High): Recovers 30% of data

Most commercial QR codes use M or Q level. Those branded codes with company logos in the middle typically use H level to account for the blocked space. The tradeoff is that higher error correction requires more modules, making the code bigger or reducing data capacity.

Denso Wave, the company that invented QR codes in 1994, designed them for tracking automotive parts in factories. They needed codes that would scan quickly even if they got dirty or damaged during manufacturing. That resilience turned out to be useful for basically everything else.

Why Some Codes Are Denser Than Others

Compare a QR code for a simple URL like “google.com” to one for a paragraph of text. The simple one looks relatively sparse with bigger modules. The complex one is packed tight with tiny squares. That’s the code adjusting its version and density to fit the data.

There’s also a quiet zone , that white border around the code. It’s not optional. Scanners need that blank space to distinguish the code from whatever’s around it. Without it, your camera might not recognize it as a QR code at all.

What Happens When You Scan One

Your phone’s camera captures the image, and the scanning software does several things in quick succession:

  1. Detects the three position markers and determines orientation
  2. Uses timing patterns to map out the grid
  3. Reads the format information (near the position markers) to understand the error correction level and masking pattern
  4. Decodes the data modules in the correct order
  5. Applies error correction if needed
  6. Outputs the result , usually opening a URL, but could be displaying text or adding a contact

This all happens in a fraction of a second. Modern phones don’t even need a separate app anymore , the native camera app handles it automatically.

A 2021 study by MobileIron found that 71% of smartphone users had scanned a QR code at least once in the past year, up from 43% pre-pandemic.

Person holding smartphone scanning a QR code on a restaurant table

Security and Privacy Considerations

Because QR codes can encode any URL, they’re sometimes used for phishing attacks. You scan what looks like a legitimate code at a parking meter or restaurant table, but it actually takes you to a fake website designed to steal credentials or payment info.

Your phone usually shows you the URL before opening it , that preview is your chance to check if it looks legitimate. Some newer camera apps even check URLs against known malicious sites before opening them.

Dynamic vs Static QR Codes

Static QR codes have the information permanently encoded. Change the URL? You need a new code.

Dynamic QR codes are a bit different. The code itself contains a short redirect URL that points to a server, which then sends you to the real destination. The advantage is you can change where it goes without reprinting the code. The downside is someone controls that redirect server, and they can track how many times it was scanned, when, and from where.

Most marketing QR codes are dynamic for exactly this reason. Businesses want the analytics.

Putting It All Together

QR codes are one of those technologies that seem almost magical until you look under the hood. Then they’re even more impressive because of how elegantly simple the logic is. Black squares and white squares following precise rules, readable from any angle, resilient to damage, and packed with information.

They’ve been around for 30 years, but it took a pandemic to make them truly ubiquitous. Now they’re everywhere from parking meters to museum exhibits, airline boarding passes to cryptocurrency wallets. That persistence happened because the underlying technology was well-designed from the start , built for speed, reliability, and real-world conditions.

The next time you point your camera at one, you’ll know it’s not magic. It’s math, geometry, and some very clever error correction. Which, honestly, might be better than magic.