Glossary Term

QR Code Module

glossary qr code module featured

A QR code module is a single square cell in a QR code’s grid, either dark or light. Each module holds one bit of data or serves a fixed structural role, such as marking a corner. A code contains between 441 modules (Version 1, 21 x 21) and 31,329 modules (Version 40, 177 x 177).

Why QR Code Modules Matter

Modules decide whether a code scans. The scanner reads the grid module by module, so every module must be clearly visible to the camera. Too few pixels per module, a stretched image or a damaged corner all cause failed scans.

The ISO/IEC 18004 standard defines everything else in modules. The quiet zone is 4 modules on each side. Version numbers are module counts. Error correction consumes modules. A QR module is the key to most sizing advice.

QR Code Module vs Pixel

A module is a data cell with no fixed size. A pixel is a screen unit. The two connect through one ratio: pixels per module.

TermMeaningFixed size?
ModuleOne dark or light cell in the QR gridNo
PixelOne dot in a screen or image fileYes, per display
Pixels per moduleHow many screen pixels draw one moduleSet by the designer

A code drawn at 4 pixels per module renders each cell as a 4 x 4 block of pixels.

How Many Modules Does a QR Code Have?

A QR code has 17 + (4 x version number) modules per side. Version 1 is 21 x 21. Each higher version adds 4 modules per side, up to Version 40 at 177 x 177. The generator picks the version from the data length and the error correction level.

VersionModules per sideTotal modules
121 x 21441
329 x 29841
1057 x 573,249
25117 x 11713,689
40177 x 17731,329

A short link fits Version 2 or 3. A long URL with tracking tags can need Version 8 or higher, which means more and smaller modules at the same printed width.

QR Code Pattern: Types of Modules

A QR code pattern contains five kinds of modules. Four are function patterns that help the scanner. One carries the data.

Module typeJobVersion 3 count
Finder patternsLocate the code and its orientation. Three 7 x 7 squares, each with a 1-module light border192
Alignment patternCorrects warping. One 5 x 5 square in Version 3 (appears from Version 2)25
Timing patternsAlternating dark and light row and column that set grid spacing26
Format informationStores the error correction level and mask, as 15 bits written twice30
Dark moduleOne fixed dark cell1
Data and error correctionThe encoded content and the repair data567

The function patterns use 274 of the 841 modules in Version 3. The data area of 567 modules equals 70 codewords of 8 bits plus 7 remainder bits.

Denso Wave, the company that invented the QR code, built the finder pattern around a 1:1:3:1:1 dark-to-light ratio. That ratio rarely appears by accident in printed material, so scanners can detect it quickly at any angle.

A mask pattern is applied to the data modules. The encoder tries eight masks, scores each for large blocks and false finder look-alikes, and keeps the best one. This is why a QR code looks like random static.

How Many Pixels Per Module Does a QR Code Need?

A QR code needs at least 3 pixels per module in testing, and 4 or more is the safer design target. In a decode test of a Version 3 code (40 trials per setting, simulated camera capture, zxing-cpp 3.1.1 and OpenCV 5.0.0), results were:

Pixels per modulezxing-cppOpenCV
1 and 1.50 of 400 of 40
238 of 400 of 40
2.540 of 400 of 40
3 and above40 of 4040 of 40

The two readers disagree at 2 and 2.5 pixels, so a code that works on one phone may fail on another. Export at whole pixels per module. A 1.5x scale makes some modules 1 pixel wide and others 2, which blurs edges. Phones use their own decoders, so treat these figures as directional.

Which Modules Can a QR Code Lose?

The finder patterns cannot be lost. In the same test, blanking one finder pattern gave 0 of 40 on both readers. Blanking the 25-module alignment pattern still decoded 40 of 40. Blanking the timing patterns or both copies of the format information decoded on zxing-cpp but failed on OpenCV, so a scanner may or may not recover them.

Error correction repairs data modules. It handles one solid patch far better than scattered errors:

  • Scattered flips: levels L, M, Q and H held up to about 1%, 2%, 2% and 3% of data modules flipped.
  • One solid patch: level H decoded a patch covering 21.3% of the data area. Level L failed at 8.6%.

Blanking a patch sets modules to light, so only the dark ones inside it are actually wrong. Real damage may differ.

Frequently Asked Questions

What is a module in a QR code?

A module is one square cell of the QR code grid, either dark or light. A whole code is a grid of these cells. Modules are a unit of data, not of length, so a module can be drawn with 4 pixels or half a millimetre of ink.

How many modules does a QR code have?

It depends on the version. Modules per side equal 17 plus 4 times the version number. Version 1 has 441 modules in total, Version 3 has 841, and Version 40 has 31,329. Longer data needs a higher version.

Is a QR code module the same as a pixel?

No. A pixel is a screen unit with a fixed size on a given display. A module is a cell of the code with no fixed size. QR code pixels only matter as a ratio: how many pixels draw each module.

What are the three big squares in a QR code called?

They are finder patterns, also called position detection patterns. Each is 7 x 7 modules. They tell a scanner where the code is and how it is rotated. Covering one made the code unreadable on both readers in testing.

Does a bigger QR code have bigger modules?

Only if the version stays the same. Printing the same code larger enlarges every module. A higher version fits more modules into the same width, so each one gets smaller.

To keep the module count low and every module readable, build a short-link QR code with linkutm.