How to Identify a QR Code's Version from Its Module Count

A QR code's version (1 to 40) corresponds one to one with the number of modules along one side, which means you can determine it by counting. This article covers practical ways to count even a fine-grained symbol, and how to read the version information written into codes from version 7 upward.

The version follows from the module count

A QR code's version runs from 1 to 40 and defines how much data the symbol can hold. The version and the number of modules per side correspond one to one:

modules per side = 4 × version + 17

Which means that if you can count the modules, you can compute the version:

version = (modules per side - 17) ÷ 4

Version 1 is 21x21 and version 40 is 177x177. The module count is always an odd number starting at 21 and increasing in steps of 4 (21, 25, 29, 33, and so on), so a count that does not fit that sequence means either a miscount or that the symbol is not a QR code at all.

Check the version against the module count

Move the slider to pick a version, or type a module count into the field, and the corresponding values are computed on the spot. No network connection is required.

How to count: use the timing pattern

Counting a fine grid one module at a time is not practical. In the field, this sequence is reliable.

  1. Use a finder pattern as a ruler. The large corner squares are always 7 modules across. Measure that width first to establish the size of one module.
  2. Count the timing pattern. Between the top-left and top-right finders runs a line of alternating dark and light modules (the seventh row from the top, row 6 counting from zero). Alternating runs are easy to count, so count that and derive the rest.
  3. Add it up. One side consists of the left finder (7) plus a separator (1) plus the timing section plus a separator (1) plus the right finder (7). So if the alternating section is M modules long, the side is M + 16 modules.

For example, an alternating section of 29 gives a side of 45 modules, and a version of (45 - 17) ÷ 4 = 7.

Alignment patterns give you a quick estimate

If you want to narrow the version down before counting, the number of alignment patterns (the small 5x5 concentric squares) is a good indicator. The count is fixed per version and steps up every seven versions.

VersionModules per sideAlignment patterns
1210
2 to 625 to 411
7 to 1345 to 696
14 to 2073 to 9713
21 to 27101 to 12522
28 to 34129 to 15333
35 to 40157 to 17746

No alignment pattern at all means version 1 for certain; a single one near the centre means version 2 to 6, and so on. The rule behind the counts is that when there are n candidate centre coordinates, patterns go at the n by n intersections minus the three that would collide with finder patterns, giving n² - 3.

Version 7 and above carry version information

From version 7 upward, the version number itself is written into the symbol, in a field called the version information. Versions 6 and below omit it, because counting the timing pattern is enough to tell them apart.

The version information is 18 bits:

Unlike the format information, no XOR mask is applied to the version information. The first six bits are therefore the version number in plain binary. Version 7 begins with 000111 (which is 7) and the full 18 bits are 000111110010010100. Version 40 begins with 101000 (which is 40) and the full string is 101000110001101001.

The version information is also placed twice: once to the left of the top-right finder pattern (6 rows by 3 columns) and once above the bottom-left finder pattern (3 rows by 6 columns). Being BCH-protected, it survives a certain amount of damage.

A useful shortcut: six or more alignment patterns means version 7 or above, which in turn means version information is present. You can check for it visually as an elongated rectangular block beside the top-right and bottom-left finders.

Practical cautions when counting from an image

Free Tool Check the version with QR Code Analyzer Upload an image to analyse its version, error correction level, mask pattern and stored data together.

What the version tells you

Once the version is fixed, so is the upper bound on how much data the symbol can hold. The actual capacity also depends on the error correction level and the encoding mode (numeric, alphanumeric, 8-bit byte, kanji), so read it together with a capacity table. QR Code Specifications and How They Work covers that in detail.

A higher version, meaning a finer grid, also demands more of your printing and camera resolution. If codes are failing to scan, it is worth asking whether the version can be lowered by shortening the data. Cause-by-cause fixes are in Why Your QR Code Won't Scan and How to Fix It.

Summary

Frequently Asked Questions

How do I find out a QR code's version?

Count the modules along one side and compute (module count - 17) divided by 4. The number of modules per side is 4 times the version plus 17, so version 1 is 21x21 and version 40 is 177x177.

Is there a trick to counting the modules of a fine-grained QR code?

Use the timing pattern. Count the run of alternating dark and light modules between the top-left and top-right finder patterns and add 16 to get the number of modules per side. The fact that a finder pattern is always 7 modules across is also useful as a ruler.

Can the number of alignment patterns tell me the version?

It gives you a range. Version 1 has none, versions 2 to 6 have one, 7 to 13 have six, 14 to 20 have thirteen, 21 to 27 have twenty-two, 28 to 34 have thirty-three and 35 to 40 have forty-six. If there are none at all, the version is definitely 1.

What is the version information?

It is an 18-bit field written into QR codes from version 7 upward, made up of six bits of version number and twelve error correction bits of a BCH(18,6) code. Unlike the format information it is not XOR masked, so the first six bits are the version number in plain binary. It appears in two places: to the left of the top-right finder and above the bottom-left finder.

← Back to Tech Blog