QR Code Invention and Module Structure
The QR Code (Quick Response Code) was invented in 1994 by Masahiro Hara, an engineer at the Japanese company DENSO WAVE. The original design goal was to solve the problem of tracking automotive parts — traditional one-dimensional barcodes had limited storage capacity, only capturing small amounts of information per scan, while QR codes, through their two-dimensional matrix, could store dozens of times more data in the same physical area.
The module structure of a QR code is a model of engineering design. A standard QR code consists of the following key components:
- Three Finder Patterns: located at the top-left, top-right, and bottom-left corners, each is a 7×7 nested square pattern. The scanner uses these three "targets" to quickly identify the position and orientation of the QR code, which allows QR codes to be scanned at any angle (360 degrees).
- Alignment Patterns: located at the bottom-right and other positions, used to correct image distortion caused by curved surfaces, tilting, or lens distortion. QR codes of version 2 and above include at least one alignment pattern.
- Timing Patterns: a horizontal and a vertical line of alternating black and white modules, running inside the finder patterns, used to determine the precise position and spacing of modules.
- Format Information: located inside the finder patterns, storing the error correction level and mask pattern number.
- Data Area: the remaining space is filled with encoded data and error correction codes in a Zig-Zag order.
- Quiet Zone: the blank area surrounding the QR code, at least 4 modules wide. It helps the scanner distinguish between the QR code area and the background pattern, and is crucial for fast recognition.
A QR code module refers to each small black or white square, which is the smallest unit of a QR code. Number of modules = 17 + version number × 4. A version 1 QR code has 21×21 = 441 modules, and version 40 has 177×177 = 31,329 modules.
Four Data Encoding Modes and Chinese Language Support
The QR code standard defines four data encoding modes. Different modes are optimized for different types of input data to store as much information as possible in the limited module space:
1. Numeric Mode: stores only digits 0-9, with the highest encoding efficiency. Every 3 digits are compressed into 10 bits (binary), and for pure numeric content (such as phone numbers, order numbers), numeric mode has a storage density approximately 2.5 times that of byte mode. Version 40 + level L can store up to 7,089 numeric characters.
2. Alphanumeric Mode: stores digits 0-9, uppercase letters A-Z, and 9 special symbols (space, $, %, *, +, -, ., /, :). Every 2 characters are compressed into 11 bits, about 1.5 times more efficient than byte mode. Version 40 + level L can store up to 4,296 characters.
3. Byte Mode: stores data according to the ISO-8859-1 character set, with each character occupying 8 bits. This is the most general mode, suitable for storing plain text, URL links, and mixed content. Version 40 + level L can store up to 2,953 bytes.
4. Kanji Mode: specifically optimized for Japanese Kanji and Kana storage, with each Japanese character compressed into 13 bits, about 1.2 times more efficient than byte mode. Version 40 + level L can store up to 1,817 Japanese characters.
About Chinese Language Support: the QR code standard itself does not natively support Chinese encoding modes. The industry standard approach is to use byte mode + UTF-8 encoding to store Chinese text: each Chinese character typically occupies 3 bytes in UTF-8, so one Chinese character requires 24 bits in byte mode. A version 40 + level L QR code can store approximately 980 Chinese characters. This tool uses exactly this standard solution, and all mainstream mobile phone (iPhone, Android) camera apps and scanning apps such as WeChat and Alipay fully support UTF-8 Chinese QR codes.
A practical tip: for content containing only numbers or uppercase letters (such as short links, coupon codes), using numeric or alphanumeric mode can generate smaller QR codes, thereby improving printing and scanning reliability.
Reed-Solomon Error Correction Algorithm: Four-Level In-Depth Comparison
The most revolutionary feature of QR codes is their powerful error correction capability, made possible by the Reed-Solomon error correction algorithm. Proposed by Irving S. Reed and Gustave Solomon in 1960, this algorithm was originally used for deep-space communications (NASA's Voyager probes used Reed-Solomon codes to combat cosmic noise). The QR code standard adopted this algorithm in 1994, enabling QR codes to be scanned correctly even when partially damaged or obscured.
The principle of Reed-Solomon error correction is: in addition to the original data, additionally generate and store a certain proportion of redundant data (error correction codes). During scanning, the decoder can use these redundant data to reconstruct missing or damaged parts. The higher the proportion of redundant data, the more errors can be recovered, but the less original data can be stored.
The QR code standard defines four error correction levels:
- L (Low): approximately 7% recovery capability — the lowest proportion of redundant data, allowing the most original data to be stored in the same version. Suitable for clean, flat printing scenarios that will not wear out, such as electronic ticket screen display, indoor posters. Version 40 + level L can store up to 7,089 numeric characters.
- M (Medium): approximately 15% recovery capability — the most commonly used default level, achieving a good balance between error correction capability and data density. Suitable for business cards, menus, product labels, general marketing materials and most other scenarios. This is the default option for this tool. Version 40 + level M can store up to 5,596 numeric characters.
- Q (Quartile): approximately 25% recovery capability — suitable for harsher environments, such as outdoor advertisements (which may be exposed to sun, rain, and wear), industrial labels, logistics packaging, and documents for long-term storage. Version 40 + level Q can store up to 3,993 numeric characters.
- H (High): approximately 30% recovery capability — the highest error correction level. When you need to insert a logo, icon, or brand mark in the center of the QR code, it is strongly recommended to use level H, because the logo will cover approximately 15%-20% of the module area. Level H is also suitable for outdoor display, long-term preservation, and fast-moving scanning scenarios. Version 40 + level H can store up to 3,057 numeric characters.
Relationship between Error Correction Level and Logo: when you place a logo in the center of the QR code, the covered module area accounts for approximately 10%-20% of the total QR code area. If using level L or M, the modules covered by the logo may exceed the recovery capability of the error correction algorithm, causing the QR code to be unscannable. Using level H (30% recovery capability) ensures that even if approximately 20% of the central area is covered by the logo, there is still sufficient redundant data for recovering the original information. This tool automatically switches to level H after detecting that you have uploaded a logo, to maximize the scannability of the QR code.
Version Selection and Data Capacity: Complete Comparison from V1 to V40
QR code versions range from 1 to 40, a total of 40 levels. For each increase in version, the number of modules per side increases by 4, and the storable data volume increases accordingly. Choosing the appropriate version is the key to balancing QR code size and information capacity.
Versions 1-10 (Small QR Codes): version 1 has 21×21 modules, version 10 has 57×57 modules. These smaller versions are suitable for storing short content — version 5 (37×37 modules) + level M can store approximately 100 numbers or 60 bytes, enough to accommodate a short URL or simple text message. Small version QR codes occupy less space when printed, suitable for business cards, product labels, badges, and other scenarios.
Versions 11-25 (Medium QR Codes): version 15 has 77×77 modules, version 25 has 117×117 modules. This range is the most commonly used, suitable for storing medium-length content — version 15 + level M can store approximately 750 numbers or 450 bytes, version 25 + level M can store approximately 2,000 numbers or 1,200 bytes. Suitable application scenarios: WiFi configuration QR codes, vCard electronic business cards, product detail links, activity posters including brief descriptions.
Versions 26-40 (Large QR Codes): version 40 has 177×177 modules, which is the maximum version of standard QR codes. Version 40 + level L can store 7,089 numeric characters or 2,953 bytes (approximately 2.9 KB of plain text). Large version QR codes are suitable for storing longer content, such as complete article paragraphs, JSON data, full product descriptions, encrypted credentials, etc. However, note that the higher the version, the larger the QR code — when printing, sufficient physical size must be ensured (at least 2-3 pixels per module, for printing it is recommended to have at least 0.25mm per module), otherwise recognition difficulties may easily occur during scanning.
Automatic Version Selection Mechanism: this tool automatically selects the smallest available version that can accommodate the content, based on the length of your input and the selected error correction level. This means: for the same content, selecting a higher error correction level (such as H) will result in the use of a larger version, and the physical size of the QR code will be larger. Conversely, if the content is short (such as "Hello"), even with level H selected, the tool will still use version 1 or 2 to generate a compact QR code.
Special Format for WiFi QR Codes: when using WiFi mode, the content is encoded according to the standard format: WIFI:T:WPA;S:network name;P:password;;. This is an industry convention format promoted by the ZXing project (an open-source barcode library maintained by Google), natively supported by iOS 11+, Android 10+ cameras, and mainstream applications such as WeChat, Alipay, and QQ. No special App installation required — mobile phone cameras can directly scan to connect to WiFi.
Logo Insertion and Color Customization: Practical Best Practices
Traditional QR codes are purely black and white, but with the evolution of technology and aesthetics, custom colors and logos have become a common requirement in brand marketing. This section provides best practice guidelines for these advanced features.
Principles of Logo Insertion: the modules in the central area of a QR code account for approximately 10%-20% of the total area. Based on the Reed-Solomon error correction algorithm, even if this area is completely obscured, the QR code can still be recovered. Logos precisely utilize this feature — placing the brand mark in the center of the QR code. However, please note the following principles:
- The logo area should not exceed 20% of the total QR code area; exceeding this may render the error correction algorithm unable to recover the obscured data, even with level H.
- Try to choose simple logos — logos with complex, intricate details become blurry on small-sized QR codes, affecting brand recognition effectiveness.
- Retain a white background or white border around the logo, to avoid confusion between logo colors and QR code module colors, which would interfere with the scanner's module recognition.
- Always use level H error correction — this tool automatically switches to level H after detecting that you have uploaded a logo.
- After generation, be sure to perform actual scanning tests, using a variety of different mobile phones (iPhone, different brands of Android) to verify scannability.
Principles of Color Customization: QR codes do not require a strict "black and white" color scheme, but they require sufficient brightness contrast between modules. The key principle for color selection:
- The foreground color (module color) must be darker than the background color (lower brightness). Inverse color schemes (bright modules + dark background) are not recommended — although some scanners support this, the recognition rate will significantly decrease.
- The brightness contrast between foreground and background colors should not be less than 60%. It is recommended to use dark colors (blue, black, dark green, dark purple) as the foreground color, and light colors (white, light gray, beige) as the background color.
- Avoid same-color family schemes (such as dark blue + light blue) — although distinguishable to the human eye, mobile phone camera CMOS sensors have poorer ability to distinguish between colors of similar brightness.
- Avoid using red as the foreground color. Most mobile phone camera CMOS sensors have lower sensitivity to the red channel, and red modules may be recognized as background.
- When using custom colors, it is recommended to increase the error correction level to Q or H, to compensate for the loss of recognition rate caused by decreased color contrast.
Choice of Export Format: PNG is the most universal format, with lossless compression and good transparent background support, suitable for the vast majority of scenarios; JPG files are smaller but lose precision, not recommended for QR codes containing fine modules; WEBP maintains lossless quality while having smaller file sizes, suitable for web embedding; SVG is a vector format, with no distortion at any scale, suitable for scenarios requiring large-format printing (such as outdoor billboards). This tool supports one-click export in all four formats.
Scan Recognition Rate Optimization and Common Issues
A "beautiful-looking" QR code loses practical value if its scan rate is low. The following are the key factors affecting scan recognition rate and optimization strategies:
1. Minimum Module Size: each module in the QR code needs sufficient physical size when printed or displayed, otherwise the mobile phone camera cannot distinguish it. Recommended minimum module size: 2-3 pixels per module for screen display (for example, a 25×25 module QR code should be displayed at least 50×50 pixels on screen); 0.25 millimeters per module when printed on paper. Smaller module sizes will result in failed long-distance scanning.
2. Quiet Zone: the QR code needs to retain a blank margin of at least 4 modules width on all sides. The function of this blank area is to help the scanner distinguish between the "QR code area" and the "background area" — especially when the QR code is placed on a complex background (such as a colorful poster, photograph), the role of the quiet zone becomes more critical. This tool sets the margin to 4 by default. We recommend retaining this default value in most cases and not setting the margin to 0 or 1.
3. Background Interference: if the QR code is printed on a patterned, textured, or gradient-colored background, the scanner may have difficulty accurately identifying module boundaries. It is recommended that the direct background of the QR code remain a solid color (white or light color), and complex decorative patterns should be placed outside the quiet zone.
4. Printing Quality: ink dot diffusion in inkjet printers, low resolution in laser printers, and color offset during the printing process can all damage precise module boundaries. It is recommended to test with the printer's highest resolution before final printing, and perform actual scanning verification on the finished printed product.
5. Reflection and Lighting: reflections on glass surfaces, glare from plastic packaging, and strong backlighting all affect scanning. If the QR code needs to be affixed to transparent packaging, it is recommended to add an opaque white backing to the back of the QR code.
6. Common Issue Troubleshooting:
- Cannot Scan: check whether the contrast between foreground and background colors is sufficient, whether the logo obscures more than 20% of the area, whether the content length exceeds the capacity of the current version, whether printing is blurry.
- Some Phones Can Scan, Some Cannot: usually a color contrast or module size issue. Older mobile phone cameras and algorithms have higher sensitivity to low contrast. Try increasing the contrast or enlarging the physical size of the QR code.
- Chinese Characters Display Garbled After Scanning: very few old or non-mainstream scanning apps may not support UTF-8 encoding. Ensure that the scanning app is the system native camera (iOS 11+/Android 10+), WeChat, Alipay, or other mainstream applications.
- Link Cannot Open After Scanning: check whether the URL is complete (must include http:// or https:// prefix), whether there are special characters that have not been correctly encoded, whether it exceeds the character length limit.
Local Processing and Privacy Protection Strategies
QR codes may seem simple, but when the content involves sensitive information (such as WiFi passwords, personal contact information, internal system links, confidential project numbers), the importance of privacy protection cannot be ignored.
Why Choose Local Processing: this tool uses a fully localized generation scheme, and all input content is not uploaded to any server. From text encoding, Reed-Solomon error correction calculations, module matrix generation to final image rendering — every step is completed in your own browser through JavaScript.
Core advantages of local processing:
- No Network Dependency: even when completely disconnected from the internet, the tool still works normally. Suitable for use on airplanes, in remote areas, and in strict intranet environments.
- No Data Recording: since the data never leaves your device, there is no possibility of it being stored, analyzed, forwarded, or used to train AI models.
- Immediate Clearance: after closing the browser tab, all input content and generated QR code images are immediately cleared from memory.
- Performance Advantage: local computation speed is much faster than the round-trip process of "upload-server generation-download", especially more obvious when generating large version QR codes or batch generation.
Safety Recommendations for Sensitive Content: although this tool does not upload data, please still note the following points:
- When containing sensitive content such as WiFi passwords, access credentials, personal identity information, it is recommended to close the browser tab after generating and downloading the QR code, to avoid accidental leakage through the browser's auto-restore or auto-fill functions.
- When containing enterprise internal links or project information, it is recommended to operate in a controlled environment (such as company intranet devices).
- It is not recommended to generate sensitive QR codes on public computers or shared devices, or ensure that the clipboard and download records are cleared after generation.
- Downloaded QR code image files themselves may remain in the download directory; delete them promptly if no longer needed.
Static QR Codes vs Dynamic QR Codes: a common misconception is that "QR codes expire". In reality, static QR codes (the type generated by this tool) never expire — they simply encode text or link information, and as long as the original link remains valid, the QR code can always be scanned. Dynamic QR codes are intermediate redirect links generated through third-party services, where the service provider can count scan times, update the target link, or invalidate the link without updating the QR code. Dynamic QR codes usually require a paid subscription service and carry privacy risks such as dependency on third-party services (if the service stops, the QR code will fail) and the requirement to upload content to the server. For most personal and small business scenarios, locally generated static QR codes are a safer and more reliable choice.
For more details on this tool's privacy protection strategy, see our Privacy Policy page.