How to Generate QR Codes
March 22, 2026 · 6 min read
QR codes are those square barcodes you see everywhere — restaurant menus, event tickets, product packaging, and marketing materials. They encode data (usually a URL) that any smartphone camera can scan instantly. Whether you need to generate one for a project, a business card, or a WiFi login, this guide covers every approach.
What Is a QR Code?
QR stands for "Quick Response." Invented in 1994 by Denso Wave for tracking automotive parts, QR codes can encode up to 4,296 alphanumeric characters. They use Reed-Solomon error correction, meaning they still work even if part of the code is damaged or obscured.
QR codes can encode several types of data:
- URLs — the most common use case (e.g., https://utilshed.com)
- Plain text — any string up to ~4KB
- WiFi credentials — format: WIFI:T:WPA;S:NetworkName;P:Password;;
- vCards — contact information
- Email addresses — mailto:user@example.com
- Phone numbers — tel:+15551234567
Method 1: Use a Free Online Generator
The fastest way to create a QR code is with an online tool. No signup, no install — just paste your data and download the image.
Enter any URL or text to generate a downloadable QR code.
Open QR Code GeneratorMethod 2: Generate QR Codes in JavaScript
The qrcode npm package is the most popular choice for Node.js and browser-based QR code generation.
Install
Generate in Node.js (save to file)
Generate in the browser
Method 3: Generate QR Codes in Python
The error_correction parameter controls how much of the QR code can be damaged and still scan:
- ERROR_CORRECT_L — 7% recovery
- ERROR_CORRECT_M — 15% (default)
- ERROR_CORRECT_Q — 25%
- ERROR_CORRECT_H — 30% (use this if you want to add a logo overlay)
Method 4: Command Line
Generate QR codes directly from the terminal:
Method 5: Using a QR Code API
If you need to generate QR codes dynamically without installing anything, use a public API:
WiFi QR Codes
One of the most practical QR code use cases — let guests connect to your WiFi by scanning a code instead of typing the password:
Paste the WiFi string into any QR code generator and share the resulting image. Most modern phones will auto-detect the WiFi format and offer to connect.
Best Practices
- Size matters — QR codes should be at least 2cm x 2cm for reliable scanning. For billboards or signs, use at least 10cm.
- Contrast is key — Use dark foreground on light background. Avoid low-contrast color combinations.
- Use URL shorteners for long URLs — Shorter data = simpler QR code = easier to scan.
- Test before printing — Always scan your QR code with multiple phones before using it in print.
- Use high error correction for print — ERROR_CORRECT_H (30%) is recommended for physical media that might get scratched or folded.
- Add a quiet zone — Leave white space around the QR code (most libraries add this by default with the margin option).
Try It Now
Need a QR code right now? Use the free QR Code Generator on UtilShed — paste any URL or text, customize the size, and download instantly.
Related tools you might find useful:
- URL Encoder — encode URLs before embedding them in QR codes
- Base64 Encoder — encode binary data as text for QR payloads
- Password Generator — generate a strong WiFi password, then create a QR code for it