QR Codes Explained: How They Work and How to Create Them

May 27, 20266 min read

QR codes are everywhere — on business cards, product packaging, restaurant tables, and billboards. But how do they actually work under the hood? This guide breaks down the structure, encoding, and scanning process so you can create QR codes with confidence.

What Is a QR Code?

A QR (Quick Response) code is a two-dimensional barcode invented in 1994 by Denso Wave, a Toyota subsidiary. Unlike traditional barcodes that store data in one direction, QR codes store data both horizontally and vertically — packing up to 7,089 numeric characters or 4,296 alphanumeric characters into a single square.

The key advantages over linear barcodes:

  • Higher data capacity — stores hundreds of times more information
  • Fast scanning — readable from any orientation in under a second
  • Error correction — survives damage, dirt, or partial obscuring
  • Versatile encoding — handles numbers, text, URLs, and binary data

QR Code Structure

Every QR code contains fixed functional patterns that scanners use to locate and decode the data region. Here are the core components:

Finder Patterns

The three large squares in the corners (top-left, top-right, bottom-left) are finder patterns. They tell the scanner:

  • This is a QR code (not random noise)
  • Where the boundaries are (orientation and alignment)
  • Which way is up (the fourth corner has no finder pattern)

Each finder pattern is a 7×7 module structure: dark ring, light ring, dark center.

Alignment Patterns

QR codes Version 2 and above include smaller alignment patterns. These help the scanner correct for distortion when the code is printed on a curved surface or viewed at an angle. Larger versions contain more alignment patterns — Version 7 has 6, while Version 40 has 46.

Timing Patterns

Alternating dark and light modules running between the finder patterns form the timing patterns. They define the grid size and help the scanner determine the module positions.

Format Information

Two strips near the finder patterns store the error correction level and the mask pattern. This data is duplicated for redundancy.

Data and Error Correction Region

The remaining area holds both the encoded data and the error correction codewords generated by Reed-Solomon encoding. Data is filled in a zigzag pattern from the bottom-right corner.

Encoding Modes

QR codes support four encoding modes, each optimized for different data types:

ModeCharacters AllowedData DensityBest For
Numeric0–93 digits per 10 bitsPhone numbers, IDs
Alphanumeric0–9, A–Z, space, $%*+-./:2 chars per 11 bitsURLs (uppercase), serial codes
ByteISO-8859-1 (Latin-1)1 char per 8 bitsGeneral text, UTF-8 strings
KanjiShift JIS double-byte1 char per 13 bitsJapanese characters

Tip: Use the most efficient mode for your data. Numeric mode packs nearly 3× more data per module than byte mode. URLs work best in alphanumeric mode if they use only uppercase letters — but most modern scanners handle byte-encoded lowercase URLs without issue.

Version Sizes

QR codes come in 40 versions, from Version 1 (21×21 modules) to Version 40 (177×177 modules). Each version adds 4 modules per side.

What determines the version:

  1. Amount of data — more characters require a larger version
  2. Error correction level — higher levels reduce usable capacity, pushing you to a larger version
  3. Encoding mode — efficient modes (numeric) fit more data in smaller versions

For most business use cases — URLs, vCards, WiFi credentials — Versions 1 through 6 (21×21 to 41×41) are sufficient.

How Scanning Works

The scanning process happens in milliseconds but involves several steps:

  1. Detection — The scanner identifies the three finder patterns and estimates the QR code's position and orientation.
  2. Alignment — Timing and alignment patterns refine the module grid mapping.
  3. Format decode — The scanner reads error correction level and mask pattern from the format information strips.
  4. Unmasking — The mask pattern (one of 8 predefined patterns) is removed to restore the raw data modules.
  5. Error correction — Reed-Solomon decoding corrects any damaged or unreadable modules.
  6. Data decode — The scanner reads the data codewords in the zigzag order, decodes the mode indicator, character count, and the actual data payload.

Most smartphone cameras perform all of this in under 0.3 seconds.

Best Practices for Creating QR Codes

  • Always test before printing — scan from multiple devices and distances
  • Leave quiet zone — maintain a 4-module white border around the code
  • Choose the right error correction level — use H (30%) for print; L (7%) for digital screens
  • Use dark on light — high contrast ensures reliable scanning
  • Shorten URLs — less data means a smaller, easier-to-scan QR code
  • Avoid custom designs that break functional patterns — finder and alignment patterns must remain intact

QR Code vs. Barcode

FeatureQR CodeLinear Barcode
Dimension2D1D
Max capacity~7,000 numeric chars~20 numeric chars
OrientationAnyHorizontal only
Error correctionYes (Reed-Solomon)Minimal (check digits)
Data typesText, URL, binaryNumeric, limited alpha

QR codes win on every metric except label space — linear barcodes are thinner and fit on narrow product edges.

Try It Yourself

Ready to create your own QR code? Use our free online tool to generate QR codes for URLs, text, WiFi credentials, and more — no signup required.

👉 Create a QR Code Now — Free Online QR Code Generator