generators

How QR Codes Work and How to Make One

6 min read · Updated 2026-06-01

QR codes (Quick Response codes) were invented in 1994 by Denso Wave, a Toyota subsidiary, to track automotive parts. Three decades later they are on restaurant menus, packaging, advertisements, and tickets worldwide. Despite their ubiquity, most people have no idea what the black-and-white pattern actually represents or how a phone reads it in a fraction of a second.

What Is a QR Code?

A QR code is a two-dimensional barcode — a matrix of black and white squares arranged on a grid. Unlike a traditional one-dimensional barcode that only encodes data in one direction (left to right), a QR code encodes data in both directions, allowing it to store far more information in a small space.

The Anatomy of a QR Code

Finder Patterns

The three large squares in the three corners of every QR code are called finder patterns. They have a distinctive 7:1:3:1:7 ratio of dark:light:dark:light:dark when scanned in any direction. A scanner uses these to locate the code and determine its orientation, even if the image is tilted, skewed, or partially obstructed.

Timing Patterns

Between the finder patterns run alternating black-and-white lines called timing patterns. These allow the scanner to determine the module size and correct for any image distortion.

Data and Error Correction Modules

The remaining squares encode the actual data. The data is interleaved with error correction codewords using a mathematical scheme called Reed-Solomon coding, the same algorithm used in CDs, DVDs, and digital television broadcasts.

Error Correction: Why QR Codes Work Even When Damaged

QR codes have four error correction levels: L (Low), M (Medium), Q (Quartile), and H (High). At level H, up to 30% of the code can be destroyed or obscured and the scanner can still recover the full data. This is why you can put a logo in the center of a QR code — the underlying data is redundant enough that the covered modules can be reconstructed mathematically.

  • L (Low): 7% damage tolerance — smallest code, use when damage is unlikely
  • M (Medium): 15% damage tolerance — good balance for most uses
  • Q (Quartile): 25% damage tolerance — good for branded codes with logos
  • H (High): 30% damage tolerance — maximum redundancy for harsh environments
TIP

If you want to overlay a logo on a QR code, use error correction level Q or H. The logo obscures part of the code, and the error correction must recover the hidden data for the code to scan correctly.

What Can a QR Code Store?

QR codes can store different types of data depending on the encoding mode. In the most compact binary mode, a maximum-size QR code (version 40) can store up to 2,953 bytes. In practice, most QR codes store URLs (typically 20–100 characters), which leaves abundant capacity.

  • URLs: most common use — link to a website, menu, or app store page
  • Plain text: store a short message or instructions
  • Wi-Fi credentials: encode SSID and password so a phone can join automatically
  • Contact information (vCard): encode a business card
  • Email or SMS: pre-populate a message
  • Geographic coordinates: link to a location in a maps app

How a Phone Reads a QR Code

The camera captures the image. The software detects the three finder patterns and uses them to warp the image into a flat, aligned grid. The binarization step converts the image to black and white. The decoder reads the format information (error correction level and data mask) and then reads the data modules in a specific zigzag pattern. Reed-Solomon decoding corrects any errors. Finally, the data is parsed according to its encoding mode (numeric, alphanumeric, binary, or kanji) and the result is presented to the user.

Create Your Own QR Code

Free tool
Generate a QR code free — customize color, size, and error correction
Create custom QR codes for URLs, text, and more.
Open Generate a QR code free — customize color, size, and error correction

Tips for Reliable QR Codes

  • Keep the URL short — shorter data means a simpler code that scans more reliably
  • Use a URL shortener if your target URL is very long
  • Test the code with multiple devices before printing at scale
  • Ensure high contrast — black modules on a white background scans fastest
  • Print at a minimum of 1 cm × 1 cm; larger is more reliable in poor lighting
  • Include a "Scan me" label so people know what to do with it

Frequently asked questions

Can a QR code expire?

The QR code itself does not expire — it is just an encoding of whatever data it contains. If the QR code encodes a URL, the URL can expire or the page can be taken down, making the code effectively useless. Dynamic QR codes (from a QR platform) redirect through the platform's server, allowing the destination to be changed without reprinting. Static QR codes (generated directly) cannot be changed after creation.

Are QR codes safe to scan?

Scanning a QR code is generally safe; the risk comes from the content. A malicious QR code might link to a phishing website or trigger an automatic download. Before tapping a link from a QR code, check the URL displayed by your camera app to confirm it matches what you expect.

Why does a QR code look different every time it is generated for the same URL?

QR codes use a data masking step that applies one of eight possible patterns to the encoded data to ensure no large areas of all-black or all-white modules that could confuse a scanner. Different tools may choose different masks. The resulting code looks visually different but encodes identically.

What is the maximum amount of data a QR code can store?

A version 40 QR code (the largest standardized size, a 177×177 grid) can store up to 7,089 numeric characters, 4,296 alphanumeric characters, or 2,953 bytes of binary data. In practice, most QR codes use far less.

Can I change where a QR code points after printing it?

Only if you used a dynamic QR code service that redirects through a short URL they control. Static QR codes that encode a URL directly cannot be changed — the URL is baked into the code pattern.

Related tools

Keep reading

Try our free tools
Browser-based, private, no signup required.
Browse all tools →