Glossary
Alignment pattern
Alignment patterns are the small 5 × 5 concentric squares scattered through larger QR codes. They let a scanner correct for perspective distortion when the code is curved, tilted or photographed at an angle.
When they appear
Version 1 has none. Version 2 adds one. The count grows with version, reaching 46 at version 40. Their positions are defined by a table in ISO/IEC 18004, not by a formula — which is why a from-scratch encoder needs the table.
| Version | Alignment patterns |
|---|---|
| 1 | 0 |
| 2–6 | 1 |
| 7–13 | 6 |
| 14–20 | 13 |
| 21–27 | 22 |
| 28–34 | 33 |
| 35–40 | 46 |
Why they exist
Without them, a scanner has only the three corners to establish geometry, and any non-linear distortion — a code on a bottle, a photograph taken at 40° — accumulates error toward the middle of the pattern. Alignment patterns give the decoder local reference points to resample against.
This is the practical reason a large code on a curved surface still scans while a small one on the same curve does not: the large one has alignment patterns to correct with.
Related
- Finder pattern — The three large concentric squares in the corners of a QR code are finder patterns. A scanner locates them first to work out where the code is, how big it…
- Timing pattern — The timing patterns are the alternating black-and-white lines running between the finder patterns, one horizontal and one vertical. They tell the decoder…
- Version — A QR code's version is its size: version 1 is 21 × 21 modules and each step adds 4 modules per side, up to version 40 at 177 × 177. The encoder picks the…