QR code generator

A QR code is a square grid with three large blocks in its corners, which is how a camera finds the symbol and works out which way up it is. The interesting part is not the picture but the string inside it: a scanner hands whatever you encoded straight to the phone, so a bare domain shows up as text you have to copy, the same domain with a scheme in front opens a browser, and a handful of other prefixes turn the identical-looking square into a dialled number, an email draft or a Wi-Fi login.

Appearance
Size
Colours

264 × 264 px in the PNG

Size units

Specification

Character set
any data
Length
from 1 to 2953 characters
Check digit
not used by this symbology

Where it is used

  • Guest Wi-Fi printed on a card, using the string WIFI:T:WPA;S:network-name;P:password;; so nobody has to read a password out loud
  • Equipment and asset labels pointing at a maintenance record, so the sticker stays correct even after the document behind it is rewritten
  • Contact details on printed material as a BEGIN:VCARD block, which the phone offers to save instead of making the reader retype a phone number

How it compares

Data Matrix is the closest relative and the only real alternative. QR wins wherever a phone is involved: the three corner blocks are what let a camera lock on quickly at an awkward angle, and consumer scanning software treats QR as the format it exists to read. QR also holds more — at the largest version, 177 by 177 modules, and the lowest error-correction level, up to 7089 digits, 4296 characters of its uppercase-only alphanumeric set, or 2953 bytes — and it lets you choose the error-correction level, from L recovering about 7% of the symbol up to H recovering about 30%, which is what makes a logo in the middle survivable. Data Matrix wins on footprint: one module of quiet zone against QR's four, and a border instead of three corner blocks, so where the payload is short and the window is tight it is the smaller symbol by a clear margin. Phones scan QR, machines scan Data Matrix, and an argument about which is better is an argument about which of those two is happening.

Common mistakes

  • Dropping a logo into the middle without raising the error-correction level. Level H tolerates roughly 30% loss, but that budget is written for damage scattered across the symbol; a solid block in the centre spends it far faster than the percentage suggests, and the code passes on your desk and fails in someone else's hand.
  • Letting the layout close in on the code. QR wants four modules of quiet zone on every side — a wide margin by barcode standards, which is exactly why it reads as spare air to whoever is tightening the page. The corner blocks tell a camera where the symbol is; that margin is what tells it where the symbol ends.
  • Encoding the whole tracking URL and then printing small. Every extra character can push the symbol up a version, each version adds four modules per side, and at a fixed size on the page more modules means every one of them is physically smaller. Shorten the link before encoding it, not after the print run.
  • Inverting the colours. Light modules on a dark ground reads perfectly well to a person, and to a decoder that has not been told to attempt reflectance reversal there is no symbol on the page at all. Whether the reader on the other end has been told is not something you get to find out. Keep dark modules on light.

Frequently asked questions

What exactly should I type into the field?
Whatever you want the scanner to hand to the phone, in the form the phone recognises. A web address needs its https:// prefix or it is treated as plain text. tel:+15551234567 offers to dial, mailto:name@example.com opens a draft, SMSTO:+15551234567:message prepares a text, and a BEGIN:VCARD block offers to save a contact.
Which error-correction level should I pick?
L recovers about 7% of the symbol, M about 15%, Q about 25% and H about 30%. M is the sensible default for anything printed on clean paper. Move up to Q or H only when the code will be scuffed, curved around a bottle or partly covered — the higher levels spend modules on redundancy, so the symbol gets denser at the same physical size.
Does a QR code expire?
The symbol never does — the modules encode a fixed string and will decode to the same thing in ten years. What expires is whatever that string points at. If the URL inside stops resolving, every copy you printed is dead, which is the argument for encoding an address on a domain you control rather than a redirect service you rent.
Why does writing the URL in capitals make the code smaller?
QR has a compact alphanumeric mode of exactly 45 characters — ten digits, capital A to Z, space and the eight marks $ % * + - . / : — and it spends about 5.5 bits on each of them; anything outside that set forces byte mode at 8 bits. The scheme and host of a URL are case-insensitive, so HTTPS://EXAMPLE.COM encodes in the compact mode and yields a smaller symbol than the same address in lowercase.