QR Code Generator Guide: How QR Codes Work & Best Practices
Quick Answer
A QR code is a 2D barcode that encodes data — most commonly a URL — in a grid of black-and-white squares. Smartphones decode it instantly using a camera. To create one, paste your URL or text into a QR code generator, choose an error correction level, and download the image as PNG or SVG for print or digital use.
What Is a QR Code?
A QR code (Quick Response code) is a two-dimensional barcode invented by Denso Wave in 1994 to track automotive parts in manufacturing. Unlike a traditional barcode, which stores data in one horizontal dimension, a QR code stores data in both horizontal and vertical directions, allowing it to hold significantly more information in a compact square.
Today, QR codes are everywhere. According to Statista, global QR code scans exceeded 26 billion in 2023 and are projected to surpass 100 billion annually by 2027. Juniper Research estimates that QR code adoption for mobile payments alone will exceed 2.2 billion users by 2025. The technology's resurgence accelerated dramatically during the COVID-19 pandemic: contactless menus, vaccine verification cards, and restaurant check-in forms drove mainstream adoption in a way that had never happened before. A 2021 MobileIron survey found that 83% of smartphone users had scanned a QR code in the previous year, up from about 35% just three years prior.
Businesses have embraced the shift. A 2023 QR Tiger report found that over 6.8 million QR codes were generated on its platform in a single year, with retail, hospitality, and marketing accounting for the largest share of usage.
How QR Codes Work: The Technical Overview
A QR code looks like a random pattern of black squares, but every pixel has a specific role. Understanding the structure helps you make better design decisions.
Finder Patterns
Three large square patterns sit in the top-left, top-right, and bottom-left corners of every QR code. These are called finder patterns. A scanner detects them first to determine the code's orientation and boundaries, which is why QR codes can be read upside down, at an angle, or even slightly curved.
Data Modules
The remaining grid is filled with data modules — the actual encoded information. Data is stored in binary format (0s and 1s mapped to white and black squares). The code also includes format information (error correction level, mask pattern) and version information for larger codes.
Reed-Solomon Error Correction
QR codes use Reed-Solomon error correction, the same algorithm used in CDs, DVDs, and deep-space communications. This means the code remains scannable even if a portion is damaged, dirty, or obscured by a logo. Depending on the error correction level you choose, a QR code can recover from 7% to 30% data loss. This is why a QR code with a company logo in the center still scans reliably.
The 7 QR Code Types
QR codes don't just link to websites. The type you choose determines what data gets encoded and how the device handles it.
| Type | What It Encodes | Best For |
|---|---|---|
| URL | A web address (https://...) | Marketing materials, menus, packaging |
| Plain Text | Any text string | Short messages, instructions, codes |
| mailto: address + optional subject/body | Contact cards, feedback forms | |
| SMS | Phone number + pre-filled message | Opt-ins, alerts, customer support |
| WiFi | Network SSID, password, encryption type | Hotels, offices, cafes — instant network join |
| vCard | Contact details (name, phone, email, address) | Business cards, event badges |
| Location | GPS coordinates or Google Maps URL | Storefronts, event venues, delivery directions |
URL QR codes are by far the most common in commercial use. WiFi QR codes have grown rapidly in hospitality — placing one at a hotel check-in desk eliminates the friction of manually typing a network password.
Error Correction Levels Explained
Every QR code has an error correction level built in. Higher correction means more redundant data is stored, which makes the code more damage-resistant but also denser and slightly harder to scan at small sizes.
| Level | Designation | Damage Recovery | Best Use Case |
|---|---|---|---|
| L | Low | Up to 7% | Clean environments, digital screens |
| M | Medium | Up to 15% | General purpose, most everyday uses |
| Q | Quartile | Up to 25% | Industrial, outdoor, or rough handling |
| H | High | Up to 30% | Branded QR codes with embedded logos |
Level M is the right default for 90% of use cases. It handles minor scuffs, glare, and printing imperfections without bloating the code. Jump to Level H if you're adding a logo.
Dynamic vs Static QR Codes
This is the most important decision in any QR code campaign. The difference is whether the encoded data is fixed or updatable.
| Feature | Static QR Code | Dynamic QR Code |
|---|---|---|
| Destination editable after print | No | Yes |
| Scan analytics (count, location, device) | No | Yes |
| Requires internet connection to redirect | No | Yes |
| Code density | High (full URL encoded) | Low (short URL only) |
| Requires a third-party platform | No | Usually yes |
| Ongoing cost | Free | Often subscription-based |
| Best for | One-time uses, personal projects | Campaigns, print runs, business cards |
For a business running a print campaign, dynamic is almost always the right choice. If you discover a typo in the destination URL after printing 50,000 flyers, a static QR code is permanently broken. A dynamic one can be fixed in 30 seconds on a dashboard.
For simple personal use — like sharing your home WiFi or linking to a single page that won't change — static QR codes are free and perfectly reliable. Generate one with our free QR code generator and download it immediately.
Top 5 Best Practices for QR Code Design
1. Size It for the Scanning Distance
A QR code that's too small is one of the most common failures. The rule of thumb: minimum print size is 2 cm × 2 cm, and scanning distance should not exceed 10× the code's width. A code on a billboard needs to be large enough to scan from 10+ meters away. When in doubt, print bigger.
2. Always Include a Quiet Zone
The quiet zone is the white border surrounding the QR code. It must be at least 4 modules (data squares) wide on all four sides. Without it, scanners struggle to distinguish the code from surrounding content. Never cut the quiet zone to save space.
3. Maintain High Contrast
Black on white is the standard because it maximizes contrast. Inverted (white on dark) codes often fail because most scanners expect dark modules on a light background. If you must use brand colors, keep the dark modules significantly darker than the light ones, and test on 3+ devices and apps before publishing.
4. Test Before Printing
Always scan your QR code on multiple devices — iOS, Android, and at least two different scanner apps — before committing to a print run. Test at the actual print size. Many QR code failures are discovered only after thousands of flyers have been distributed.
5. Choose Dynamic for Any Campaign With a Print Run
If you're printing more than a few copies, use a dynamic QR code. The ability to correct destination URLs, swap out expired promotions, and gather scan analytics is worth the modest platform cost. Static codes are a one-way door.
QR Codes and URL Length
The longer the URL, the more data modules are needed, and the denser (and harder to scan) the resulting code becomes. A URL like https://hakaru.io/tools/qr-code-generator produces a clean, open code. A URL with tracking parameters 200 characters long produces a dense, small-module code that fails more frequently at small print sizes.
Two solutions: shorten the URL first using a URL encoder/decoder, or use a dynamic QR code with a built-in short redirect. Either approach drastically reduces module density.
QR Codes for Developers: Related Encoding Tools
If you're building a product that generates or processes QR codes, a few related tools are worth knowing:
- Base64 encoder/decoder — useful when embedding binary data (like vCard contact info) into a QR code payload
- URL encoder/decoder — encode special characters in URLs before generating a code to prevent scanning errors
- Hash generator — generate SHA checksums for verifying QR code payloads in secure applications
For teams generating barcodes in bulk alongside QR codes, our standard barcode generator handles Code 128, EAN-13, UPC-A, and other 1D formats commonly used in retail and logistics.
Create a QR code in seconds
Try our free QR Code Generator →Need to encode binary data? Try our Base64 Encoder
Frequently Asked Questions
What is a QR code and how does it work?
A QR code (Quick Response code) is a 2D barcode that stores data in a grid of black-and-white modules. A smartphone camera decodes the pattern by reading finder patterns in three corners, then decoding the data modules using Reed-Solomon error correction to recover the embedded URL, text, or other information.
What is the difference between a static and dynamic QR code?
A static QR code encodes data directly and permanently — you cannot change the destination after printing. A dynamic QR code encodes a short URL that redirects to a changeable destination, letting you update the target, track scan analytics, and fix mistakes without reprinting.
What size should a QR code be for printing?
The minimum recommended print size is 2 cm × 2 cm (about 0.8 inches). For scanning distances over 1 meter, add roughly 1 cm of size per additional meter of distance. Flyers and posters typically use 3–5 cm. Always include a quiet zone (white border) of at least 4 modules on all sides.
Which error correction level should I choose?
Use Level M (15% damage tolerance) for most everyday uses — it balances density and reliability. Choose Level H (30%) when placing a logo inside the QR code or when codes may be partially obscured. Use Level L (7%) only when you need to pack maximum data into a small space.
Can I put a logo in the middle of a QR code?
Yes. QR codes use Reed-Solomon error correction to recover from up to 30% damage (Level H). A centered logo covering 20–25% of the code is generally safe. Set error correction to Level H before adding a logo, and always test scanning on multiple devices before publishing.
How many characters can a QR code hold?
It depends on the data type and version. At maximum capacity (Version 40), a QR code holds up to 7,089 numeric characters, 4,296 alphanumeric characters, or 2,953 bytes of binary data. In practice, keep encoded data short — URLs under 100 characters produce less dense, easier-to-scan codes.