QR Code & Barcode Types Reference
QR codes and barcodes bridge the physical and digital worlds. This page summarizes common symbologies, capacities, use cases, QR error correction levels and the standard WiFi QR format.
Practical Notes
- QR error correction trades off against capacityLevel H (about 30% recovery) survives heavy occlusion and print wear, but holds noticeably less data at the same physical size than level L. Use H for posters where the code may be obscured, and M/L for on-screen use.
- Longer content means denser modules and harder scanningAt a fixed QR size, more characters means smaller modules, which defeats low-resolution cameras. Shorten long URLs with a link shortener or use shorter field names instead of just printing bigger — the available layout limits that anyway.
- 1D barcodes carry check digits; hand-built values often failEAN-13 and CODE128 include check digits or special start/stop symbols, so concatenating digits by hand yields an unscannable code. Always generate through a library, and error out on check failure instead of emitting silently.
Data Sources
- ISO/IEC 18004 (QR Code)
- ISO/IEC 15417 (Code 128)
- ISO/IEC 15420 (EAN/UPC)
Codes, names and definitions above come from public specifications; we claim no originality over the specification data itself. The arrangement, Chinese annotations and practical notes on this page are written by us.
How It Works
Barcodes and QR codes essentially encode data into machine-readable graphical symbols. A 1D barcode (e.g. CODE128, EAN-13) represents characters only horizontally with bars and spaces of varying width; it carries little data and needs a specific scan angle. A 2D code (e.g. QR Code) encodes in both directions, offering large capacity, error recovery and phone-camera readability at any angle.
A QR error correction level (L/M/Q/H, about 7/15/25/30 percent recovery) uses Reed-Solomon redundancy: redundant information is scattered across the pattern so the original data can still be recovered even when partly obscured, damaged or overlaid with a logo. Higher levels make the pattern denser and reduce capacity for the same payload, so trade capacity against robustness.
When to Use This Table
This table is for choosing a barcode symbology or a QR error correction level. It puts QR Code, Code 128, EAN-13, Code 39, Data Matrix and Aztec side by side by type, capacity and typical use, and explains the L/M/Q/H correction levels.
When not to consult it: you are designing the complete print and scanning scheme. Symbology choice depends on scanning distance, print process, whether the interaction is bidirectional (can scanning return data), and whether target devices support a symbology at all — that needs real testing rather than lookup.
Rule of thumb: decide on bidirectionality first. A one-dimensional code stores data and the scan simply ends; a QR code can carry a URL or command and supports error correction, which suits interactive use. Recording an identifier such as an order number is more efficient in a 1D code, while anything where a customer scans with a phone (open a menu, pay, view details) must be a QR code.
Mind the trade-off between correction level and capacity: level H tolerates 30% damage but shrinks capacity to roughly 55% of level M. Choosing H blindly for long content inflates the symbol until it exceeds the resolution of the printer or screen and stops scanning.
Boundaries and Common Pitfalls
Higher correction means less capacity, and level H can stop scanning for long content
Correction works by redundancy: about 7% for L, 15% for M, 25% for Q and 30% for H, so damage tolerance rises while the same content needs a larger symbol. With long content at level H the module density exceeds what a screen or printer can resolve, and scanning fails entirely at a distance or under glare. Pick the smallest level that suffices — L or M for short clean content, Q or H where print will wear — and switch to Data Matrix or Aztec when density is the binding constraint.
Static and dynamic barcodes are different product shapes
A static barcode prints the content directly on the label, one code per item, extremely cheap and suited to shelves and fixed assets. A dynamic barcode, or a QR pointing at a short link, resolves to a server-side record looked up at scan time, which makes the content mutable, measurable and revocable — a delisted or recalled item only needs a database change, not a label swap. The trade-off is that the server and link service become dependencies, so a label failure or expired link directly affects fulfilment.
A missing quiet zone is a frequent cause of unreadable codes
Every QR spec requires a quiet zone around the symbol, normally four module widths. It is not cosmetic: decoders use it to locate the symbol boundary, and without enough margin a scanner may report no code found or decode the wrong content entirely. Printing that crops edges, wraps a symbol onto a container corner, or butts it against text all destroy the quiet zone. Design files should include it in the canvas and leave real whitespace around the code.
How This Relates to Neighbours
To generate or decode QR codes, use the in-site QR tools; this page is a selection reference, not a generation pipeline.
Print processes (thermal, laser, inkjet) and scanner hardware selection are outside this table.
Designing the availability of a short link service behind dynamic codes is backend architecture and needs a fallback plan.
If the goal is debugging an unreadable code, measure the quiet zone and module width first, then contrast and damage, and only then suspect the wrong symbology.
Practical Snippet
Key points: (1) pick the smallest sufficient correction level by content length (L/M/Q/H give roughly 7/15/25/30% redundancy) — a long payload at level H pushes module density past what scanners resolve and stops reading; (2) always emit a full quiet zone (margin: 4), since decoders rely on it to locate the boundary, and cropping or wrapping onto a corner destroys it; (3) before printing, check the minimum module size in millimetres — at 300dpi keep it above 0.33mm; (4) choose between dynamic codes (short link to a server record, mutable and revocable but with a service dependency) and static codes (cheap and dependency-free but requiring a relabel when content changes) based on fulfilment needs.
// ① 按内容长度选纠错等级(不是越高越好)
function pickEcc(textLength) {
if (textLength < 100) return 'L' // 约 7% 冗余
if (textLength < 300) return 'M' // 约 15%
if (textLength < 600) return 'Q' // 约 25%
return 'H' // 约 30%,仅在内容短且需抗污损时用
}
// ⚠️ 内容长还选 H ⇒ 模块密度超出分辨极限 ⇒ 反而扫不出
// ② 生成时务必给足静区(quiet zone,通常 4 个模块)
import QRCode from 'qrcode'
const png = await QRCode.toBuffer('https://example.com/p/12345', {
errorCorrectionLevel: 'M',
margin: 4, // ← 静区;设 0 会导致很多扫码器找不到边界
width: 512, // 物理尺寸要够大
})
// ③ 打印前自检:对比度与最小模块尺寸
function checkPrintable(svg, minModuleMm = 0.33) {
// 300dpi 打印时,最小模块应 ≥ 0.33mm,否则热敏头或激光会糊掉
const m = svg.match(/viewBox="0 0 (d+) (d+)"/)
if (!m) return { ok: false, reason: '缺 viewBox,无法算模块尺寸' }
const modules = Number(m[2]) - 8 // 减去 2×4 静区
return { ok: true, modules, minMm: (512 / modules).toFixed(2) }
}
// ④ 动态码:短链 + 后端记录(内容可变、可撤销)
const code = await QRCode.toDataURL('https://s.example.com/' + token, { margin: 4 })
// 商品下架 / 召回:只改数据库记录,标签不用换
// ⑤ 静态码:内容直接编码(成本低,无依赖)
const staticCode = await QRCode.toBuffer(JSON.stringify({ sku: 'A-123', lot: 6 }), {
errorCorrectionLevel: 'Q', margin: 4,
})
// ⚠️ 内容不可变 ⇒ 变更就意味着换标签
// ⑥ 一维码用于纯编号(更小的标签面积)
import JsBarcode from 'jsbarcode'
// Code128 可变长字符串,EAN-13 限 13 位数字
JsBarcode(svgEl, '1234567890123', { format: 'EAN13', margin: 10 })Common Symbologies
| Symbology | Type | Capacity | Best For |
|---|---|---|---|
| QR Code | Matrix 2D code | 7,089 numeric / 4,296 alphanumeric / 2,953 bytes | URLs, payments, contact cards, WiFi connections, mobile |
| Micro QR | Compact matrix 2D code | 35 numeric / 21 alphanumeric | Space-constrained parts, IC labels |
| CODE128 | Linear barcode | ASCII 128 charset, high density | Logistics, warehousing, serial numbers |
| EAN-13 | Linear barcode | 13 digits incl. checksum | Retail products, book ISBN |
| UPC-A | Linear barcode | 12 digits incl. checksum | North American retail products |
| CODE39 | Linear barcode | Digits, uppercase, some symbols | Industrial, defense, asset labels |
| ITF-14 | Linear barcode | 14 digits | Outer case packaging, logistics units |
QR Code Error Correction
| Level | Recovery | Suggested Use |
|---|---|---|
| L | ~7% | Short content, clean scan env |
| M | ~15% | Default, balanced capacity/recovery |
| Q | ~25% | Average print quality, higher recovery |
| H | ~30% | Logo overlay, harsh environments |
Frequently Asked Questions
Which QR Code error correction level should I use?
Default to M (15% recovery) for the best balance of capacity and redundancy. Use H (30%) when placing a logo in the center or printing on low-quality surfaces. Use L (7%) only for short content in clean scanning environments. Higher levels produce denser patterns for the same payload.
What is the difference between 1D and 2D codes?
1D barcodes store data in one direction only, carry little data (often tens of characters), require a specific scan angle and are suited for short codes like SKUs and tracking numbers. 2D codes store data both horizontally and vertically, offer large capacity and error recovery, and can be read by phone cameras at any angle, making them ideal for URLs, payments and contact cards.
What is the WiFi QR code format?
The standard format is WIFI:T:<auth>;S:<SSID>;P:<password>;H:<hidden>;;, e.g. WIFI:T:WPA;S:MyNetwork;P:MyPassword;;. Phones can scan it and connect automatically without typing credentials.
Can barcodes contain Chinese characters?
Common 1D barcodes (CODE128, EAN, UPC) only encode digits, letters or ASCII symbols and cannot represent Chinese directly. Use a QR Code for Chinese text because it supports UTF-8 encoding.