QR Codes: How Are QR Codes Unique?

Here’s how all QR codes are unique: QR codes don’t have to be unique, and apps that generate them have no idea whether any code is unique or not.

QR codes are simply a different way of writing information, and the only way to have a unique code is to describe unique information with the code.

Many QR codes are repeated, and it’s fine. So if you want to learn all about how QR codes work exactly and how they are unique, then this article is for you. Let’s jump right in!

What Is a QR Code?

female hands using the smart phone to scan the qr code

We’re going to go pretty deep down the rabbit hole today, so I want to start at the surface with a very basic understanding of QR codes. As the name implies, they are codes.

A QR code represents a specific set of information that is easily read by a computer system that understands the QR code language.

To put it in other terms, a QR code is a picture made of dots and spaces that can represent fairly complex information.

In most cases, they are used to represent websites. So, you can scan a QR code, and then your phone can instantly open up the represented website. That website can then hold a ton of information, and in this way, QR codes are really just used for rapid digital communication.

Of course, there’s a lot more going on under the surface, and if you really want to understand how the codes are unique, we’ll have to get into those mechanics.

How Do QR Codes Work?

qr code digital payment at coffee shop

So, let’s take a closer look at how the codes actually work.

You can kind of think of QR codes as their own language.

They’re actually more complicated than that, and I’ll get into why in the next section, but this is a good place to start.

Think about translating something from French to German. You can do it, but you need to understand both languages to make it work. You can more or less substitute the German words for the French words in a sentence, and when you’re done, the new German sentence should have the same meaning.

But, translating from French to Japanese is a different story.

French and German use the same alphabet, so you’re really just rearranging the symbols to say the same thing in another way. If you’re going to translate French to Kanji (the Japanese symbol-based alphabet), then you aren’t using the same symbols anymore.

You can still do this translation, but it’s a little more complicated. You can think of QR codes as a different kind of Kanji.

The arrangement of dots and spaces means something specific, so as long as you understand the structure of the code, you can literally read the pictures like they are paragraphs.

In fact, that’s the primary idea. QR codes represent a series of letters and numbers (and symbols, like punctuation). As long as you know the formula, you can translate a sentence into QR and back again.

Reed-Solomon Error Correction

That’s the gist of how QR codes work, and that might be satisfying enough for you, but if you really want to get some depth to the whole thing, then we have to talk about error correction. Before, I was using an analogy of translating from one language to another. The thing about that is that translation is actually an imprecise thing.

There are sentences that you can say in English that have no perfect translation in other languages. And, that’s true no matter which language you are using. There are no perfect translations, in fact, and it’s a challenging prospect for linguists and translators.

QR codes, on the other hand, do have perfect translations, and that’s because the QR system is built with machine precision.

The codes don’t have meaning in a verbal sense. They aren’t representing ideas as language does. Instead, the codes are representing strict arrangements of the symbols that you can find on a keyboard (which includes letters and numbers).

The QR code is a machine representation, so there isn’t really any room for arguing the meaning. Despite that, there is still a margin of error within QR codes, and that’s because they are so complicated.

We’ll talk later about just how many unique QR codes you can make, and that’s only possible because they are built on a complicated system.

I’m going to try to keep this light on the technical jargon, but QR codes are built for computers, and because of that, they run in a binary system.

What this means is that each QR expression is really expressing a number that is a multiple of the number “2.” When a computer creates or reads a QR code, it is ultimately seeing a long series of numbers.

But, expressing dots as numbers, and then as letters, and then as other things as the program might dictate means that a lot of math is happening, and there are actually rounding errors that come up within that math.

And, that brings us to Reed-Solomon Error Correction. This is a pretty deep concept, so I’m barely going to scratch the surface, but here’s the gist.

Rounding errors show up in QR codes, and that means that it’s possible for two similar QR codes to generate the same text, if that rounding error isn’t fixed.

Reed-Solomon Error Correction is the algorithm that is used to overcome the rounding error.

It involves some sophisticated math, but ultimately, you can choose from a range of correction options, and that help clean up QR codes.

What ends up happening is that the QR code generator will simply not use code combinations that can’t be separated by the correction factor.

But since different correction factors are available, whoever is designing the QR code system can basically choose how complicated the system really is.

If you want it to run a little faster, then you use a simpler error correction. You lose some possible unique QR codes, but everything is fast and easy.

If it’s more important to be able to express longer or more complicated codes, then you’ll need a more complicated error correction, and that can make the app run a little slower.

Summary

To summarize, a QR code is basically its own language, but because it’s digital, a lot of math is involved.

And, that math requires a sophisticated error-correction algorithm to make everything run smoothly. With all of that covered, we’re ready to revisit the original question, and I can supply you with a thorough answer.

How Are All QR Codes Unique?

reading QR code at restaurant

First of all, QR codes don’t exactly have to be unique. You can have one code that is repeated many times.

Now, every copy of a code will mean the exact same thing, but it’s worth noting that there are good reasons to repeat a code.

As an easy example, a restaurant might want to use a QR code so that patrons can see a digital menu. You can put the exact same QR code on every table, and scanning it will take any patron to the same webpage with the menu.

That said, you might have had something else in mind when you asked this question, and I’ll try to address it.

How is it that each different arrangement of blocks on a QR code can mean something different? It’s a fair question, but it’s easy to think about in different terms. How can the same set of letters mean a bunch of different things depending on how you arrange them?

The answer is in the question.

It comes down to the arrangement, and QR codes allow for a wide variety of arrangements. Like any language or code, a QR code’s meaning changes any time you move a single part of the image.

Using our analogy, I can use the same letters to spell “may” and “yam,” but the arrangement of those letters completely changes the word’s meaning.

Similarly, if you change where the blocks and white spaces are in a QR code, you get a completely different meaning.

Ultimately, you can have a unique QR code for every possible arrangement of blocks and white spaces. I’ll get into the numbers a little later, but suffice it to say that a lot of unique QR codes are possible. But, QR codes run into limits the same way that language does.

If you’re on Twitter, there’s a character limit that prevents you from typing as much as you want.

QR codes have similar limits—there are only so many pixels in each code.

But, that limit doesn’t prevent Twitter from seeing uncountable numbers of unique tweets, and you get the same result with QR codes.

To put this as simply as possible, QR codes are unique because the series of dots and spaces doesn’t match from one code to the next.

In that way, a QR code is essentially just another language you can use to write things.

How Are My Generated QR Codes Unique?

Man's hand holding smartphone with QR code on the screen for payment

While that explains a lot, it still leaves a missing piece of information.

If you use a QR code generator, you can generate a code for whatever purpose you have in mind. But, you can regenerate the code for that exact same purpose, and the new one will be unique. Let me explain this with an example.

Some smartphones allow you to generate a QR code in order to share information with another smartphone user. For instance, you can have a QR code to share your contact information.

You can create a QR code for your contact information, but then you can recreate it, and the new code will be different from the first version, even though they’re expressing the exact same contact card (this actually depends on what you use to generate the code, but with some tools, you will get a new, unique code as I described).

Based on everything you have read, that shouldn’t work.

The two QR codes should be identical since they’re describing the exact same set of information. Here’s the secret to why they aren’t identical.

The app generating the QR code can give a unique name to the code it is making.

It will usually just be some kind of complicated serial number, but that unique name is included in the overall information included in the QR code.

So, your first code for your contact information had your contact information plus the unique name of the code’s file.

The second one had a different unique name, and when you translate everything into the QR language, you’ll come up with a different code in each case. This is a big part of why you can have a truly unique QR code any time that you want.

As long as the QR code has a unique name, the code generated will also be unique, even if the primary information isn’t.

A Common Misconception

This brings us to a misunderstanding that comes up a lot with QR codes. A lot of people wonder how an app knows that a QR code is unique. That question itself is a misconception.

Your app doesn’t know if your QR code is unique, and it doesn’t need to. The misconception seems to stem from the idea that websites, email addresses, phone numbers, and even physical addresses are all unique.

These are all more or fewer codes that we use to describe a location (whether in the real world or in digital space), and they have to be unique so that we don’t confuse one website or address with another. QR codes are nothing like that.

QR codes are just a visual language.

They’re the same as the words and alphabet that I’m using to write this to you right now, only they use dots and spaces instead of squiggly lines.

Let me put this another way.

A QR code is just another way of writing things.

Asking how a QR code is unique is like asking how a sentence is unique. You don’t really know if a sentence is unique or not, and it doesn’t matter. What matters is that the person reading the sentence can understand it. That’s true with QR codes too.

All that matters is that the app you use to read the code can understand the information.

I want to use one more simple example to try to drive this home. Let’s say that you and I use different apps to create a QR code, but we both generate a code that sends people to Google.com. That’s it.

That’s the whole purpose of this code. Even though we’re using different apps, how QR codes will look identical (assuming we’re using the same QR format)?

In fact, they have to look identical in order to work since they’re sending users to the same website. This is why it doesn’t matter if a QR code that you generate is unique.

What matters is the information conveyed by the code. One last time for emphasis.

The only way for a QR code to be unique is for it to describe unique information, and there’s no way any app can know if the information in your code is truly unique or not.

But, for applications where uniqueness is important, the app can add a very complicated name to the QR code, and that extra information is enough to make it so that it is very likely a unique code.

Is There a Limit to How Many Unique QR Codes Can Exist?

female passenger show online qr code using mobile phone to airline ground crew

The uniqueness of QR codes might make more sense if we get into some of the numbers and technical aspects.

Technically speaking, there is a hard limit to how many unique QR codes can exist, but that limit is so huge that we’ll never run out of QR codes.

First off, QR codes have different dot densities.

In other words, some QR codes can fit more dots than others into a single square image. This is kind of like phone numbers. A local phone number has seven digits.

Long-distance numbers have 9 digits, and international numbers have even more. Not all phone numbers have the same numerical density, and not all QR codes have the same dot density.

But, even the most basic QR codes are far more complicated than phone numbers, and that means that there are way more possible combinations.

As an example, QR-40 is one of the more popular QR code formats.

With this format, you can have 2^23624 different unique codes.

Now, that’s not an intuitive number, so allow me to express it like this.

It’s more than 10^7,000 different unique codes.

That’s a 10 with 7,000 zeros behind it.

Let’s add a little more perspective.

There are roughly 10^80 (10 with 80 zeros behind it) atoms in the universe.

Read that again.

The number of QR codes possible with just QR-40 is beyond astronomical.

And, if you change the dot density at all, then every single code with a different QR code format is unique compared to QR-40. There are so many possibilities that the numbers don’t really make sense anymore. Technically, there are not an infinite number of unique QR codes, but there are so many options that it doesn’t matter. We really will never run out of unique codes.

QR Codes: How Are QR Codes Unique? (All the Info)

Author

  • Theresa McDonough

    Tech entrepreneur and founder of Tech Medic, who has become a prominent advocate for the Right to Repair movement. She has testified before the US Federal Trade Commission and been featured on CBS Sunday Morning, helping influence change within the tech industry.