QR Code Technology Explained: Principles, Versions, and Best Practices
The Invention and Basic Principles of QR Codes
The QR Code (Quick Response Code) was invented by Masahiro Hara of the Japanese company Denso Wave in 1994, originally for tracking automotive parts. Unlike one-dimensional barcodes that can only store information horizontally, QR codes arrange data in both horizontal and vertical directions, greatly increasing information density.
The basic unit of a QR code is the black and white square (module). Data is encoded through the color and position of modules, including the data area, finder patterns (the three large squares in the top-left, top-right, and bottom-left), alignment patterns, timing patterns, and format information. When scanning, the camera first determines the QR code position and orientation through the finder patterns, then decodes the data area.
The 40 Versions of QR Codes
The QR code standard defines 40 versions (Version 1-40). Version 1 is a 21x21 module matrix, and each version increase adds 4 modules to each side. Version 40 is a 177x177 module matrix. The higher the version, the more data it can store, but the larger the QR code.
When choosing a version, you need to balance data volume and QR code size. For URLs, Version 3-5 (29x29 to 37x37 modules) is usually sufficient. If the URL is very long (e.g., with many query parameters), a higher version may be needed. It is recommended to use a short link service to reduce the URL length, which can generate smaller, easier-to-scan QR codes.
Error Correction Mechanism and Principles
QR codes use the Reed-Solomon error correction algorithm, which can correctly decode even when parts of the area are damaged or obscured. The four error correction levels are: L (7%), M (15%), Q (25%), and H (30%). The higher the level, the more redundant data and the correspondingly larger the QR code.
The choice of error correction level depends on the use case. L or M is sufficient for digital screen display; M or Q is recommended for printed materials; H for outdoor scenarios that may be soiled. Interestingly, it is the error correction mechanism that makes it possible to place a logo in the center of a QR code - the data covered by the logo can be recovered through redundant information.
Encoding Modes of QR Codes
QR codes support four encoding modes: Numeric mode (most efficient, encoding every 3 digits with 10 bits), Alphanumeric mode (uppercase A-Z, digits 0-9, and 9 special symbols, encoding every 2 characters with 11 bits), Byte mode (8 bits per byte, suitable for Chinese and special characters), and Kanji mode (13 bits per character, supporting only the JIS character set).
For Chinese content, if UTF-8 byte mode is used, each Chinese character requires 3 bytes (24 bits). The Japanese Kanji mode requires only 13 bits, but this only applies to JIS-standard kanji. Most Chinese QR code tools use byte mode to encode UTF-8 Chinese. Choosing the appropriate encoding mode can optimize the QR code size.
QR Code Design and Scannability
A scannable QR code needs to meet the following conditions: sufficient size (at least 0.4mm per module at print size recommended), high contrast (pure black and white is best, avoid gray), adequate margin (Quiet Zone, at least 4 module widths), and a flat, non-reflective surface.
The "art QR codes" that have become popular in recent years beautify QR codes through color substitution, shape variation, and background blending, but excessive design can affect scannability. Safe practices include: maintaining contrast between dark and light modules above 70%, not changing the shape of finder patterns, and using level H error correction. Always test scanning with multiple devices before publishing.
QR Code Application Scenarios and Trends
Payments: WeChat Pay and Alipay have promoted QR code payments globally, making them a symbol of China mobile payments. The core of QR code payment is encoding merchant information and amounts into a QR code, which users scan to complete the payment.
Marketing and information display: QR codes on product packaging can link to detailed instructions, video tutorials, or user manuals; QR codes on restaurant tables enable scan-to-order; business card QR codes facilitate quick contact saving. With the development of AR technology, QR codes may also become trigger markers for augmented reality. During the COVID-19 pandemic, QR codes became an important tool for contactless interaction, accelerating their global adoption.