Have you ever wondered how QR codes work?

September 21, 2022

With the boom in QR codes have you ever sat back and thought about how a QR code works? Probably not, but it really is fascinating (if you like that sort of thing!)


To trace parts throughout the manufacturing process, a Toyota subsidiary created the Quick Response (QR) code. Barcodes weren't working well because they couldn't be read from all angles and couldn't hold a lot of information for their size. All these problems are resolved with the QR code.

The Finder Patterns — cube forms that help your reader interpret the code — are the most recognisable feature of a QR code. The code is oriented so that it can be at any angle and the reader will still be able to tell which way is up thanks to the smaller fourth cube, the Alignment Pattern.

Every QR code has what are known as the timing patterns, which are alternating black and white dots. These inform the reader of the version, either 1 or 40, or the total size of the QR code, as well as the size of a single module.

These two strips next to the Finder patterns are where the format information is kept. Because it was stored twice, even a partially occluded QR code could be read. This is a recurring topic, as you'll see.

Three very important bits of information are kept here:

- Mask.

- Level of error correction

- Format for error repair.

Although these seem really dull, they are actually interesting.

What is mistake correction? In essence, it specifies how much redundant data should be included in the code to make sure that it can still be read even if some of it is absent.

Amazingly, if your code is outdoors, you may select a higher redundancy level to ensure that it continues to work even when obstructed.

What is the mask? Well, equal amounts of white and black spaces are necessary for QR readers to function properly. However, the data might not cooperate, thus to make things equal, a mask is needed.

Anything in the code that comes beneath the dark portion of the mask gets reversed when a mask is applied to it. A white space turns black, while a black space turns white.

There are eight common patterns that are used sequentially. The best-performing pattern is utilised, and that information is saved so the reader can remove the mask.

We now reach the actual data. Strangely, the data winds back up as shown, starting in the bottom-right corner. It can be read from any perspective, so it hardly matters where it begins.

The reader is informed about the mode and length of the data's encoding in the first and second pieces of information, respectively. In our example, there are 24 bytes total, or 8 bit chunks, and there are 8 bytes per character.

After our data, there is still a significant amount of empty space. The mistake correcting data is kept here so that it can be accessed even if it is partially covered. Since the operation of this is actually extremely complicated we shall leave this here!

Perhaps the coolest thing about QR codes is that Denso Wave, the company that invented them, never exercised their patent and released the technology for free!

Stitch offer a range of messaging solutions built around the WhatsApp API which use QR codes. Scan below to get in touch:

Take the next step

Book a Call