How a QR code works and why each code is unique

How a QR code works and why each code is unique

With the arrival of the first smartphones and the generalization of the Internet connection, the QR code was an improved version of the classic barcodes of all life. Its most common use was to include a URL, since when we scanned them with our mobile, they took us to a specific web page.

In its day, it was a very common practice in the digital marketing actions of companies , and, although its use was not so widespread today, now they have become fashionable again as a result of the crisis caused by COVID-19.

 When sitting on a terrace, the absence of letters has certainly not gone unnoticed in favor of a QR code attached to the table through which we can see the menus available in the restaurant.

The "new normal" has made us reconnect with this old acquaintance, but do you really know how a QR code works? If the answer is negative, then this post is for you.

QR Structure

What is and how does a QR code work?

Let's start with the basics. A QR code is a square-shaped, two-dimensional barcode capable of storing encoded data through a file or text file. Also known as Quick Response Codes, they usually contain a URL in most cases .

For practical purposes, these codes are reduced to simple images that we can scan with our mobile camera. If you have noticed, these are made up of a series of modules and patterns in black and white that make them unique given the incredible amount of possible combinations. These are its specifications:

  • Position stop patterns: composed of three delimiters that allow the QR reader to know where the content of the code is.
  • Alignment pattern: this is another extra delimiter to know the orientation of the code.
  • Synchronization lines: thanks to these lines the reader can know the size of the symbols inside the body.
  • Variable information: here we find the information referring to the version of the QR code that is being used and the format line that determines the level of error correction.

In some cases, boxes are also added on the outside to give it a more aesthetic and personalized shape, but the reader does not collect this information .

QR code setup

We have already seen that QR codes are a combination of black and white patterns, containing an encoded text file inside. This text file can contain a huge amount of characters as you can see below:

  • Numbers - Up to 7,089 characters
  • Alphanumeric data - Up to 4,296 characters
  • Binary - Up to 2,953 bytes
  • Kanji / Kana - Up to 1,817 characters

In addition, to facilitate reading speed, the QR codes incorporate an error correction system , which are grouped by levels to categorize the recoverable data.

  • Level L 7% of code words can be restored.
  • Level M 15% of code words can be restored.
  • Level Q 25% of code words can be restored.
  • Level H 30% of code words can be restored.

This system that we are talking about, which allows correcting up to 30% of errors , is used so that the QR code can be read by our camera, even if it is damaged or has poor clarity. Which ultimately allows for almost immediate read speed. In fact, as you have seen more than once, accessing the content of a QR code is quite fast.