Especially after COVID-19 began plaguing the planet, QR codes have been a big part of our daily lives. In this day and age, it’s quite impossible for one to have never seen a QR code, or used one. Even before the pandemic, QR codes had been around us for a while, but many of us — having grown up in the Digital Age — simply accept new technology into our lives without wondering too much about how they work. For most of us, QR codes just look like... square pixelated versions of the alien heptapod symbols in Arrival (2016), that somehow, magically (and really quickly) bring us to a different screen when we scan them.
So what are these cryptic codes? Are they magic? Clearly they’re not, but how do they work? Before we take you in for the ride, let’s get the basics down.
QR stands for Quick Response, and a QR code is pretty much a barcode (which has been around since the 1950s) except two-dimensional. Because it’s 2D, it can contain more data than a barcode. It can encode over 7000 characters, which is a vast improvement from the standard barcode with a limited capacity of about 20 alphanumeric characters.
In Japan circa 1990s, Denso Wave Incorporated was contacted by manufacturing sites and asked if it was possible to come up with a faster barcode scanning system. This presented a problem as barcodes had a limited capacity, which made the scanning process time consuming for workers no matter how efficient the scanner was. To tackle this, Denso Wave began developing a compact code that can contain more data, including Kanji and Kana characters. The launch of the QR code was later announced in 1994.
The QR code was first used by the auto industry to track parts and products shipped around the globe. Then, gradually, other industries all over the world began joining in. Today, QR codes are used by nearly every physical and digital establishment for quick check-ins, displaying geolocation or contact info, redirecting customers to their websites, etc.
Grasping how a QR code works would require understanding the functions of its different parts. With the help of the labelled diagram, we hope to make this palatable for the layman. Let’s break it down.
The tiny squares in a QR code are called modules - black squares would be considered foreground modules, and white ones would be background modules. They don’t always have to be black and white, though, they could be in color too. Most QR codes are in black and white only so decoder softwares easily distinguish the contrast between the background and foreground. If you want your QR code to be colorful, you just have to make sure that the contrast is retained when it is in grayscale / black and white.
The bigger the code, the more rows and columns of modules it will contain. Yup, just like humankind, QR codes come in different shapes, sizes and colors (although there are standards to follow).
There are 40 preset sizes (or, versions) to choose from. Version 1 being the smallest type with 21 rows and 21 columns, and Version 40 being the largest with 177 rows and 177 columns. When a generator produces a code for you, it will determine the suitable QR code version number for you depending on the amount of data you are encoding.
The 3 big squares on 3 corners of the QR code are finder patterns, which help your device camera determine the boundaries of the code and its correct orientation. This is so if the code is rotated, or upside-down, decoders would still be able to read it. These finder patterns are surrounded by a single-module spacing called separators which help decoders separate the finder patterns from the code data.
Connecting each finder pattern are timing patterns that alternate between black and white. These lines tell your decoder software how big the data cells are within the code.
The smaller square (that is distinctively not a finder pattern) on the fourth corner is an alignment pattern that helps the decoder prevent image distortions. Level 1 QR codes (the smallest size of QR codes) do not contain alignment patterns. The bigger the code, however, the more alignment patterns are added.
The 15 bits beside the separators are format and version strings which contain information on the code’s error correction level and the chosen mask pattern for the particular code. Hold on… information on the what and what?
Error correction code makes sure that the code is still readable if up to 30% of the code is corrupt. Designers or generators of a code can decide how many levels of error correction they want to include in the code. The higher the level of error correction, the higher percentage of corruption a decoder can read past. However, the higher the level of error correction, the more space it takes up on the QR code, leaving less space for data. In other words, the more space the error correction code takes up, the lower the max numerical characters a QR code can fit. How much error correction a QR code needs probably will depend on where it will be displayed. E.g. A QR code on a paper flyer would need higher error correction than one on a laminated poster placed indoors, and a digital QR code could do with none because it is unlikely to be damaged.
The code is also overlaid by a mask pattern, inverting and retaining certain data areas to “mix it up” / conceal it. Decoder softwares detect the mask type from the format information and demask the QR code before reading the rest of the data. Of course this happens in a matter of milliseconds.
Encoded characters - The black and white modules read in a fixed zigzaggy direction (as shown in the image), starting from the bottom right corner, gives the decoder a sequence of data bits that goes something like 001010111…
(Image Source: nayuki.io)
Different binary sequences represent different codewords, which include symbols, lowercase letters, uppercase letters, etc. For example, the binary sequence 01110111 represents the letter ‘w’, 00100001 represents the exclamation point ‘!’, and 00100000 represents a space.
Here’s a QR code generated with www.qr-code-generator.com. Do the patterns make a lot more sense to you now? If you can’t answer in confidence, that’s okay. You’re not going to have to make one by hand, ever. (Unless you want to.)
There are plenty of offline and online QR code generators free for use. All you have to do is key in what you want to encode in the QR code, be it a link to a coupon redemption page, a YouTube video, your social media sites, your contact details, or simply a website homepage.
Most free QR code generators, though, require you to sign up or subscribe to a plan to gain access to more design options and features, such as error correction levels and insights tracking.
Whether you own a business or simply have a web page to share, a QR code could help people reach you easily and quickly. In case you were looking for ideas, here are some of the ways in which using a QR code could greatly benefit you:
Your customers can get to your website, social media platforms, or map location in a matter of seconds. They don’t have to manually type your website URL, usernames, or addresses into their browsers or maps. They simply need to whip out their phones and scan the QR code to be redirected to you.
Payment is also made easy with QR codes. Most stores enable QR codes for quick payment via e-wallets so customers don’t have to fumble through their wallets for cash and keep others waiting. Some good examples would be GrabPay or ShopeePay, which are enabled at many on and offline merchants in Malaysia.
(Image Source: help.shopee.com.my, grab.com)
You can embed URL links that lead straight to a ‘compose email’ or ‘compose direct message’ page (for instance, mailto:email@example.com) into your QR code. For email, this saves your customers up to 10 seconds because it helps them skip the process of opening their email app, tapping on compose email, and typing your email address manually into the recipient bar. For social media, this saves them the effort of opening the app, typing your username into the search bar, and tapping on the message button. This might literally be “a matter of seconds” which seems small, but it keeps people who are interested in your services or products, well, interested. Making things quicker and easier for your patrons is always a good move.
Snappymob is a passionate web and mobile app developer based in Kuala Lumpur, Malaysia. We have designed and developed awesome web and mobile applications for industries and companies around the globe.
We love our craft — the design, development, and the business of apps and this blog is our outlet for discussing what we think and sharing what we know with our community.