The short answer: roughly 10^7118, with a precise upper bound
You wanted a number. Here it is: a QR code at the maximum size (Version 40) with the lowest error correction level (L) holds 23,648 data bits, which means there are exactly 2^23648 possible binary payloads it can encode. That is approximately 5.8 × 10^7118 — a 7,119-digit number.
If the answer you came across elsewhere was "trillions" or "quintillions" or even "more than the grains of sand on Earth," those answers are not wrong so much as embarrassingly undersized. The grains of sand number is around 7.5 × 10^18. The QR payload space at Version 40-L is larger by a factor of roughly 10^7099. There is no real-world quantity that comes close.
The rest of this post explains why that specific exponent, where the 23,648 comes from, and why most people quoting smaller figures are confusing "encoded data bits" with "visible modules on the printed code" — two completely different questions with two completely different answers. We will also show why the question itself is ambiguous, because "unique QR code" can mean three different things depending on what you actually care about. If you want the operational version of this answer for your business — "can I keep generating QR codes forever without collisions?" — the answer is yes, and the math is overwhelming.
Three different questions hiding inside one
"How many unique QR codes are possible" is doing a lot of work as a sentence. Before the math, the question has to be disambiguated, because three different interpretations give wildly different numbers.
Interpretation 1: How many unique visual patterns? A Version 40 code is a 177 × 177 grid of black-or-white modules, which is 31,329 modules total. Counting every possible dark/light assignment gives 2^31329 ≈ 10^9430 possible patterns. The catch: the vast majority of those patterns are not valid QR codes. They lack the three finder patterns in the corners, the alignment patterns, the timing patterns, the format information, or they fail the Reed-Solomon error correction encoding. Counting "every conceivable bitmap" is not what most people mean by "QR code."
Interpretation 2: How many valid encoded payloads? This is the question almost everyone actually means. Given the QR specification — finder patterns in place, format info correct, Reed-Solomon error correction codewords valid — how many distinct payloads can be encoded? This is where the 2^23648 number lives. The data portion at Version 40-L is 23,648 bits; every distinct bit string is a distinct valid payload.
Interpretation 3: How many semantically meaningful codes? Once you restrict to QR codes that encode actually-useful content — URLs that resolve, vCards with valid fields, Wi-Fi configurations with real SSIDs — the number drops further but is still incomprehensibly large. For URLs alone, the IPv6 address space (2^128 ≈ 3.4 × 10^38) plus arbitrary path components already gives more than enough room.
For the rest of this post we use Interpretation 2 as the canonical answer. It matches what mathematicians, engineers, and journalists actually want when they ask the question, and it is the number the ISO/IEC 18004 standard implicitly defines through its capacity tables. Our error correction levels guide covers the Reed-Solomon side in detail — the data-codewords/error-codewords split is the foundation of every number in this post.
Where 23,648 comes from: the ISO/IEC 18004 capacity tables
Every QR code has a version (1 through 40) that fixes its physical size. Version 1 is 21 × 21 modules. Version 40 is 177 × 177 modules. Each version step adds 4 modules per side, which is why the progression is 21, 25, 29, 33, … all the way to 177. Each version also defines four error correction levels — L, M, Q, H — that allocate different fractions of the total codewords to Reed-Solomon redundancy versus actual data.
The capacity at each version and level is fixed by the standard. The numbers below are from the ISO/IEC 18004 capacity tables, mirrored on the Wikipedia QR code storage section. The "data bits" column is what we care about for the combinatorial-space question — that is the count of bits the payload occupies, after error correction codewords are subtracted from the total codeword budget.
| QR version | Modules per side | ECC level | Data bits | Distinct payloads (2^bits) |
|---|---|---|---|---|
| 1 | 21 | L | 152 | ≈ 5.71 × 10^45 |
| 1 | 21 | H | 72 | ≈ 4.72 × 10^21 |
| 5 | 37 | L | 864 | ≈ 1.55 × 10^260 |
| 10 | 57 | L | 2,192 | ≈ 4.06 × 10^659 |
| 20 | 97 | L | 8,672 | ≈ 1.30 × 10^2611 |
| 30 | 137 | L | 17,728 | ≈ 2.43 × 10^5337 |
| 40 | 177 | L | 23,648 | ≈ 5.78 × 10^7118 |
| 40 | 177 | M | 18,672 | ≈ 9.71 × 10^5620 |
| 40 | 177 | Q | 13,328 | ≈ 4.20 × 10^4012 |
| 40 | 177 | H | 10,208 | ≈ 7.79 × 10^3072 |
The math, step by step: Version 1-L
Start small. Version 1 at error correction level L is the simplest QR code the standard defines. The full symbol is 21 × 21 = 441 modules, but most of those modules are taken by the three finder patterns in the corners, the timing patterns, the format information, the version information, and the Reed-Solomon error correction codewords. After all that overhead, the symbol holds exactly 19 data codewords of 8 bits each, for a total of 152 data bits.
152 data bits gives 2^152 distinct possible payloads. To compute that in base 10, use log10(2) ≈ 0.30103:
152 × 0.30103 ≈ 45.76. So 2^152 ≈ 10^45.76 ≈ 5.71 × 10^45.
That is already 5.7 thousand billion billion billion billion billion — and this is the smallest QR code the standard allows. To put 10^45 in perspective: the observable universe is estimated to contain roughly 10^80 atoms, so a Version 1-L QR payload space is "only" 10^35 smaller than the entire universe's atom count. Already absurd, and we have not left the smallest version.
For humans, the standard maps those 152 bits into three encoding modes. Numeric mode packs digits 10/3 bits per character, so Version 1-L holds up to 41 numeric digits — giving 10^41 possible numeric strings (smaller than the binary 2^152 because not every bit combination corresponds to a legal digit sequence). Alphanumeric mode uses a 45-character alphabet at 11 bits per pair, giving up to 25 characters — so 45^25 ≈ 1.20 × 10^41 alphanumeric strings. Byte mode (8-bit per char) holds 17 bytes — 256^17 = 2^136 ≈ 8.7 × 10^40. Pick any encoding mode you like; the payload space is in the 10^40 to 10^45 range. The smallest QR code in existence already has more possible contents than there are atoms in a thousand galaxies.
The math, step by step: Version 40-L
Now the upper bound. Version 40 is the largest QR the standard defines: 177 × 177 = 31,329 modules. After finder/timing/alignment/format/version overhead and Reed-Solomon ECC codewords at level L, the symbol holds 2,956 data codewords of 8 bits each, for 23,648 data bits.
23,648 × log10(2) = 23,648 × 0.30103 ≈ 7118.76. So 2^23648 ≈ 10^7118.76 ≈ 5.78 × 10^7118.
This is the canonical answer. Roughly 10^7118 distinct binary payloads in a single Version 40-L QR code.
If you restrict to specific encoding modes, the count drops slightly but stays in the same neighborhood:
- Numeric mode at Version 40-L holds 7,089 digits → 10^7089 possible numeric strings.
- Alphanumeric mode holds 4,296 characters in a 45-character alphabet (0-9, A-Z, space, $, %, *, +, -, ., /, :) → 45^4296 possible strings. log10(45) ≈ 1.65321, so 4296 × 1.65321 ≈ 7102.2, giving ≈ 1.58 × 10^7102.
- Byte mode holds 2,953 bytes → 256^2953 = 2^23624 ≈ 7.7 × 10^7111 possible byte strings.
- Kanji mode holds 1,817 characters in a Shift-JIS range of 8,192 — 8192^1817 ≈ 10^7106.
Every mode lands within a factor of 10^16 of the binary upper bound, which at this scale is rounding error. The honest one-number answer to "how many distinct QR Version 40-L payloads are possible" is between 10^7102 and 10^7118, depending on which encoding mode you constrain to.
The lower error correction levels give larger payload spaces because more codewords are available for data instead of redundancy. Level H (the highest error correction, used for codes that must survive heavy damage — see our error correction levels guide) drops the Version 40 capacity to 10,208 data bits, giving 2^10208 ≈ 7.79 × 10^3072 payloads. Still absurd. Just less absurd.
How big is 10^7118? The "atoms in the observable universe" comparison
Numbers with thousand-digit exponents do not fit human intuition. Here are some yardsticks.
The observable universe contains roughly 10^80 atoms. A Version 40-L QR payload space (10^7118) divided by 10^80 leaves 10^7038. So the QR space is 10^7038 times larger than the count of atoms in everything we can see, gravitationally or optically, in any direction, out to the cosmic horizon.
The Shannon number — Claude Shannon's estimate for the game-tree complexity of chess — is about 10^120. People cite the Shannon number as the canonical "incomprehensibly large" reference. The Version 40-L QR space is 10^6998 times larger than the Shannon number.
The Bekenstein bound for the observable universe — the upper limit on the information content of any region of space, derived from black-hole thermodynamics — is approximately 10^124 bits, sometimes quoted as 10^120 distinguishable states. The QR space is 10^6994 times larger than that. Which is mathematically true and physically meaningless: a Version 40-L payload space could not be enumerated, even in principle, by any computer that could fit in the universe. The space exists only as a counting argument.
The number of Planck volumes in the observable universe is around 10^185. The QR space exceeds that by 10^6933.
The number of possible different orderings of a 52-card deck is 52! ≈ 8.07 × 10^67. The QR space exceeds that by 10^7050.
The pattern is clear. Pick any "famously large" number short of "Graham's number" or "TREE(3)" and the Version 40-L QR payload space dwarfs it. The only numbers that beat 10^7118 are pure-math constructions whose magnitudes do not correspond to anything physical. For practical purposes the QR space is infinite, even though it has a precise upper bound.
How many QR codes have actually been generated?
The contrast with reality is what makes the question interesting. The total count of QR codes ever generated globally is small enough to fit on a calculator screen. Industry estimates from dynamic-QR vendors, cited in their public investor decks and case studies, put the cumulative global count of QR codes generated since the format's 1994 invention somewhere in the low trillions — order of magnitude 10^12, give or take a factor of 10. Some sources put it lower (10^10 to 10^11) if you only count uniquely-printed codes; some put it higher (10^13) if you count every per-session dynamic redirect as a distinct code.
Even taking the high end of 10^13 generated codes ever, the fraction of the Version 40-L payload space used is 10^13 / 10^7118 = 10^-7105. Which is, in scientific notation, "indistinguishable from zero." If every human being who has ever lived (roughly 10^11) generated one trillion QR codes each, the total would be 10^23, which is still 10^7095 times smaller than the available space.
The practical consequence: at any human-scale generation rate, the QR payload space is functionally inexhaustible. The permanent QR generator guide covers what "permanent" means at the vendor level; at the format level, "we will run out of QR codes" is not a failure mode anyone needs to plan for.
Birthday paradox: why collisions never happen even with naive random generation
The standard mathematical objection to "we will never run out" is the birthday paradox. In a namespace of size N, the expected number of items you need to generate before a 50 percent chance of a single collision is approximately √(N × 2 × ln 2) ≈ 1.177 × √N. For N = 2^122 (the UUID v4 space), √N ≈ 2.3 × 10^18 — which is large but not astronomical; high-throughput systems generating billions of UUIDs per day do, eventually, need to think about it.
Apply the same math to the Version 40-L QR space. N = 2^23648 ≈ 10^7118. √N ≈ 10^3559. So you would need roughly 10^3559 randomly generated QR codes before a 50 percent chance of a single collision. For context, the age of the universe in seconds is roughly 4.3 × 10^17. If you generated a trillion QR codes every nanosecond (10^21 codes per second) starting from the Big Bang and continuing until the heat death of the universe (perhaps 10^100 seconds), you would generate 10^121 codes total. That is 10^3438 times smaller than the collision threshold.
The practical version: birthday-paradox collisions are not a concern. Not "they happen rarely." Not "we engineer around them." They are physically impossible at any rate of generation that any combination of matter and energy in the observable universe could sustain. The format wins this argument so hard that it stops being interesting.
The one place where collisions DO matter is at the redirect-shortcode level for dynamic QR vendors. EZQR's dynamic QR redirect codes use 6 to 8 character base-62 slugs, giving a collision space of 62^6 ≈ 5.7 × 10^10 to 62^8 ≈ 2.2 × 10^14. That is a finite namespace and the birthday-paradox threshold is √(2.2 × 10^14) ≈ 1.5 × 10^7 codes, which is reachable. But that is a vendor-level engineering choice (we use longer slugs as the user base grows), not a QR-format constraint. The visual QR space underneath the short URL remains unlimited.
What this means for businesses generating QR codes
The math is fun. The practical takeaway is shorter: you can generate a unique QR code for every product SKU, every customer interaction, every marketing campaign, every shipping label, every transaction, every minute of your business existing, forever, and never run out.
For URL-encoded QR codes, the destination URL is what is encoded — meaning every distinct URL gives a distinct QR. URL space is itself functionally unlimited (the IPv6 address space alone is 2^128 ≈ 3.4 × 10^38 addresses, before counting paths and query strings). For multi-URL routing QRs, where one code routes to different destinations based on language, device, or location, the QR encodes a routing rule rather than a single URL, but the underlying payload space is the same.
The operational constraints on "how many codes can I generate" are not at the QR format level. They are:
- Vendor-level redirect shortcode collisions. Discussed above; EZQR uses 6-8 character slugs at base-62, which gives 10^11 to 10^14 possible slugs. Far more than any one business will ever need.
- Print-area constraints. Higher QR versions need more print area at the same module density. A Version 40 code at 1 mm per module is 177 mm (about 7 inches) per side; most printed assets cannot accommodate that. Practical printed codes use Versions 5-15, which still hold 154 to 1,852 numeric digits — enough for any URL, vCard, or payment string.
- Scanner reliability. Higher versions need higher print resolution to scan reliably. The QR best practices guide covers the size and resolution math for printed codes.
None of these are "running out of codes." The format gives you more codes than any imaginable use can consume. The question "will my business ever need to deduplicate or recycle QR codes" has a clean answer: no.
How does this compare to UUIDs, IPv6, and other "infinite" namespaces?
For programmers and system designers used to thinking in terms of "huge namespaces," QR codes are in a different category from the ones you are used to.
[UUID v4](https://en.wikipedia.org/wiki/Universally_unique_identifier). 128 bits total, 6 fixed bits for version/variant, 122 random bits. Space: 2^122 ≈ 5.32 × 10^36. Birthday collision threshold ≈ 2.7 × 10^18. The UUID v4 spec assumes you will never collide at any practical rate, and that assumption holds for almost every system in production.
IPv6. 128-bit address space. 2^128 ≈ 3.40 × 10^38 addresses. Birthday collision threshold ≈ 2.2 × 10^19. Designed to never run out.
SHA-256 output space. 256 bits. 2^256 ≈ 1.16 × 10^77. Birthday collision threshold ≈ 4.0 × 10^38. The basis of modern cryptographic hashing — collisions assumed infeasible.
SHA-512 output space. 512 bits. 2^512 ≈ 1.34 × 10^154.
QR Version 1-L payload space. 152 bits. 2^152 ≈ 5.71 × 10^45. Already larger than UUID v4 (by 10^9), IPv6 (by 10^7), and most "I will never collide" namespaces engineers use day-to-day.
QR Version 40-L payload space. 23,648 bits. 2^23648 ≈ 5.78 × 10^7118. Larger than SHA-256 by 10^7041. Larger than SHA-512 by 10^6964. The closest thing to "infinite namespace" any standardized data format provides.
The practical reason is obvious in retrospect: QR codes are designed to encode arbitrary payloads, not identifiers. A 4-kilobyte payload space is what you need when the "thing you are encoding" might be a full vCard with photo, a Wi-Fi configuration, an encrypted payment string, or a multi-language routing rule. The combinatorial space scales accordingly. Identifiers (UUIDs, IPv6 addresses) live in much smaller spaces because they only need to be unique, not expressive. For a side-by-side with another 2D format, our data matrix vs QR code comparison covers Data Matrix's ~10^5615 maximum payload space — also functionally infinite, but a thousand orders of magnitude smaller than QR Version 40-L.
The honest bottom line
Most posts answering "how many unique QR codes are possible" stop at "billions" or "trillions" because the writer either did not look up the ISO/IEC 18004 capacity tables or did not want to scare the reader with a 7,119-digit number. The honest answer is the 7,119-digit number.
The upper bound: a Version 40-L QR holds 23,648 data bits, giving 2^23648 ≈ 5.78 × 10^7118 distinct payloads. The lower bound at Version 1-L is still 2^152 ≈ 5.71 × 10^45, which already exceeds the UUID v4 and IPv6 address spaces by enormous margins. The observable universe holds 10^80 atoms, the Shannon number for chess is 10^120, the Bekenstein bound for the observable universe is 10^124, and the QR Version 40-L payload space exceeds every one of those by thousands of orders of magnitude.
The operational version of the answer: your business will never run out of QR codes. The visual format space is infinite for practical purposes. The only finite namespace involved is the vendor-level redirect shortcode space for dynamic QRs, which is a per-vendor engineering choice, not a property of the QR format. For the historical context on how the format was designed to accommodate this much data — the 1994 Denso Wave origin story, the four error correction levels, the version progression from 21x21 to 177x177 — see our QR code history post. For the comparison to other code formats, the QR vs barcode breakdown covers linear barcodes' much smaller capacities, and the data matrix comparison covers the other major 2D format.
When you need to actually generate one of these absurdly-numerous possible QR codes, the free generator at EZQR outputs a static or dynamic QR in seconds — picking one specific point from a 10^7118-element space, every time, without complaint.