QR Codes & Barcodes Explained
How QR codes store data, error correction levels, common payload formats (WiFi, vCard, TOTP, SEPA), and how QR compares to Data Matrix, Aztec and 1D barcodes.
Last updated: 26 July 2026
A QR code (Quick Response code) is a two-dimensional (2D) matrix barcode: a square grid of black and white cells that encodes data in both the horizontal and vertical directions. Invented by Denso Wave in 1994 and standardised as ISO/IEC 18004, QR codes can store far more than a traditional 1D barcode and can still be read even when partly dirty or damaged. Today they appear on payments, tickets, packaging, WiFi sign-in cards, business cards and app-download links.
How a QR code stores data
The individual black and white cells are called modules. Data is encoded as a bit stream — each byte becomes a pattern of dark (1) and light (0) modules — then arranged into the grid following a fixed placement algorithm.
Several structural features let a scanner locate and decode the grid regardless of angle or orientation:
- Finder patterns — the three large concentric squares in the top-left, top-right and bottom-left corners. They let a scanner detect the code and work out its rotation.
- Alignment patterns — smaller squares (in larger versions) that correct for perspective distortion when the code is photographed at an angle.
- Timing patterns — alternating dark/light lines running between finder patterns that define the module coordinate grid.
- Quiet zone — a blank margin of at least 4 modules around the whole code. Without it, scanners struggle to isolate the code from surrounding content.
- Format & version information — encode the error-correction level and mask pattern, and (for larger codes) the version number.
Versions
QR codes come in 40 versions, from version 1 (21×21 modules) to version 40 (177×177 modules). Each step up adds 4 modules per side and stores more data. The generator picks the smallest version that fits your payload at the chosen error-correction level.
Error correction levels
QR codes use Reed–Solomon error correction, so a code stays readable even when part of it is obscured or damaged. There are four levels, trading data capacity for robustness — a higher level adds redundant data, meaning fewer usable modules and therefore a denser or larger code for the same payload.
| Level | Approx. recovery | Trade-off | Typical use |
|---|---|---|---|
| L (Low) | ~7% | Most data capacity, least robust | Clean on-screen display, short-lived codes |
| M (Medium) | ~15% | Balanced default | General print and web use |
| Q (Quartile) | ~25% | Denser, more robust | Codes exposed to dirt or wear |
| H (High) | ~30% | Least capacity, most robust | Codes with a centre logo, industrial/outdoor use |
If you place a logo in the middle of a code, use level H so the covered modules can be reconstructed.
Common QR payload formats
A QR code just stores text — but scanners recognise certain conventional string formats and act on them. The exact syntax matters; a stray character can stop a phone from offering the right action.
URL — the most common payload. Just the full address:
https://codingsetu.com/tools/qr
WiFi — join a network. Escape any ; , : \ in the SSID/password with a backslash:
WIFI:T:WPA;S:MyNetwork;P:MyPassword;;
T is the auth type (WPA, WEP, or nopass), S the SSID, P the password. For a hidden network append H:true;.
vCard / MeCard — a contact. MeCard is more compact:
MECARD:N:Doe,John;TEL:+911234567890;EMAIL:john@example.com;;
BEGIN:VCARD
VERSION:3.0
N:Doe;John
TEL:+911234567890
EMAIL:john@example.com
END:VCARD
Email, SMS, phone, location:
mailto:hello@example.com?subject=Hi&body=Message
SMSTO:+911234567890:Your message here
tel:+911234567890
geo:19.0760,72.8777
otpauth:// (TOTP) — provision a two-factor authenticator app. Defined by the Key URI format:
otpauth://totp/Example:alice@example.com?secret=JBSWY3DPEHPK3PXP&issuer=Example&algorithm=SHA1&digits=6&period=30
WhatsApp — open a chat via wa.me (number in international format, no + or spaces):
https://wa.me/911234567890?text=Hello
SEPA / EPC (Girocode) — a European bank transfer. The EPC QR standard uses a fixed line order:
BCD
002
1
SCT
BANKBEBBXXX
Jane Doe
BE72000000001616
EUR12.50
Invoice 123
1D vs 2D barcodes
A 1D (linear) barcode — EAN-13, UPC, Code 128, Code 39 — encodes data in the varying widths of vertical bars, read along a single line. It holds only a small amount of data (typically a product number) and has no error correction, but it is compact and universally supported at retail.
A 2D barcode stores data in a grid, packing much more information into a smaller area and adding error correction. The main 2D symbologies:
| Symbology | Strengths | Typical use |
|---|---|---|
| QR code | High capacity, ubiquitous phone support, error correction | Marketing, payments, WiFi, tickets, GS1 Digital Link |
| Data Matrix | Very high density at tiny sizes; needs only 20% quiet zone | Direct part marking on small components, electronics, pharma (GS1) |
| Aztec | No quiet zone needed; central finder; robust on low-quality print | Transit and airline boarding passes / e-tickets |
Data Matrix wins where space is extremely tight (marking a circuit board or surgical instrument). Aztec is common on rail and airline tickets because it needs no surrounding quiet zone and reads well from a phone screen or crumpled printout. QR dominates consumer-facing uses thanks to camera support on every phone. All three are increasingly used to carry GS1 structured data — see GS1 Digital Link, which lets a single QR act as both a product barcode and a web link.
Practical tips
- Keep URLs short. Fewer characters mean a lower version and larger, more scannable modules. Use a short domain or a link shortener rather than a long tracking URL.
- Raise the error-correction level for print and logos. Use Q or H for anything physical, especially if a logo overlaps the centre.
- Preserve the quiet zone. Leave at least 4 modules of blank margin on all sides — don’t crowd the code with text or graphics.
- Maximise contrast. Dark code on a light background works best. Avoid inverting colours (light on dark) and avoid low-contrast colour pairs; keep the finder patterns solid.
- Mind the size. A rough rule of thumb: scanning distance ÷ 10 gives the minimum code width (e.g. 1 m distance → ~10 cm code).
- Always test before printing. Scan the final artwork with several phones and camera apps, and re-test after the code is printed at real size.
Standards & references
- ISO/IEC 18004 — the QR code symbology specification (structure, versions, error correction, encoding).
- WiFi QR format — the
WIFI:payload syntax as documented by the ZXing project. - otpauth:// Key URI format — the TOTP/HOTP provisioning URI.
- GS1 Digital Link — encoding GS1 identifiers in a web-friendly QR.
Try it
Generate QR codes and barcodes for any of the formats above — entirely in your browser, with nothing uploaded — using the CodingSetu QR & barcode tools linked below.
Frequently asked questions
What's the maximum data a QR code can hold?
The theoretical maximum (version 40, error correction level L) is about 7,089 numeric digits, 4,296 alphanumeric characters, 2,953 bytes, or 1,817 Kanji characters. In practice you should stay far below this — dense QR codes need a high-resolution scan and a clean print, so keep payloads short and prefer a shortened URL over embedding large blobs.
Which error correction level should I use?
Use L or M for clean on-screen or high-quality print where nothing overlaps the code. Use Q or H when the code may get dirty, damaged, or has a logo placed in the centre — H can recover about 30% of the code. Higher correction means more modules for the same data, so the code becomes denser or physically larger.
Can a QR code contain a WiFi password?
Yes. A WiFi payload uses the format WIFI:T:WPA;S:MyNetwork;P:MyPassword;; — most phone cameras recognise it and offer to join the network. Note the password is stored in plain text inside the code, so anyone who scans (or photographs) the code can read it. Treat a printed WiFi QR like a written-down password.
Is the QR code generated privately in my browser?
Yes. The CodingSetu QR and barcode tools build the code entirely in your browser using client-side JavaScript. Your URL, WiFi password, contact details or any other payload never leave your device and are not uploaded to a server.
What's the difference between a QR code and a barcode?
A traditional barcode (like EAN-13 or Code 128) is 1D — it encodes data in the widths of vertical bars and is read across one line. A QR code is 2D — it stores data in a square grid of modules read in both directions, so it holds far more data in a smaller area and survives partial damage thanks to built-in error correction.