# How many unique QR codes are possible? May 14, 2017 2:23 AM   Subscribe

So this question was discussed and researched at length over breakfast. However no answer was found on the internet. We also lack the fundamental math skills to calculate it ourselves. How many ways can all the little squares be combined to make a QR code?
posted by starfishprime to Computers & Internet (3 answers total) 2 users marked this as a favorite

QR codes come in a fixed number of different sizes, which are called "versions," and which have different numbers of dots ("modules"). Here is some information from the inventor, Denso Wave, about sizes.

The largest size is 177x177, but you can't just multiply those to get the number (31,329) of data bits, because the QR standard defines several levels of error correction ("L", "M", "Q", "H") so that you can scan codes that are damaged or blurry. (In addition, some of the dots in a code are required to be on or off, to form the squares that a scanner uses to figure out which side is up, etc.)

At the lowest level of error correction, the 177x177 QR code can store 23,648 bits. At the highest level, it can only store 10,208 bits, but you could read the code even if it was pretty beat up.

At the medium levels, the largest QR code can store about 15,000 bits, which (according to Wolfram Alpha) can be arranged in 2.817960879631397637428637785383222308241674912977296×104515 different ways.

So the answer is "A lot. A lot of different ways."
posted by spacewrench at 2:54 AM on May 14, 2017 [25 favorites]

That's an excellent answer from spacewrench. "About 15,000 bits". For detailed answers see Information Capacity and Versions of the QR Code. The Wikipedia article is useful too. A more practical application for easy scanning may be something like Version 3M, which gives about 350 bits of storage.

For context; 128 bits is generally enough to create unique IDs for some domain (like businesses, or people, or packages being shipped) There are roughly 2266 atoms in the universe. So 2350 goes a long way for identifiers. At the biggest scale you can start putting actual information in there, like roughly 1000 characters of text.

Just for fun; QR Codes are forgiving enough that you can decorate them in various ways and still have something that works.
posted by Nelson at 3:06 AM on May 14, 2017 [1 favorite]

Here's another way of thinking about it: 15,000 bits is (roughly) 2kB. That's enough to store about 2,000 characters of text (assuming you're not using any accented or non-Latin characters). Average word length in modern English is about 5 letters (source). Including a character for a space in between words, that's 2,000/(5+1) ≈ 350 words.

There are enough possible QR codes that there's one for every possible thing you could say in 350 words, and then one for all the combinations of letters that aren't words, and then one for all the combinations of bits that don't make sense as letters.

There's a lot of possible QR codes.
posted by spielzebub at 3:18 AM on May 14, 2017 [2 favorites]

« Older Is this single bed bug?? What now?   |   Earn ALL the merit badges! Newer »