Decode the QR code!

Prajakta Sathe
3 min readJan 9, 2021

--

Photo by Albert Hu on Unsplash

Unless you live in Antarctica, you must have scanned QR codes sometime in your life. Now, even WhatsApp has a QR code for adding new contacts (saving us so much pain and anguish of taking down phone numbers 😅 !) Have you ever wondered what makes a QR code, a QR code? I mean after you scan a bunch of black and white squares forming random patterns (well, they aren’t really ‘random’ patterns as you will find out), you are almost immediately transported to someplace (umm, I mean some webpage or video or any resource for that matter). What are these black and white patterns all about?

Let’s find out! 🕵🏻‍♂️

How it works —

A QR (quick response) code is just a more complicated version of the standard barcode. To explain in just 2–3 lines, it would be like this:

  1. A reader (can be a smartphone or any device capable of scanning) scans the code.
  2. The information in the code is collected; i.e. the pattern is converted to code (which is understood by the machine).
  3. The code is converted to text (which is understood by humans). That’s all there really is to it!

Structure of the QR code —

A modern QR code can store up to 4296 characters. These characters may include letters, punctuation marks, and special characters too.

It can be divided into 5 parts as follows:

structure of QR code (image from Wikipedia)
Structure of a QR code (image from Wikipedia)
  1. Version information — No prizes for guessing, these give the version of the QR code (there are over 40 as of today!). The most common version is version 7.
  2. Format information — Contains information about error tolerance. Also makes it easier to scan the code.
  3. Data error and correction keys — These help if the QR code is damaged (up to 30% damage is manageable).
  4. Position markers — These help in recognizing a QR code along with its orientation. These are located at the 3 corners of the code.
  5. Alignment patterns— When the QR code is on a curved surface, these help the machine to straighten it out. The number of alignment markings is directly proportional to the amount of data in the code.
  6. Timing pattern — These black and white lines help to figure out the size of the data matrix.
  7. Quiet zone — Helps to distinguish the QR code from its surroundings. It is the white space surrounding the QR code.

Types of QR codes -

Static codes — Just as the name suggests, static codes contain fixed information. It is not editable. Examples, where these codes are used, are — Wi-Fi, plain text, bitcoin, email, vCard, etc.

Dynamic codes — These are the opposite of static codes. The information here is not fixed and can be edited as and when you want to. These are mostly used for marketing campaigns and business, or in cases where you want to track something. Examples, where dynamic codes are used, are — social media, coupons, pdfs, business pages, etc.

If you are curious and want to find out more about QR codes, go ahead and pay a visit to these websites —

  1. https://en.wikipedia.org/wiki/QR_code
  2. https://www.qr-code-generator.com/blog/how-qr-codes-work-and-their-history/
  3. https://www.qrcode.com/en/history/ (if you want to know the history of how QR codes were developed visit this webpage)

--

--

Prajakta Sathe

I write about data science and UI UX design and other exciting stuff!!