QR code structure diagram showing finder patterns, quiet zone, and data modules
Dev Tools

How to Generate a QR Code — What Works, What Doesn't, and Why

Sunny Pal Singh · · 6 min read

QR codes are everywhere — restaurant menus, product packaging, conference badges, billboard ads — yet most people generate them by grabbing the first result from a Google search for "qr code generator", downloading a PNG, and hoping it scans. The difference between a QR code that works reliably and one that produces errors in poor lighting or at small sizes comes down to a few decisions most tutorials skip.

A QR code that looks fine on screen can fail to scan on a business card. One generated at the wrong resolution will print as a blurry mess. One with too much data packed into a small physical size will confuse every camera that tries to read it. None of these failures are obvious until you're standing at a conference booth watching someone's phone refuse to scan your poster.

Understanding four decisions — what to encode, error correction level, export format, and output size — is the difference between a QR code that works everywhere and one that fails at the worst moment.

Key Takeaways

  • QR codes encode data as a grid of black and white modules — more data means more modules, which means more scanning failures at small sizes
  • Error correction level (L/M/Q/H) determines how much of the code can be damaged or obscured before it fails — use H for print, L for digital
  • Dynamic QR codes redirect through a short URL you control — you can change the destination without reprinting
  • A QR code for a URL works best when the URL is short — every extra character increases code complexity
  • Always test scan before publishing — especially at the final print size

What a QR Code Actually Is

A QR code (Quick Response code) is a 2D barcode that encodes data as a grid of square modules. When a camera scans it, it decodes the pattern back into the original data — typically a URL, but it can be plain text, a phone number, an email address, a WiFi credential, or a vCard contact.

QR codes have four key properties that affect usability:

  • Version (1–40): determines the grid size. Version 1 = 21×21 modules. Version 40 = 177×177. Higher version = more data but harder to scan at small sizes.
  • Error correction level: L (7%), M (15%), Q (25%), H (30%). The percentage is how much of the code can be damaged or obscured and still scan correctly.
  • Encoding mode: numeric, alphanumeric, byte, or kanji. Shorter data = simpler code.
  • Quiet zone: the white border around the code. Minimum 4 modules wide. Remove it and many scanners fail.

Static vs Dynamic QR Codes

Static QR codes encode the destination directly. The URL is baked into the pattern. If the destination URL changes, you need a new code. For permanent destinations (a specific page that won't move), static is fine.

Dynamic QR codes encode a short redirect URL (like qr.example.com/abc123). The redirect destination is stored in a database you control. Change the database entry and the same physical QR code now points somewhere else. Ideal for printed materials where reprinting is expensive.

For most individual or small-business use cases, static is simpler and free. Dynamic requires a paid service for the redirect infrastructure.

Choosing Error Correction Level

Level Data recovery Best for
L (Low, 7%) Minimal Clean digital use, simple URLs
M (Medium, 15%) Moderate General purpose
Q (Quartile, 25%) Good Codes with logos overlaid
H (High, 30%) Maximum Print, outdoor, small sizes

Higher error correction = larger code (more modules needed). For a URL printed at 2cm×2cm on a business card, use H. For a QR code displayed on a screen at 200×200px, L is fine.

What Makes QR Codes Unscannable

The most common causes of scan failure:

1. Too much data for the size — encoding a 200-character URL into a code that's 1cm × 1cm on print. The modules become too small for cameras to resolve. Fix: shorten the URL first, or use a larger print size.

2. Insufficient contrast — light grey on white, or dark grey on black. QR codes need near-black modules on near-white backgrounds. Coloured QR codes work only if the contrast ratio stays above ~3:1.

3. Missing quiet zone — the white border cropped out in design. Every QR code needs a 4-module-wide white border on all sides. Without it, scanners can't find the finder pattern (the three square corner markers).

4. Low resolution for print — using a 150×150px PNG for a 5cm×5cm print area. The resulting code is blurry at print DPI. Always export SVG for print, or PNG at a minimum of 1000×1000px.

5. Logo overlay too large — adding a brand logo in the centre is popular and works with high error correction — but only if the logo covers less than 30% of the code area (matching H-level correction capacity).

Test at final size before printing. A QR code that scans fine at 500px on screen may fail at 3cm in print. Always print a test page at production size and scan it with a real device before committing to a print run.

Step-by-Step: Generating a QR Code

  1. Decide what you're encoding — URL, plain text, vCard, WiFi credentials, phone number
  2. Shorten the URL if it's long (use a URL shortener or a clean slug)
  3. Choose error correction level — H for print, L or M for digital
  4. Generate with the ByteWaveNetwork QR Code Generator — choose data type, enter content, select error correction, download SVG or PNG
  5. Test scan from the device and OS your audience uses (iPhone camera ≠ Android camera in some edge cases)
  6. Test at the final display size — what scans at 500px on screen may fail at 3cm in print

QR Codes for Common Use Cases

Use case Best encoding Error correction Notes
Website URL URL M or H Shorten URL first
WiFi credentials WiFi format H Format: WIFI:T:WPA;S:name;P:pass;;
Contact (vCard) vCard H Keep fields minimal for smaller code
Email address mailto: URI M
Phone number tel: URI M
App store link URL H Links are long — consider dynamic code
WiFi QR codes: the format is WIFI:T:WPA;S:YourNetworkName;P:YourPassword;; — the double semicolon at the end is required. Most modern smartphones (iOS 11+, Android 10+) can scan these and connect directly without typing the password.

SVG vs PNG — Which to Download

SVG is a vector format — infinitely scalable with no quality loss. Always use SVG for print, large-format displays, and any context where the final size is unknown. SVG files are also smaller in file size for simple QR codes.

PNG is a raster format — fixed pixel dimensions. Fine for digital use (web pages, email, social) at a known size. If you need PNG for print, generate at 1000×1000px minimum — enough resolution for codes up to approximately 10cm × 10cm at 300 DPI.

Generate a QR Code Free

No signup. Enter a URL or text, choose your error correction level, and download as SVG or PNG — ready for print or digital use.

Try the QR Code Generator Free →
SP

Sunny Pal Singh

Fellow · Technical Director — AI Infrastructure, Cloud Orchestration & Network Automation

Sunny is a Fellow and Technical Director specialising in AI infrastructure, cloud orchestration, and network automation. With hands-on depth across AWS, Azure, GCP, Red Hat OpenStack, and OpenShift, he leads high-performing teams of architects and engineers building transformative solutions at scale. He built ByteWaveNetwork to bring the same engineering rigour to everyday web tooling.

Affiliate disclosure: Some links on this page may be affiliate links. We only mention tools we've personally used and have an honest opinion about. Affiliate revenue helps keep ByteWaveNetwork's tools free and maintained. We are not paid by any of the tools compared in this article for favorable coverage.

Choose design