QR Code Complete Guide: Create, Scan, and Use QR Codes
Β· 10 min read
How QR Codes Work
QR (Quick Response) codes were invented by Denso Wave in 1994 for tracking automotive parts. They encode data in a 2D matrix of black and white modules (squares). Unlike barcodes which store data in one dimension, QR codes use both horizontal and vertical axes, allowing much more data in a smaller space.
Every QR code contains three finder patterns (the large squares in three corners) that help scanners detect orientation and angle. The fourth corner has an alignment pattern for perspective correction. Between these patterns, data is encoded in a specific pattern of modules.
QR Code Types
| Type | Data | Example |
|---|---|---|
| URL | Website link | https://dl-kit.com |
| Text | Plain text | Any string up to ~4,000 characters |
| WiFi | Network credentials | WIFI:T:WPA;S:MyNetwork;P:password;; |
| vCard | Contact information | Name, phone, email, address |
| Pre-filled email | mailto:[email protected]?subject=Hello | |
| SMS | Pre-filled text message | smsto:+1234567890:Hello |
| Calendar | Event details | iCalendar format (VEVENT) |
| Geo | Map location | geo:40.7128,-74.0060 |
Create any type with our QR Code Generator. For WiFi sharing specifically, try WiFi QR Generator.
Error Correction Levels
QR codes use Reed-Solomon error correction, allowing them to be read even when partially damaged or obscured:
| Level | Recovery | Use Case | Size Impact |
|---|---|---|---|
| L (Low) | ~7% | Clean environments, maximum data | Smallest QR code |
| M (Medium) | ~15% | General purpose (default) | Moderate |
| Q (Quartile) | ~25% | Outdoor use, some wear expected | Larger |
| H (High) | ~30% | Logo overlay, harsh environments | Largest QR code |
Level H is essential when adding a logo to the center of a QR code β the logo obscures modules, and high error correction compensates.
Data Capacity
| Data Type | Maximum Characters | QR Version |
|---|---|---|
| Numeric only | 7,089 | Version 40 (177Γ177) |
| Alphanumeric | 4,296 | Version 40 |
| Binary (UTF-8) | 2,953 bytes | Version 40 |
| Kanji | 1,817 characters | Version 40 |
In practice, keep QR code data short. A URL under 100 characters produces a small, easily scannable code. Long URLs create dense codes that are harder to scan, especially from a distance.
Common Uses
- Payments β Alipay, WeChat Pay, UPI, and many banking apps use QR codes for transactions
- Restaurant menus β Replaced paper menus during COVID-19, now standard in many restaurants
- Product packaging β Links to manuals, warranty registration, or nutritional information
- Event tickets β Boarding passes, concert tickets, conference badges
- WiFi sharing β Guests scan to connect without typing passwords
- Business cards β vCard QR codes for instant contact saving
- Authentication β Two-factor authentication (TOTP) setup via QR code
- Inventory tracking β The original use case, still widely used in logistics
Creating QR Codes
Online Tools
Our QR Code Generator creates codes entirely in your browser β no data is sent to any server. Supports URL, text, WiFi, vCard, and custom colors.
Command Line (qrencode)
# Install
sudo apt install qrencode # Linux
brew install qrencode # macOS
# Generate PNG
qrencode -o qr.png "https://dl-kit.com"
# Generate SVG (scalable)
qrencode -t SVG -o qr.svg "https://dl-kit.com"
# WiFi QR code
qrencode -o wifi.png "WIFI:T:WPA;S:NetworkName;P:password;;"
# Set error correction level
qrencode -l H -o qr.png "https://dl-kit.com"
# Set size (module size in pixels)
qrencode -s 10 -o qr.png "https://dl-kit.com"
Python (qrcode library)
import qrcode
# Basic QR code
img = qrcode.make("https://dl-kit.com")
img.save("qr.png")
# Customized
qr = qrcode.QRCode(
version=1,
error_correction=qrcode.constants.ERROR_CORRECT_H,
box_size=10,
border=4,
)
qr.add_data("https://dl-kit.com")
qr.make(fit=True)
img = qr.make_image(fill_color="black", back_color="white")
img.save("qr_custom.png")
Scanning QR Codes
Most smartphone cameras now scan QR codes natively β just point the camera at the code. For scanning from image files, use our QR Code Reader.
Scanning Tips
- Ensure adequate lighting β QR codes need contrast to be read
- Hold the camera steady and at the right distance (10-30 cm for small codes)
- The entire QR code must be visible in the camera frame
- Avoid glare on glossy surfaces β tilt slightly to reduce reflection
- Damaged codes may still scan if error correction level is high enough
Design Best Practices
- Minimum size β 2Γ2 cm for close-range scanning. For distance: 10 cm per 1 meter of scanning distance.
- Quiet zone β Leave a white border of at least 4 modules around the QR code. Without it, scanners may fail.
- Contrast β Dark modules on light background. Minimum 40% contrast difference. Avoid low-contrast color combinations.
- Colors β Dark foreground, light background (not inverted). Red/green combinations are problematic for color-blind users.
- Logo placement β Center only, use error correction level H, keep logo under 20% of QR code area.
- Test before printing β Scan with at least 3 different devices/apps before mass printing.
- Use short URLs β Shorter data = simpler QR code = easier to scan.
Frequently Asked Questions
How much data can a QR code hold?
Maximum: 7,089 numeric characters, 4,296 alphanumeric, or 2,953 bytes of binary data. For URLs, practical limit is about 2,000 characters, but shorter is better for scannability.
Do QR codes expire?
Static QR codes never expire β the data is encoded directly in the pattern. Dynamic QR codes (which redirect through a URL shortening service) can expire if the service stops or the link is deactivated.
Can QR codes be customized with colors and logos?
Yes, thanks to error correction. With level H (30% recovery), up to 30% of the QR code can be obscured by a logo and still scan correctly. Use dark foreground on light background for best results.
Are QR codes secure?
QR codes are just data carriers β they are not inherently secure or insecure. The risk is in what they link to. Always check the URL before visiting. Malicious QR codes can link to phishing sites or trigger unwanted actions.
What is the minimum size for a printed QR code?
Minimum 2Γ2 cm (0.8Γ0.8 inches) for close-range scanning (within 30 cm). For posters or signs, use a 10:1 ratio: 10 cm of QR code size per 1 meter of expected scanning distance.