QR Codes Explained: How They Work and How to Create Your Own

QR codes are everywhere — on restaurant menus, product packaging, event tickets, business cards, and billboard advertisements. But most people scan them without understanding how they actually work. This guide explains the technology behind QR codes, the different types of data they can encode, best practices for print and digital use, and how to generate your own QR codes for free.

What Is a QR Code?

QR stands for Quick Response. A QR code is a two-dimensional barcode that stores information in a grid of black and white squares called modules. Unlike traditional one-dimensional barcodes that store data in a single row of varying-width lines, QR codes store data in both horizontal and vertical directions, allowing them to hold far more information in a compact space.

QR codes were invented in 1994 by Denso Wave, a subsidiary of the Japanese automotive company Toyota. They were originally designed to track vehicle parts during manufacturing, where the ability to scan quickly and store more data than a standard barcode was essential. The technology was released under a free license, which is why QR codes are everywhere today — anyone can generate and use them without paying royalties.

How QR Codes Encode Data

A QR code may look like a random pattern, but every element serves a specific purpose. Understanding the structure helps you appreciate why QR codes are so reliable and versatile.

Modules: The Building Blocks

Each tiny square in a QR code is called a module. Black modules represent binary 1 and white modules represent binary 0. The data is encoded as a stream of bits (ones and zeros) arranged in a specific pattern across the grid. The smallest QR code (Version 1) is 21 modules by 21 modules. The largest (Version 40) is 177 modules by 177 modules, capable of storing over 7,000 numeric characters.

Finder Patterns

The three large squares in the corners of every QR code are finder patterns. They help the scanning camera locate and orient the code regardless of the angle at which it is held. A scanner identifies these three squares first, determines the code's size and rotation, and then reads the data modules between them.

Alignment Patterns

Larger QR codes (Version 2 and above) include smaller alignment patterns — single squares distributed throughout the grid. These help the scanner correct for distortion caused by curved surfaces, slight bending, or off-angle scanning.

Timing Patterns

Alternating black and white modules running between the finder patterns form timing patterns. These tell the scanner the exact spacing between modules so it can accurately sample each one, even if the image is slightly blurred or skewed.

Data and Error Correction

The remaining modules encode the actual data along with error correction information. The data is encoded using one of four modes depending on the content type: numeric mode (digits 0–9), alphanumeric mode (digits, uppercase letters, and a few symbols), byte mode (any 8-bit character, including UTF-8 encoded text), and kanji mode (Japanese characters). The encoder automatically selects the most efficient mode for the content.

Error Correction Levels

One of the most remarkable features of QR codes is built-in error correction using Reed-Solomon codes. This means a QR code can still be scanned correctly even if part of it is damaged, dirty, or obscured. There are four error correction levels:

LevelLabelData RecoveryBest For
LLow~7%Clean environments, maximum data capacity
MMedium~15%General use (default for most generators)
QQuartile~25%Industrial use, outdoor signage
HHigh~30%Codes with logos, harsh environments

Higher error correction means more modules are used for recovery data, which either increases the code size or reduces the amount of user data that can be stored. If you plan to place a logo in the center of your QR code, use error correction level H to ensure the obscured modules can be recovered.

Version Sizes

QR codes come in 40 versions, with each version adding four modules per side. Version 1 (21×21) can hold up to 25 alphanumeric characters at error correction level M. Version 10 (57×57) holds up to 395 alphanumeric characters. Version 40 (177×177) holds up to 4,296 alphanumeric characters. In practice, most QR codes for URLs fall between Version 2 and Version 6, keeping the code compact and easy to scan.

Types of QR Code Content

A QR code is just a container for data. What makes QR codes so versatile is the range of data types they can encode, each triggering different behavior on the scanning device.

URLs (Website Links)

The most common use case. Scanning the code opens the URL in the device's web browser. Keep URLs as short as possible to produce smaller, easier-to-scan codes. If you need to encode a long URL, consider using a URL shortener first. Our QR Code Generator lets you paste any URL and download a high-resolution QR code image instantly.

Wi-Fi Network Credentials

QR codes can store Wi-Fi network information in a standardized format: the network name (SSID), password, and encryption type (WPA, WPA2, WEP, or none). When scanned, the phone offers to connect to the network automatically — no typing the password. This is especially useful for businesses, guest networks, Airbnb rentals, and offices. The encoded format looks like this in plain text: WIFI:T:WPA;S:NetworkName;P:Password;; — but QR code generators handle the formatting for you.

vCard (Contact Information)

A vCard QR code stores a contact card with fields for name, phone number, email address, company, job title, and physical address. Scanning it adds the contact directly to the phone's address book. This is commonly used on business cards as a bridge between physical and digital contact sharing.

Plain Text

A QR code can simply display a text message on the scanner's screen. This is useful for short instructions, serial numbers, or reference codes that do not need to trigger any action.

Email and SMS

Email QR codes encode a mailto: link with a pre-filled recipient address, subject line, and optional body text. SMS QR codes encode a phone number and optional message. Scanning opens the email client or messaging app with the information pre-filled, reducing friction for the user.

Calendar Events

QR codes can encode calendar events in the iCalendar format, including the event name, date, time, location, and description. Scanning adds the event to the user's calendar app. This is handy for event invitations, conference schedules, and appointment reminders.

Geographic Coordinates

A geo: URI in a QR code encodes latitude and longitude coordinates. Scanning opens the default maps application and drops a pin at the specified location. Businesses, parks, trailheads, and landmarks can use this to guide visitors directly to their location.

Static vs. Dynamic QR Codes

Understanding the difference between static and dynamic QR codes is critical before you generate one for any long-term use.

Static QR Codes

A static QR code encodes the final destination data directly into its pattern. If the code points to https://example.com/menu, that URL is literally built into the arrangement of black and white modules. Static codes are permanent, free, work offline, and never expire. The downside is that you cannot change the destination without generating and reprinting a new code. Our QR Code Generator creates static QR codes that you own completely — no tracking, no subscriptions, no dependencies on third-party servers.

Dynamic QR Codes

A dynamic QR code encodes a short redirect URL (like https://qr.service.com/abc123) rather than the final destination. The redirect is managed through an online dashboard where you can change the destination URL at any time without altering the printed code. Dynamic codes also offer scan analytics: how many times the code was scanned, from which locations, on what devices, and at what times.

The trade-off is dependency. If the redirect service goes offline, changes its terms, or you stop paying the subscription fee, every printed code that depends on it stops working. For mission-critical or long-lived applications (permanent signage, published books, product packaging), static codes are generally safer because they have no external dependencies.

Best Practices for Print and Digital Use

A QR code is only useful if people can actually scan it. Follow these guidelines to ensure your codes work reliably in the real world.

Size and Scanning Distance

The 10:1 rule is the standard guideline: the QR code should be at least one-tenth of the expected scanning distance in each dimension. A code meant to be scanned from 3 feet away (such as a table tent in a restaurant) should be at least 3.6 inches across. A code on a billboard intended for scanning from 30 feet should be at least 36 inches across.

Minimum recommended sizes for common use cases:

  • Business card: 0.8 inches (2 cm) — scanned from inches away
  • Product label: 1 to 1.5 inches (2.5–4 cm)
  • Flyer or poster (arm's length): 1.5 to 2 inches (4–5 cm)
  • Poster or sign (6–10 feet): 6 to 12 inches (15–30 cm)
  • Banner or billboard: Scale proportionally for distance

Contrast and Color

QR code scanners rely on contrast between the modules and the background. The classic black-on-white combination offers maximum contrast and the best scan reliability. If you want to use custom colors, always make the modules darker than the background. Light modules on a dark background can work on some scanners but fail on others. Never invert the colors (white modules on a black background) because many scanners cannot read inverted codes. Avoid placing QR codes on busy or patterned backgrounds.

The Quiet Zone

Every QR code needs a clear white border around it called the quiet zone. The specification requires a quiet zone of at least four modules wide on all sides. This margin helps the scanner distinguish the code from surrounding graphics and text. Cropping or crowding this margin is the number one cause of scan failures in the real world.

File Format

For print, always use a vector format (SVG or PDF) so the code scales to any size without losing sharpness. Raster formats (PNG or JPEG) can become blurry when enlarged, and compression artifacts in JPEG files can make modules unreadable. For digital use (websites, emails, social media), PNG at a sufficiently high resolution works well. Our QR Code Generator provides both SVG and PNG downloads.

Test Before Printing

Always scan your QR code with at least two different phones (one iPhone and one Android) before sending it to the printer. Test at the expected scanning distance and lighting conditions. A code that scans perfectly on a bright screen may fail when printed on matte paper under dim lighting. Test the final printed version too, not just the screen version.

Business and Professional Use Cases

QR codes have evolved far beyond their factory origins. Here are the most effective business applications.

Restaurant Menus

Digital menus via QR code became standard during the COVID-19 pandemic and have remained popular because they are easy to update (change prices or items without reprinting), reduce printing costs, and offer a contactless experience. Place the QR code on every table, at the entrance, and on takeaway bags.

Payments

QR code payments are the dominant payment method in much of Asia and are growing rapidly elsewhere. Services like Venmo, PayPal, Cash App, and various point-of-sale systems use QR codes to initiate transactions. A shop can display a static QR code linked to its payment account, and customers simply scan to pay.

Marketing and Advertising

QR codes on print ads, direct mail, product packaging, and event displays bridge the physical-digital gap. They can link to landing pages, promotional videos, coupon codes, app downloads, or social media profiles. When using QR codes for marketing, always add a clear call to action near the code (for example, "Scan for 20% off" rather than just a bare code with no context).

Ticketing and Event Check-In

Concert tickets, boarding passes, conference badges, and event registrations commonly use QR codes for fast, paperless check-in. Each attendee receives a unique code that is scanned at entry, preventing duplication and enabling real-time attendance tracking.

Inventory and Asset Management

QR codes on equipment, supplies, and inventory items link to databases with maintenance schedules, ownership records, manuals, and reorder information. Warehouse workers scan items to log movements, check stock levels, and trigger reorders automatically.

Authentication and Two-Factor Setup

When you set up two-factor authentication (2FA) using an app like Google Authenticator or Authy, the service displays a QR code containing a shared secret key. Your authenticator app scans the code to configure the time-based one-time password (TOTP) generator without you having to type a long random string manually.

How to Create Your Own QR Code

Generating a QR code takes just a few seconds with the right tool. Here is the process:

  1. Decide what data to encode. A URL, Wi-Fi credentials, contact card, plain text, or another supported format.
  2. Choose static or dynamic. For permanent uses, static is safer. For campaigns where you might need to change the destination, dynamic offers more flexibility.
  3. Open a QR code generator. Our QR Code Generator produces high-quality static QR codes for free with no account required.
  4. Enter your data. Paste your URL, type your Wi-Fi credentials, or enter your content.
  5. Download the code. Choose SVG for print and PNG for digital use.
  6. Test the code. Scan it with your phone to verify it works correctly before distributing.

If your URL contains special characters (ampersands, question marks, non-ASCII characters), make sure they are properly encoded. Our URL Encoder/Decoder can help you verify and fix URL encoding issues before generating the QR code.

Common Mistakes to Avoid

Even simple QR codes can fail if you make these common errors:

  • Encoding too much data. Longer data means more modules, which means the code needs to be printed larger to remain scannable. Keep URLs short. A 200-character URL produces a dense code that may not scan from a distance.
  • Low contrast or inverted colors. Always use dark modules on a light background. Fancy color schemes that sacrifice contrast will cost you scans.
  • Missing quiet zone. Do not crop the white border. Graphic designers often trim it to save space, but this breaks the code.
  • Placing codes where there is no internet access. A QR code that links to a URL is useless in a location with no cell service or Wi-Fi. For offline environments, encode the data directly (such as plain text or a vCard) rather than linking to a website.
  • No call to action. A bare QR code with no context gets fewer scans. Always tell people what they will get by scanning: "Scan for the menu," "Scan to connect to Wi-Fi," or "Scan for a special offer."
  • Using JPEG format for print. JPEG compression adds artifacts that can corrupt modules. Use SVG or high-resolution PNG.

The Future of QR Codes

QR codes have proven remarkably durable as a technology. Their open standard, zero cost, and universal smartphone compatibility ensure they will remain relevant for years to come. Recent developments include deeper integration with mobile operating systems (both iOS and Android now have native QR scanning built into the camera app), augmented reality experiences triggered by QR codes, and growing use in digital identity verification and health passes.

As long as the gap between physical and digital worlds exists, QR codes will remain one of the simplest and most effective bridges. Whether you need a code for a business card, a restaurant menu, a product label, or a conference presentation, the process is the same: decide what to encode, generate the code, size it correctly, and test it before deploying.

Frequently Asked Questions

What types of data can QR codes contain?

QR codes can encode several types of data. The most common is a URL (website address) that opens in the scanner's browser. QR codes can also store plain text, phone numbers, email addresses (with pre-filled subject and body), SMS messages, Wi-Fi network credentials (network name, password, and encryption type so a phone connects automatically), vCard contact information (name, phone, email, address), calendar events, geographic coordinates, and app store links. The maximum data capacity is 4,296 alphanumeric characters or 7,089 numeric characters, but shorter content creates smaller, more easily scannable codes.

Do QR codes expire?

Static QR codes never expire. Because the data is encoded directly in the pattern of black and white modules, the code works as long as it is physically intact and scannable. A static QR code printed on a sign ten years ago will still work today. Dynamic QR codes, however, encode a short redirect URL rather than the final destination, and the redirect is managed by a service. If the service shuts down, changes its pricing, or you stop paying for the subscription, the redirect can stop working. Always consider whether you need the permanence of a static code or the flexibility of a dynamic code.

What size should a QR code be for print?

The minimum recommended size for a printed QR code is 2 centimeters by 2 centimeters (about 0.8 inches) for close-range scanning, such as on a business card or product label. For scanning distances greater than arm's length, use the 10:1 rule — the QR code should be at least one-tenth the scanning distance in size. For example, a code intended to be scanned from 10 feet away should be at least 1 foot (12 inches) across. Always include a quiet zone (white border) of at least four modules wide around the code, and test the printed code at the expected scanning distance before committing to a large print run.

Can QR codes be hacked or used maliciously?

QR codes themselves cannot be hacked because the data is static and encoded in the image. However, they can be used as a social engineering vector. A malicious actor can place a sticker with a fraudulent QR code over a legitimate one (for example, on a parking meter or restaurant table) to redirect users to phishing sites, malware downloads, or fake payment pages. To protect yourself, always check the URL preview that your phone shows before opening a QR code link. Avoid scanning codes from untrusted sources, and be suspicious if a QR code sticker appears to be placed over another code.

What is the difference between static and dynamic QR codes?

A static QR code encodes the destination data (such as a URL) directly into its pattern. Once generated, it cannot be changed — the URL is permanently baked into the image. A dynamic QR code encodes a short redirect URL that points to a management server, which then forwards the scanner to the final destination. Dynamic codes allow you to change the destination URL without reprinting the code, track scan analytics (number of scans, location, device type), and set expiration dates. The trade-off is that dynamic codes depend on the third-party redirect service remaining operational and are often offered only through paid subscriptions.