Blog
How Many QR Codes Are Possible?
On this page
QR codes are not infinite, but you will never run out of them. The largest QR code, Version 40, holds up to 2,953 bytes: room for about 3.4 × 107,111 different messages, a number 7,112 digits long.
We worked out the figures for all 40 versions and all 4 error correction levels from the QR code standard. We checked every one against the table Denso Wave publishes. Then we filled real codes to their limit to see whether readers can still read them. The numbers come first, then why 1 message can become many different codes.
The numbers: capacity and count by version
A QR code comes in 40 sizes, called versions. Version 1 is a grid of 21 × 21 modules, the small squares a reader looks for. Each version adds 4 modules per side, up to 177 × 177 at Version 40. The error correction level, L, M, Q or H, sets how much of the grid holds repair data instead of your message. Denso Wave, the company behind the QR code, says the 4 levels can restore about 7%, 15%, 25% and 30% of a code.
How we worked it out: we took the error correction block table from the QR code standard, ISO/IEC 18004, as the Python qrcode library (version 8.2) carries it. We added the standard’s rules for storing digits, letters, bytes and kanji. That gives the capacity of all 160 pairs of version and level. Every figure matched Denso Wave’s capacity table: 800 of 800, the data bits and 4 character limits for each of the 160 pairs. As a second check, the library’s encoder accepted each byte capacity and refused 1 byte more, in all 160 cases.
| Bytes at level L / level H | Different messages at level L | |
|---|---|---|
| Version 1, 21 × 21 | 17 / 7 | 8.7 × 1040 |
| Version 10, 57 × 57 | 271 / 119 | 4.3 × 10652 |
| Version 20, 97 × 97 | 858 / 382 | 1.9 × 102,066 |
| Version 30, 137 × 137 | 1,732 / 742 | 1.2 × 104,171 |
| Version 40, 177 × 177 | 2,953 / 1,273 | 3.4 × 107,111 |
How the last column is counted: a byte has 256 possible values. So a 1 byte message has 256 possibilities, a 2 byte message 256 × 256, and a k byte message 256k. Adding every length from 1 byte up to the limit gives the column. At level H, Version 40 holds 1,273 bytes, under half of level L, because the repair data takes the rest.
2 other counts land on the same scale:
- Digits only: Version 40 at level L holds up to 7,089 digits, room for about 1.1 × 107,089 different numbers.
- Every data bit: the same code carries 23,648 data bits, so no count of messages can go above 223,648, about 5.7 × 107,118.
So the number of different messages a QR code can carry sits between about 3.4 × 107,111 and 5.7 × 107,118. The number of different codes you could see is larger again, because 1 message can be drawn many ways.
The test: do the largest codes still scan?
We filled codes to their byte limit with random letters and digits, then read them back. We made them with the Python qrcode library at Versions 1, 5, 10, 20, 30 and 40, at levels L and H. Each had a quiet zone 4 modules wide. 2 readers read every file:
- Apple Vision: the barcode detector in Apple’s Vision framework (VNDetectBarcodesRequest, revision 4), run on a Mac with macOS 27. Apple ships the same framework on iPhone, but these tests ran on a Mac, not on a phone’s camera.
- OpenCV: the QR code detector in OpenCV 4.14, a widely used open source computer vision library.
Each code was read as a clean file at 4 pixels per module. Then we scaled it in steps from 8 pixels per module down to 1, plain and with a slight blur, to find the smallest image each reader still read. A pass means the reader returned the whole message, every character.
| Apple Vision | OpenCV, sizes that read | |
|---|---|---|
| Version 1, level L: 17 bytes, 29 × 29 with quiet zone | Every step from 2 px per module (58 px wide) | 2, 3, 4, 5, 6 and 8 px per module |
| Version 10, level L: 271 bytes, 65 × 65 with quiet zone | Every step from 2 px per module (130 px) | 3, 4 and 5 px per module |
| Version 20, level L: 858 bytes, 105 × 105 with quiet zone | Every step from 2 px per module (210 px) | 4, 5 and 8 px per module |
| Version 30, level L: 1,732 bytes, 145 × 145 with quiet zone | Every step from 2 px per module (290 px) | The clean file only |
| Version 40, level L: 2,953 bytes, 185 × 185 with quiet zone | Every step from 2 px per module (370 px) | 8 px per module only (1,480 px) |
What the results say, in short:
- The largest codes are real. Apple Vision read every full code, up to 2,953 bytes in Version 40. It read every step from 2 pixels per module up, plain and blurred. The codes at level H gave the same result.
- 2 pixels per module needs a sharp image. We also read 10 harder copies of each code: 2 pixels per module, a 1 pixel blur and random noise. Neither reader read any of them, for any of the 12 codes. Treat 2 pixels per module as the floor for a sharp image.
- More data needs a bigger image. At 2 pixels per module, a full Version 40 code is 370 pixels wide and a Version 1 code is 58: about 6 times the width.
- Weaker readers fall behind first. OpenCV skipped some sizes at Versions 10 and 20. It read the full Version 30 code only as the clean file, and Version 40 only at 8 pixels per module. The people who scan your code use many different apps.
That is the real limit on how many QR codes are useful. The space of possible codes is enormous. But every byte you add makes the grid finer, and a finer grid needs a bigger print and a better reader. A short link keeps the grid small: the minimum QR code size guide shows how much the length of the link alone changes the smallest print that scans.
Why 1 message can be many different codes
The count above is of messages. The count of codes you can see is higher, for 3 reasons:
- 8 masks. Before a code is drawn, the encoder lays 1 of 8 mask patterns over it. The mask flips modules so the code avoids large blocks and stripes a reader could misjudge. The reader removes the mask again, so all 8 decode to the same message.
- Error correction level. The same message at L, M, Q or H carries different repair data, so each level gives a different code.
- Version. A short message fits every version large enough to hold it, from small grids to large ones.
We drew https://qrplify.com with each of the 8 masks at level M. All 8 module patterns were different, and each one read as the link on both readers.
4 of the 8 test codes above: different patterns, the same link. Each one opens qrplify.com.
Put the 3 reasons together and 1 link becomes many codes. The 19 characters of https://qrplify.com fit 155 of the 160 version and level pairs, and each pair has 8 masks: 1,240 different codes for 1 link.
Will we ever run out of QR codes?
No, for 2 reasons:
- The space is too large to use up. Even the smallest code, Version 1 at level L, has room for about 8.7 × 1040 different messages, and every larger version adds more.
- Nothing is handed out. A QR code is not issued or registered anywhere, so making one uses nothing up. Anyone can encode any message, and 2 people who encode the same link with the same settings get the same code.
What can run out is the page behind a code. A static QR code keeps its link for good, so it stops being useful when that page moves or goes offline. A dynamic QR code holds a short redirect link instead, so you can change where it points after you print it. On QRplify, a free account includes unlimited dynamic codes. Do QR codes expire? covers how long each kind keeps working, and the bulk QR code generator guide covers making hundreds of codes at once.
Other QR code formats
Denso Wave makes several related codes, each with its own limits:
- Micro QR Code: up to 17 × 17 modules at its largest size, M4, holding up to 35 digits. It needs a margin of 2 modules, where a QR code needs 4.
- rMQR Code: a rectangular code for narrow spaces where a square code will not fit.
- SQRC: a QR code with a reading restriction, for private or internal data.
A QR code can also split 1 message across up to 16 codes and read it back as 1, a feature called Structured Append.
FAQ: how many QR codes are possible
Are there infinite QR codes?
No. A QR code has a fixed number of modules, so the number of codes is finite. The largest code carries at most 23,648 data bits, which caps the number of messages at 223,648, about 5.7 × 107,118. Finite, but far too many to run out of.
What is the largest QR code?
Version 40: 177 × 177 modules, 31,329 in all. At level L it holds up to 7,089 digits, 4,296 alphanumeric characters, 2,953 bytes or 1,817 kanji. In our test, Apple Vision read a sharp full Version 40 code from an image 370 pixels wide; OpenCV needed 1,480.
What is the oldest QR code?
The QR code dates from 1994, when Denso Wave announced it. Masahiro Hara was one of its original developers, and QR stands for quick response: the code was designed to be read at high speed. The original design, Model 1, went up to Version 14, 73 × 73 modules. Model 2 raised the limit to Version 40, and it is the code people mean by a QR code today.
How can you tell a fake QR code?
Not from the pattern: a code that leads to a scam page looks like any other. Check the link before you open it. Your phone shows the link before it opens anything. The free QR code decoder reads a code image in your browser and shows the full text without opening it. On posters, menus and parking meters, look for a sticker stuck over the original code. How to scan a QR code safely lists what to check, and can scanning a QR code infect your phone covers the risks.