← All blog posts

QR Code Generator for students — with examples

WhiteUI · A plain-English guide to the QR Code Generator

A QR code is a good way to learn how computers store information, because you can see the storage: a square grid of black and white modules, each one holding a piece of your text. The QR Code Generator turns a link or a message into that grid in front of you, and the line underneath it tells you the version, the grid size and the character count, so you can check the maths yourself.

At a glance

Student example: 25 modules on a 0 to 177 scale0 modules89 modules177 modulesVersion 2 is 25 by 25; version 40 is 177 by 177
The default code is version 2, a 25 by 25 grid, near the start of a scale that runs to 177 modules at version 40.

Example 1: count the characters

Start with the tool’s default text, “https://whiteui.com”, and count its characters: h-t-t-p-s-:-/-/-w-h-i-t-e-u-i-.-c-o-m is 19 characters, and the tool agrees, printing “19 characters” in the line under the code. Counting characters is the first step in understanding a QR code, because the code must hold every character, and a longer text needs a bigger grid. Try adding “/contact” to the end, which makes “https://whiteui.com/contact”, 27 characters long, and watch the version line change as the tool fits eight more characters into the grid.

Example 2: work out the grid size

The grid size follows a simple rule: modules = 4 × version + 17. For the default code, the tool reports version 2, so the grid is 4 × 2 + 17 = 25 modules wide, and 25 × 25 = 625 modules in all. Version 1 would be 4 × 1 + 17 = 21 modules wide, or 441 in all, and the largest version, version 40, is 4 × 40 + 17 = 177 modules wide, or 31,329 in all. Work those three out on paper, then check them against the tool: the version line prints the module count for you, so you can confirm your arithmetic in seconds.

Example 3: work out the picture size

The downloaded picture size follows another simple rule: cell = size ÷ modules, rounded down, and canvas = modules × cell. For the default code at 256 px, the cell is 256 ÷ 25 = 10 px, and the canvas is 25 × 10 = 250 px across. At 512 px the cell is 512 ÷ 25 = 20 px and the canvas is 500 px, and at 1,024 px the cell is 1,024 ÷ 25 = 40 px and the canvas is 1,000 px. Try each size on the tool and read the canvas size from the downloaded file, or work it out first and use the tool to check your answer.

What error correction teaches you

Error correction is spare data: extra copies of your text woven into the grid, so the code still reads when part of it is covered or damaged. The four levels are L, about 7 percent, M, about 15 percent, Q, about 25 percent and H, about 30 percent, and M is the default. Cover a corner of a printed code with your thumb and try to scan it: at M it will often still read, because about 15 percent of the modules can be lost. That is the same idea as a backup copy, and it is why a code with higher correction needs a bigger grid for the same text.

A classroom activity

Make a code for a short message, such as “Hello, this is Satish. My portfolio is at https://whiteui.com”, which is 61 characters long, at 256 px and error correction M. Print it, stick it on a poster, and ask a classmate to scan it and read the message back. Then make the same message at error correction H and compare the two codes: the H code should be denser, because the spare data takes more room. That comparison, done with your own two codes, shows the trade-off between toughness and size better than any diagram.

The common mistake

Students often say a bigger image size means the code holds more text. It does not. The size only changes the cell width, from 10 px to 20 px or 40 px at version 2. What holds more text is a bigger version, which the tool picks for you, or a lower error-correction level, which frees room by storing less spare data. Remember the two rules, modules = 4 × version + 17 and canvas = modules × cell, and the difference stays clear.

Frequently asked questions

How many characters is https://whiteui.com?

19 characters. The tool prints the character count in the line under the code, so you can check your own count against it.

How many modules is a version 2 QR code?

25 by 25, or 625 modules in all, because modules = 4 × version + 17, and 4 × 2 + 17 = 25.

How big is the picture at 256 px for the default code?

The canvas is 250 px across, because each of the 25 modules is 10 px wide. At 512 px it is 500 px, and at 1,024 px it is 1,000 px.

What does error correction M mean?

M recovers about 15 percent of damaged modules. L is about 7 percent, Q about 25 percent and H about 30 percent.

More guides on the QR Code Generator

Try it yourself

Try the QR Code Generator — free, in your browser.

Open the QR Code Generator