How to Generate QR Codes Free: Complete Guide With Examples (2026)
QR codes are everywhere in 2026 — menus, payments, WiFi login, event tickets. Here is the complete technical guide: how they work internally, error correction levels, size optimization, and how to generate them for free with code or online tools.
How QR Codes Work Internally
A QR (Quick Response) code is a two-dimensional matrix barcode that encodes data in a grid of black and white modules. Unlike traditional barcodes that encode data in one dimension, QR codes store data both horizontally and vertically, allowing them to hold significantly more information — up to 7,089 numeric characters or 4,296 alphanumeric characters in a single code.
Every QR code contains several structural elements:
- Finder patterns: The three large squares in the corners that help scanners detect and orient the code.
- Alignment patterns: Smaller squares that help correct for distortion (present in version 2+).
- Timing patterns: Alternating black/white modules that define the coordinate system.
- Format information: Encodes the error correction level and mask pattern.
- Data and error correction: The actual encoded data plus Reed-Solomon error correction codewords.
QR Code Versions: 1 Through 40
QR codes come in 40 versions, where each version increases the module grid size:
- Version 1: 21x21 modules — holds up to 25 alphanumeric characters
- Version 10: 57x57 modules — holds up to 395 alphanumeric characters
- Version 40: 177x177 modules — holds up to 4,296 alphanumeric characters
For most use cases (URLs, WiFi credentials, short text), versions 1-10 are sufficient. The smaller the version, the easier it is to scan from a distance.
Error Correction Levels Explained
QR codes use Reed-Solomon error correction, which means they can still be read even if part of the code is damaged or obscured. There are four levels:
- L (Low): ~7% recovery — maximum data capacity, minimum redundancy. Use for clean digital displays.
- M (Medium): ~15% recovery — default for most generators. Good balance for print.
- Q (Quartile): ~25% recovery — use when the code might get partially covered or dirty.
- H (High): ~30% recovery — use when embedding a logo in the center of the QR code.
If you want to place a logo in the center of your QR code, you must use error correction level H. The logo effectively "damages" the code, and H-level correction compensates for it.
Generating QR Codes Online (Free)
The fastest way to create a QR code is with our free QR Code Generator. It runs entirely in your browser — no data is sent to any server. You can generate codes for:
- URLs: Any website link, automatically detected
- WiFi:
WIFI:T:WPA;S:NetworkName;P:Password;;format, auto-connects on scan - vCards: Contact information that adds directly to phone contacts
- Plain text: Any arbitrary text content
- Email:
mailto:links with subject and body
You can also generate barcodes (Code 128, EAN-13, UPC-A) if you need one-dimensional codes for product labeling.
Generating QR Codes With JavaScript
For programmatic generation, the most popular library is qrcode (npm):
// Node.js
const QRCode = require('qrcode');
// Generate as data URL (for img src)
const dataUrl = await QRCode.toDataURL('https://securebin.ai', {
errorCorrectionLevel: 'H',
width: 400,
margin: 2,
color: { dark: '#000000', light: '#ffffff' }
});
// Generate as SVG string
const svg = await QRCode.toString('https://securebin.ai', { type: 'svg' });
// Generate to file
await QRCode.toFile('./qr.png', 'https://securebin.ai');
Python
import qrcode
qr = qrcode.QRCode(
version=None, # auto-detect smallest version
error_correction=qrcode.constants.ERROR_CORRECT_H,
box_size=10,
border=4,
)
qr.add_data('https://securebin.ai')
qr.make(fit=True)
img = qr.make_image(fill_color="black", back_color="white")
img.save("qr.png")
QR Code Size and Scanning Distance
The minimum size depends on scanning distance. A general rule: the QR code should be at least 1/10th of the scanning distance. For example:
- Phone at 10 cm: QR code can be as small as 1 cm (business cards)
- Phone at 30 cm: QR code should be at least 3 cm (menus, labels)
- Phone at 1 m: QR code should be at least 10 cm (posters)
- Phone at 3 m: QR code should be at least 30 cm (signage)
Also ensure sufficient quiet zone (white border) around the code — at least 4 modules wide.
Static vs Dynamic QR Codes
Static QR codes encode the data directly. Once printed, the content cannot be changed. If you encode a URL and later want to change it, you need a new QR code.
Dynamic QR codes encode a short redirect URL that points to the actual destination. The redirect can be updated without changing the printed QR code. Dynamic codes also enable scan analytics (location, time, device). Most dynamic QR code services charge a monthly fee.
For one-time use or permanent links, static codes are perfectly fine. Our QR Code Generator creates static codes — simple, no tracking, no dependencies.
WiFi QR Codes: Auto-Connect on Scan
WiFi QR codes use a special format that mobile devices recognize:
WIFI:T:WPA;S:MyNetworkName;P:MyPassword;H:false;;
T:— Security type:WPA,WEP, ornopassS:— SSID (network name)P:— PasswordH:— Hidden network (trueorfalse)
When scanned, Android and iOS will prompt the user to connect automatically. This is perfect for guest networks in offices, restaurants, and hotels. Generate one instantly with our QR Code Generator — select "WiFi" mode and fill in your network details.
Generate QR Codes Instantly
Create QR codes for URLs, WiFi, text, email, and more. Free, no signup, 100% client-side. Download as PNG or SVG.
Open QR Code GeneratorCommon QR Code Mistakes
- Too small: Test at the actual scanning distance before printing.
- Low contrast: Black on white works best. Avoid light colors on light backgrounds.
- No quiet zone: The white border is part of the spec. Do not crop it.
- Too much data: Long URLs create dense, hard-to-scan codes. Use a URL shortener for URLs over 100 characters.
- Wrong error correction with logos: If embedding a logo, use level H. Level L will not survive the damage.
- Not testing: Always test with multiple devices and apps before mass printing.
The Bottom Line
QR codes are simple to generate but have surprising technical depth. Choose the right error correction level for your use case, size the code appropriately for the scanning distance, and always test before printing. For instant, free QR code generation, use our QR Code Generator or Barcode Generator for 1D codes.
Related tools: URL Encoder (for encoding URLs before embedding), Base64 Encoder, and 50+ more free tools.