QR Code Generator
Turn a link, a piece of text, Wi-Fi login details, an e-mail message or a phone number into a QR code. Choose the error correction level, size and colors, then download the code as PNG or SVG or print it. The code is built in your browser by the page's own encoder.
1. What should the code contain?
Live preview of your code.
2. Your QR code
Advanced: version, mask and printing
Encoding details
Penalty scores of the eight masks
A data module is flipped where the condition is true; r = row and c = column, both counted from 0 at the top left, div = whole-number division. The lowest penalty wins.
| Mask | Flips modules where | Penalty |
|---|
How to use the QR code generator
- Choose what the code should contain: a URL, plain text, Wi-Fi login details, an e-mail message or a phone number.
- Fill in the fields. The code redraws as you type; "Text stored in the code" shows exactly what a scanner will read.
- Pick an error correction level: M suits most uses, Q or H codes that may get damaged.
- Set the image size, the quiet zone (the empty margin) and the colors. Keep a dark code on a light background.
- Download a PNG for documents and slides or an SVG for printing and design programs, copy the image, or print a page with only the code.
- Scan the result with a phone before you share or print it.
How it works
A QR code is a square grid of dark and light modules. Its size is set by the
version v from 1 to 40:
width in modules = 4 × v + 17
so version 1 is 21 × 21 modules and version 40 is 177 × 177. The page builds the code in seven steps described in the QR code standard, ISO/IEC 18004:
- Segments. The text is split into segments in one of three modes:
numeric (digits only, three digits in 10 bits), alphanumeric (digits, capital letters,
space and
$ % * + - . / :, two characters in 11 bits) and byte (any text as UTF-8, 8 bits per byte). The page searches for the split with the fewest bits, so a long run of digits inside a sentence gets its own numeric segment. - Bit stream. Every segment starts with a 4-bit mode indicator and a character count of 8 to 16 bits. A terminator of up to four zero bits, zeros up to a whole byte and the pad bytes 236 and 17 fill the rest of the space.
- Error correction. The data bytes (codewords) are split into blocks.
Each block gets
nReed–Solomon codewords: the remainder of the data polynomial timesxndivided byg(x) = (x − α0)(x − α1)…(x − αn−1), computed in the finite field GF(256) built onx8 + x4 + x3 + x2 + 1withα = 2. - Interleaving. The blocks are mixed byte by byte, so a damaged patch hurts several blocks a little, not one block a lot.
- Placement. The three finder squares, timing lines, alignment patterns and one always-dark module go in first. The codewords fill the rest in two-module columns that zigzag from the bottom right corner.
- Masking. One of eight mask patterns flips data modules to break up shapes that confuse scanners. The page tries all eight and scores each with the standard's four penalty rules: 3 + (k − 5) points for every run of k ≥ 5 same-colored modules in a row or column, 3 points for every 2 × 2 block of one color, 40 points for each finder-like 1:1:3:1:1 pattern with four light modules beside it, and 10 points for every full 5% that the share of dark modules differs from 50%. The lowest total wins.
- Format and version information. Five bits (the error correction level and the mask number) get 10 BCH check bits, are XORed with 101010000010010 and are written twice next to the finders. From version 7 on, 6 version bits with 12 check bits are added in two more places.
Examples
Example 1: one link, four levels. https://cleverquestlab.com
has 26 characters. Lowercase letters are not in the alphanumeric set, so it is one byte
segment of 4 + 8 + 26 × 8 = 220 bits. Version 2 at level M holds 28 data codewords
(224 bits), so levels L and M give a 25 × 25 code. Level Q needs version 3
(29 × 29) and level H version 4 (33 × 33).
Example 2: digits are cheap. The 20 digits
12345678901234567890 take 4 + 10 + 6 × 10 + 7 = 81 bits in numeric mode
and fit version 1 (21 × 21) at level M, which holds 128 bits. As bytes they would need
4 + 8 + 160 = 172 bits and version 2.
Example 3: Wi-Fi with special characters. Network Cafe;Guest,
password p@ss:word, WPA. The semicolon and the colon get a backslash:
WIFI:T:WPA;S:Cafe\;Guest;P:p@ss\:word;H:false;;. The page stores the first ten
characters in alphanumeric mode and the other 37 as bytes, 376 bits in total (one byte
segment would take 388). At level M that is version 4.
Example 4: exact image size. Example 1 at level M with a 4-module quiet zone is 25 + 8 = 33 modules wide. For a 512-pixel PNG each module gets ⌊512 / 33⌋ = 15 pixels, the code covers 495 pixels, and the remaining 17 pixels widen the quiet zone (8 on the top and left, 9 on the bottom and right).
Choosing error correction, size and colors
| Level | Restores about | Good for |
|---|---|---|
| L | 7% | codes shown on screens, the smallest code for long content |
| M | 15% | most printed material: handouts, flyers, labels |
| Q | 25% | posters, outdoor signs, surfaces that get handled |
| H | 30% | codes that may be damaged or partly covered |
Higher levels make the code denser. A common rule of thumb is that the code should be at least a tenth of the scanning distance wide: about 2 cm for a code scanned from 20 cm away, 30 cm for a poster scanned from 3 m. For printing, SVG stays sharp at any size. Keep the quiet zone at 4 modules, as the standard asks; a narrower margin can fail next to text or a dark frame. Colors work if the code is clearly darker than the background. The page warns below a contrast ratio of 4:1 and for light-on-dark codes, which some scanners cannot read. The site's dark mode never changes the code: downloads and print use the colors you chose, black on white by default.
Frequently asked questions
Do these QR codes expire?
No. The content is stored in the pattern itself, so the code works as long as its content does. No redirect service sits in between, and nothing tracks scans.
How much can one QR code hold?
Version 40 at level L holds 7,089 digits, 4,296 alphanumeric characters or 2,953 bytes. At level H it is 3,057 digits, 1,852 alphanumeric characters or 1,273 bytes. Accented Latin letters, Greek and Cyrillic take 2 bytes each in UTF-8, Chinese, Japanese and Korean characters 3, and emoji 4.
Why does my phone not join the Wi-Fi network?
Check that the network name and password match exactly, including capital letters and spaces, and that the security type is right. WPA covers WPA and WPA2 personal networks and WPA3 networks that also accept WPA2; a network set to WPA3 only may have to be joined by hand on some phones. Tick "Hidden network" only if the network is not in the list of networks.
Which format should I download, PNG or SVG?
PNG is a pixel image that every program accepts. SVG is a vector image that print shops and design programs scale to any size without blur.
Is anything I type uploaded?
No. The page builds the code with its own encoder in your browser and sends nothing to a server. Your entries and settings are saved only in this browser's local storage, except the Wi-Fi password, which is never saved.
Related tools
- Color Contrast Checker — test whether two colors before you print a colored code.
- Random Name Picker — pick students or teams at random.
- Random Group Generator — split a class list into random groups.
- List Randomizer — shuffle any list into a random order.
- Word Counter — count words and characters in a text.