After seeing a Mastodon post about slightly messy QR codes recently, and another post pointing to a tutorial for how to read QR codes without a computer a while before that, I started messing around a bit with QR codes, and eventually ended up wondering if there are ways to make QR codes that scan with multiple different results, maybe exploiting the different quirks of different scanners or using camera tricks. It feels like something that somebody at some point would have tried.

And indeed, a quick search shows a few papers: One about literally putting a QR code in your QR code1, and another about QR codes that scan differently depending on the angle from which you look at them (though very little about different implementations, someone should maybe look into that).

While the former seems rather involved, the latter is, proper evaluation aside, conceptually extremely simple: You generate two QR codes and then you make the left side of the module one thing, and the right side another.

Python already has a QR code module (and Python is a web programming language now), so this is quick to implement:

And… it works! It is very fiddly, and at least my phone seems to have a pretty strong preference (that can be normalized against by making either the white modules a bit less white or the black ones a bit less black), but that got me thinking - isn’t there another way we could exploit what the camera does to get interesting results? And there indeed is: This is a QR code that will scan as something different depending on whether you scan it from close up or from further away:

The reason this works is due to how QR code readers read the QR code. They do not, generally, look at the whole module, but rather, just at the colour in the very center - that’s why e.g. error diffused QR codes still scan just fine. The little dot in the middle is all that matters, the rest, the scanner generally ignores. We can use that to store two QR codes in the same space depending on camera distance, with really good consistency:

  • When the camera is close to the QR code, it will properly record the little dots in the module centers, and that’s all the information the scanner will use
  • When the camera is farther away, a single camera pixel may cover all the area around the central dot as well as the central dot together, and they get averaged together, so what the QR code scanner sees is the colour of the outer module

Searching again while writing this post, this isn’t exactly an original idea, either: There’s a paper from 2024 that does basically that and another paper from USENIX 2026 that goes a step further and designs patterns that allow squeezing in three payloads.

Now, I couldn’t quite get their approach to work, but I was able to get a three code generator working by using circle patterns instead, so that’s what you can see implemented here. I also had to switch up the error correction and reduce the possible payload somewhat to get it even halfway consistent2:

Now, of course, the obvious question is: If two works well, and three works okay, why not four? An the obvious answer is that we’re really kind of running out of space in the modules, and QR code scanners won’t scan QR codes that are arbitrarily far away (at some point, the base modules get too small) or arbitrarily close (the code has to fit within the camera image), and I couldn’t get it to work by just adding another circle.

However! Remember a few paragraphs ago, when we adjusted contrast to bias the scanning a bit towards or away from one code over the other? Well, we can do the same thing here. And so, with that and a few more pixels per module so the circles look nicer, I am happy to present, to the best of my knowledge the worlds first quadruple stacked four distance QR code!

A QR code with little concentric circles within most modules.

(game awards voice) World Premiere!

The QR code scanning as CLOSEST The QR code scanning as CLOSE The QR code scanning as FAR The QR code scanning as FARTHEST

Proof this actually works on an actual real phone, shot at work because at home I cannot get far enough away from my monitor.

Now, what are the practical uses of this? The authors of the papers linked above propose a few, but as people who do not need to get their paper accepted to a conference, we can be more honest: Absolutely none. There are no real world practical applications of this. For the two distances QR codes, you can argue that it might be good for evading automated scans (most importantly for this, it scans very consistently, no futzing around needed for the most part), but three or more is entirely pointless fucking around. Which is to say, in other words: A lot of fun. And, most importantly:

I have the highest number, which means I win!3 I now hold the world record for the most QR codes per QR code4, until and unless someone can produce one that scans as five things or more!5

If you have additional appetite for non-commercializable nonsense, maybe I could interest you in some silly Mastodon apps?



  1. We heard you like QR codes &c &c ↩

  2. The idea of the cross patterns as far as I understand is that the crosses beams become unresolvable at a certain distance, which makes a lot of sense. But in my testing, I just plain could not get that to work, while circle patterns worked almost immediately. idk. ↩

  3. Also, and this is just my personal opinion, they look sick as hell with the circles in the modules. ↩

  4. Cave Johnson, we’re done here ↩

  5. You should consider this a challenge. ↩