CIRCULATEQR

QR code glossary · Anatomy of a QR code

Alignment pattern

Definition

An alignment pattern is a small 5 × 5 module square, a dark ring around a light ring around a single dark module, placed at regular intervals inside QR codes of version 2 and above so a scanner can correct for tilt, perspective and curved surfaces.

How it works

The three finder patterns give a scanner three corners of the code. When the camera views the code at an angle, or the code is printed on a curved bottle or a wrinkled flyer, the fourth corner and the grid between them are distorted, and estimating them from three points alone is not accurate enough for a large code. Alignment patterns give the decoder extra measured reference points inside the grid, so it can map each module’s position correctly.

  • Alignment patterns
A version 7 code has six alignment patterns. In versions 7 to 13 one of them sits exactly in the middle of the code.

Version 1 has none. Their number grows with the version, at positions listed in the standard, leaving out the three places where one would overlap a finder pattern:

Alignment patterns per version (ISO/IEC 18004)
VersionsAlignment patterns
10
2 to 61
7 to 136
14 to 2013
21 to 2722
28 to 3433
35 to 4046

Why it matters

Alignment patterns are why larger QR codes remain readable on packaging, curved surfaces and photos taken at an angle. Like the finder patterns, they are fixed structures rather than data, so damage to them is not something error correction is designed to repair.

This matters most for logos. In versions 7 to 13 an alignment pattern sits exactly where a centered logo goes. Decoders can often fall back on estimating the grid without it, but the code loses a reference point, which is one more reason to keep logos small and to test codes printed on curved or flexible materials at the real scanning angle.

Example

In a version 2 code (25 × 25), the single alignment pattern is centered on row 18, column 18, counting from 0 at the top left, so its center is 6 modules in from the bottom and right edges, near the corner that has no finder pattern. In version 7 (45 × 45) the centers lie on rows and columns 6, 22 and 38: nine combinations, minus the three that would land on finder patterns, gives the six patterns in the diagram above.

Learn more

Sources

Last updated . Written by the CirculateQR team; technical facts follow the sources listed above. Example codes and sizes are computed with the open-source qrcode encoder that CirculateQR uses. Spotted something wrong? Email support@circulateqr.com. QR Code is a registered trademark of DENSO WAVE INCORPORATED.

← Browse the full glossary