📱

QR Code

A QR code (Quick Response) is a two-dimensional matrix of black and white modules that encodes data optically. It can store up to 2,953 bytes and uses Reed-Solomon error correction at 4 levels, enabling reading even with up to 30% damage.

The QR code was invented in 1994 by Denso Wave (a Toyota subsidiary) to track parts in automotive manufacturing. They needed something that could be read faster than traditional barcodes, hence the name Quick Response.

It's a 2D matrix of black squares (modules) on a white background. Unlike a 1D barcode that stores ~20 characters, a QR can hold up to 4,296 alphanumeric characters or 2,953 bytes in binary.

The magic lies in three key components: the position patterns (three large squares in corners) that allow detecting the code in any orientation, the alignment patterns (small internal squares in large codes) that correct distortion, and the timing patterns (alternating lines) that define module size.

QR is an ISO/IEC 18004 standard since 2000. Denso Wave released the patent for public use, making it universal. Today you see it in payments (PayPal, Venmo), advertising, 2FA authentication, WiFi (sharing credentials), and restaurant menus post-pandemic.

Capacity depends on three factors: version (matrix size), correction level, and data type.

Version: ranges from 1 to 40. Version 1 is 21×21 modules, each version adds 4 modules per side. Version 40 is 177×177 (31,329 total modules). Higher version = more data, but harder to scan from distance.

Reed-Solomon correction levels:

  • L (Low): recovers up to 7% damage. Uses less space for correction, more for data.
  • M (Medium): 15% damage. Standard balance.
  • Q (Quartile): 25% damage. Recommended for industrial environments.
  • H (High): 30% damage. Allows embedding logos or designs over the code.

Data type: numeric (3.4 bits per digit), alphanumeric (5.5 bits per char: A-Z, 0-9, some symbols), byte/binary (8 bits), kanji (13 bits). Example: 4,296 numeric characters vs 2,953 bytes vs 1,817 kanji.

A Version 10, level M QR can store ~220 alphanumeric characters. Enough for a long URL or compact JSON.

Mobile payments: PayPal QR, Venmo. The code contains merchant ID + amount + reference. User's app scans and confirms payment without typing anything.

WiFi sharing: standard format WIFI:T:WPA;S:network_name;P:password;;. Scan and connect automatically, no password typing.

2FA authentication: Google Authenticator, Authy. The QR encodes an otpauth://totp/ URI with the secret key. One scan configures the app.

Industrial traceability: each part carries a QR with batch, date, origin. Scanned at each production stage for real-time tracking.

Digital menus: post-COVID restaurants. QR on the table leads to a PDF or web app with the menu. Updatable without reprinting.

Marketing and packaging: QR codes with level H allow embedding the brand logo in the center while maintaining scannability. Lead to landing pages with campaign tracking.

Generate QRs with reliable libraries: qrcode (JavaScript), qrcode (Python), ZXing (Java). Never trust unknown online services for sensitive data: they can log what you encode.

Correction level: use L or M if the code will be clean and well-lit. Use Q or H if it'll be in dirty environments, small sizes, or if you want to add a logo. Test real scannability after adding custom design.

Physical size: rule of thumb: QR must be at least 2cm × 2cm for scanning from 10cm. For reading from 1 meter, minimum 10cm × 10cm. Calculate: minimum_size = reading_distance / 10.

Contrast: dark modules on light background. Black/white, blue/white work, but not yellow/white (low contrast). Never light modules on dark background: confuses most scanners.

Short URLs: use a shortener (bit.ly, your own short domain) to reduce QR version. Fewer modules = easier to scan. example.com/p/abc better than https://www.example.com/products/category/item?id=12345&ref=qr.

Examples

  • URL: https://genfy.app → 62 characters, Version 3, level M
  • WiFi: WIFI:T:WPA;S:MyNetwork;P:password123;; → auto-connect
  • 2FA: otpauth://totp/Google:user@example.com?secret=JBSWY3DP → Google Authenticator
  • vCard: BEGIN:VCARD\nFN:John Doe\nTEL:+15551234567\nEND:VCARD → contact
  • JSON: {"id":"abc123","amount":1500} → 32 bytes, Version 2

FAQ

How much data can I put in a QR code?

Up to 2,953 bytes (binary) or 4,296 numeric digits or 1,817 kanji characters. But higher capacity means more complex and larger code. Practical: keep under 200 characters for good scannability.

Can I put a logo in the center of the QR?

Yes, if you use correction level H (30%). The logo must occupy less than 25% of total area and preferably cover the central zone (less critical). Test scannability after adding the logo.

Why doesn't my QR scan well?

Common causes: low contrast (light colors), too small size, excessive reading distance, wrinkled or reflective surface, or too much data (very high version). Use black on white and test in multiple apps.