How Many QR Codes are Possible?

QR codes are those big square barcodes that you can scan with your phone camera. Each one is a unique arrangement of either black or white pixels, where the combination is linked to something like a website’s URL or an account number. But how many combinations are there exactly?

Even though there are a lot of squares, they can only be in one of two states, either black or white. With this restriction, binary counting is the perfect method. We can think of a white square as a zero and a black square as a one, where this entire code of 21 by 21 squares is essentially just 21 lines of 21 digits of binary. Therefore, it represents 2 to the power of 441 combinations, which is a huge number.

It’s worth noting that there are limitations here. These big three squares in the corners are needed to help your phone figure out what it’s looking at and where the positions are, so they’re each on every single one of these, and each one of them is a 7×7 square. Without those, we miss out on about 147 potential digits of binary, but we’re still left with 294 digits.

21 by 21 grids like this are the smallest kind, but we also have 25 by 25, 33 by 33, 57 by 57, 117 and even 177 by 177. While the amounts increase, the squares in the corners used for positioning actually don’t, at least not proportionally. So, we have increasing returns on how many things we can represent. For example, the 177 by 177 grid is like having 31 182 digits of binary or a whopping 5.21, well in standard notation, it looks like this – 2 to the power of 31282. This number is 9386 digits long.

But URL codes aren’t done in numbers; they’re done in characters of ASCII. Each character of ASCII requires one byte or eight digits of binary code. While scaling up these codes doesn’t require the squares in the corners to be proportionately scaled, they do require some other unique markers to be scattered throughout to help the camera get a sense of spatial proportion. Factoring all that in, a 177 by 177 QR code is able to represent what is essentially 1264 characters of ASCII or something around that.

To summarize the question in the title of this video, which is how many possible combinations are there, the answer is – it’s a lot.