qr code generator

How Does QR Code Work

Here is how do QR codes actually work.

QR codes are formed with a 2D array of pixels, which are one color to represent zero or a contrasting color to represent one. They can range from version 1 (21x21 pixels) to version 40 (177x177 pixels).

QR Code Functionality

In most everyday cases, QR codes are a convenient replacement for a web address, saving users from typing out lengthy URLs. It's kinda like a link shortener

scan qr code with phone

Android and Apple phones have integrated QR code readers into their camera apps, allowing users to simply scan a barcode and be redirected to the desired webpage.

QR codes also come with error correction built into their design, meaning they can often still find the correct redirection even when the code is damaged or dirty.

How To Identify a QR Code

One of the easiest ways to identify a QR code is the distinctive pattern in the corners. These patterns are the same size and occur on QR codes of any size, and are used when reading the QR code to detect the position and rotation of the code. Larger versions also include smaller alignment structures.

qr code structure

Timing Structure

The next structure that occurs on all QR codes is the timing structure. This pattern aligns with the edge of the outer positioning squares and alternates between the two colors of the code at a size of 1 pixel.

This allows the reader to confirm the version of the code as well as the timing of the bits along both axes.

Formatting Patterns

Patterns included on QR codes are used to denote the format of the data in the code. The first of these is the level of error correction used in the code, which can be low, medium, high, or quartile.

The second part of the formatting pattern is the mask that is applied to the data, which is used to break up large blocks of identical bits to make the pattern easier to read.

Data Storage

The remainder of the code is used to represent the stored data. To look at how this data is stored, we first need to examine the pattern that the individual bits are arranged in.

The data starts in the lower right corner, following a zigzag pattern working its way up two columns to the top of the data space.

This pattern continues in the same manner through the remainder of the space, following a general right-to-left, up-and-down pattern.

Encoding Indicator and Message Length

The first four bits in the data specify the type of encoding the data is stored in, such as numeric, alphanumeric, kanji, or whole bytes.

The next byte of data stores the message length, which can be represented in binary.

End of Message Indicator and Error Correction Data

Following our data, the next four bits in the code are the end of message indicator. Now that the message in our code is complete, we still have remaining bytes of storage space, which is used to store the error correction data of our message.

QR codes use Reed-Solomon error correction.

Applying the Mask

To finalize the QR code, a mask is applied to reduce pixel grouping in our final code.

In generating the code, multiple masks can be tested and the outcome given a score based on the size of the remaining groups.


Buses, business cards, and magazines are just a few of the places you can find QR codes today, as their use becomes increasingly common in advertising.

Countries like Russia and Ghana have even featured QR codes on their currency, usually to commemorate historical events, linking to a website with further details.

The codes have won several awards for design and innovation over the years.

The Origins of QR Codes

The solution to these very modern problems is, of course, the QR code—a type of 2D barcode first invented in Japan in 1994. Its design was modeled on the colored pieces from Go, a board game even more popular than chess across much of Asia.

qr code in japan

Traditional barcodes were already in existence, but they had limited data storage since they were scanned horizontally only. Manufacturing plants, specifically car factories, needed technology that could carry more information and be read significantly quicker.

Component company Denso devised the first QR code (short for Quick Response) to enable high-speed scanning of various car components, making them more efficient.

Additional QR Code Facts

Widespread Adoption in Japan and Beyond

By the early 2000s, QR codes were widespread across most of Japan, used not only in logistics for shipping and handling but also in everyday life, such as airports and street posters. The novelty of the new shape, coupled with the rise of phones with built-in cameras, saw technophiles in Japan consuming QR codes in their millions.

The established design for codes featured a trio of black squares in the upper left, upper right, and lower left corners, enabling scanning devices to detect them immediately. The design was soon approved by the International Organization for Standardization, and following the turn of the millennium, QR codes began to appear more frequently in the Western world.

The Dark Side of QR Codes

However, QR codes are not perfect. They have become tools for hackers who can replicate well-known websites and trick targets into disclosing personal information.

Additionally, their reliance on a strong internet connection has been criticized, particularly for tourists and those in rural locations.