Computer Science Issue I Volume XXII

The Magic of Scanning: Science Behind the QR Code

About the Author: Qi Lin

Qi is a junior studying computer science at the USC Viterbi School of Engineering. If she has time, she loves to play games or watch suspense dramas, especially ones written by Keigo Higashino.


A QR code has two dimensions that can support different kinds of data. Numeric data, alphanumeric characters, and Kanji are the three main data types. The components of the QR code include indicators and data code. The QR code has many applications in our life, such as payment, product packaging, and advertising. Because of the designs enabled by the Reed-Solomon error correction method, the code stands out and invites viewers to scan it. 


In Asia, people rely highly on the QR code. People will start their day by scanning a QR code to buy breakfast, then scanning another QR code to unlock a rental  bicycle, and later paying for a taxi back home with a QR code. Moreover, China used a colored-coded QR code system for restricting social activities during the Covid-19 period [1]. On the other hand, in the US, have you ever scanned a QR code on a product or advertisement page and been redirected to a website? QR codes can also link to people’s profiles. Nowadays, QR codes are highly integrated into people’s lives and will be more useful across the world in the future.


The QR code was derived from the bar code. In the 1960s, Japan entered a period of economic boom and supermarkets had incredible growth in sales. However, cashiers in supermarkets had to type in the price manually which was inefficient. With the invention of the bar code and the POS system in the 1970s, cashiers could immediately send prices to computers and calculate the total price of a purchase. However, the bar code can only contain 20 numbers that include the basic information of the product. During the massive growth in sales, companies needed to keep track of logistic information the bar code could not contain. 

After discovering the limitation, a Japanese company named Denso Wave, which initially developed a barcode reader, decided to create a code that could contain more information, even including Japanese characters [2]. In 1994, they formally announced the QR code, QR meaning “quick response”. In 2011, only 6.2% of mobile phone users in the US scanned QR codes [3]. The limitation of QR code usage was due to the lack of a ubiquitous QR code scanner. However, with the development of 4G and the widespread usage of smartphones with a build-in scanner, usage of QR codes has climbed significantly.

What a QR Code is Composed Of?

The barcode is a one dimension code storing information like ID numbers to specify an item. However, a QR code has an x-axis and y-axis, which means the information it can store will be exponentially larger. There are 40 versions of the QR code. The largest one can store 1850 uppercase characters. QR codes can also support data like numbers, bytes, and Japanese characters. Even though the QR code looks complex, it only includes two components, indicators and data code.


Figure 1. Indicator parts in a QR code [3]

Every QR code has components called indicators, which are used to specify basic information. The three green squares at the corner are the position detection indicators. The smaller red square is called an alignment indicator. The green and red patterns indicate the size of the code and enable machines to recognize the direction to read the codes. These squares enable users to scan in any direction they want. Some QR codes have two timing indicators connecting the three green squares, shown by the blue line in the diagram. These lines look like a zebra-crossing and are used to inform the scanner of the location of rows and columns [3]. The rectangles in pink are called version indicators and they reveal the version of the code to the machine. The yellow strips contain format information which enables the scanner to know what kind of information the code is encoded with, such as numbers or website URLs [3]. These indicators help scanners immediately spot the correct orientation of the QR code and know the basic information contained in the code.

Data Code

Figure 2. The chars that transform character to number value [4]
Figure 3. Example of transforming “B” to data code

The data part of a QR code translates the information into zeroes and ones, which are binary numbers. Data code contains a mode indicator at the beginning to display the type of information. There is then a list of numbers to specify the number of total characters [4]. Then follows the more complex content. For example, according to the chart, if the code needs to store the character “B”, its corresponding number is 11. Then we can translate 11 into binary numbers: 1011. Based on the number of the character, several 0s may be added to the front. The next step is to connect all these numbers and separate them using 8 digits. If the code is too short, we will need to add some numbers at the back, known as padding bytes [4]. After combining these digits, it stores the information in QR code form. Transforming the 0 to white and 1 to black makes the numbers into images.

Applications of QR Codes

Nowadays, most phones already support scanning QR codes using their cameras. This has prompted the further development of QR codes and largely improved users’ experiences. QR codes can be used for payment. Some markets provide QR codes at checkout. When people need to pay, they just need to turn on a bank app or an app that stores money to scan the code. Then the app will automatically pop out the window for the total and the user needs to type in the password to authorize the payment. 

Furthermore, QR codes are useful for checking someone’s coronavirus status, which is the “health code” developed in China. First, it was linked with a payment app and messaging app that are widely used by the Chinese. Then it requires people to fill out their personal information, travel histories, and symptoms. After it gets uploaded, there will be a green code or yellow code, or red code given to people. During the Covid-19 period, people are required to show their code in real-time, which has to be green, when they need to enter a public place.. These successfully prevent people who get infected with covid-19 from being in a public place and spreading the disease. 

In addition, QR codes can also be used for product advertising and promotions. Companies may embed codes in posters or magazines to engage with customers. For example, a makeup company might create an augmented reality website that could allow users to try on their makeup through the phone. Then they can embed a QR code in a women’s targeted magazine to attract more potential customers. This could make offline advertising more engaging for users.

Problems with QR Codes in Advertising

QR codes can be used to store different kinds of information. Therefore, companies are using it as a tool to link it with anything they want users to see. Since the design of the QR code is not attractive, it can be awkward to design it to fit with backgrounds and inspire spontaneous interaction. Therefore, the code is somewhat difficult to incorporate organically into advertisements.  Also, a QR code has a level of complexity and people may be overwhelmed by the crowded content [7]. Researchers found that if the advertisement has a good perceived fit with QR code, the user’s intention to actively interact with the ads will increase, thus encouraging more customers to scan the code [7]. 

Figure 4. A visual advertisement which makes QR codes attractive [8]
The spontaneous feature of the QR codes will also restrict the types of products that could use them for ads [6]. Different products produce various levels of involvement. Low-involvement products are items that people spend less time considering buying, such as chewing gum. When encountering ads with QR code of a low involvement product, people are less likely to scan the code because they consider it is redundant and cannot provide enriched information. Its lack of immediate readability will hassle some customers [6]. However, for high involvement products like insurance, customers will have a positive attitude toward the QR code because it provides more information. Also, since it involves spontaneous interaction, customers might have a positive attitude at the decision-making process of purchasing products. When looking for insurance, people will be more likely to scan the code on the ads to gather more information about the policy of the insurance they want to buy. Not all kinds of ads are suited for embedding QR codes in them and it requires the marketer’s careful consideration.


The QR code is highly involved in peoples’ lives and its efficiency makes using it a smooth process. By developing a unique style for QR codes, marketers can provide a code while also making the ads more appealing and effective. Nowadays, there is a great usage difference in QR codes between the US and Asia.. For payment, users only need to bring up their phones to pay, decreasing the chance of lost credit cards. Furthermore, since QR codes are efficient and low cost, companies can develop as many as they want. These provide benefits for both people and companies, which could lead to an increase in the usage of QR codes.

Further Readings

A journal about examining QR codes impact on customers purchase intension and satisfaction:

A journal about colors added to QR code

A blog about the effectiveness of an advertisement 

Multimedia Applications:

What QR codes are composed of?

A detailed video about composition and application of QR code

How “Health QR code” works.


[1] H. Hu, “How China is Using QR Codes to Detect and Stop Coronavirus,” QR Code Generator, 02-Jun-2020. [Online]. Available: [Accessed: 25-Jan-2021]. 

[2] “History of QR CodeHow was the QR Code created?: How has it come to be used so widely?: And what is its future?,” History of QR Code | | DENSO WAVE. [Online]. Available: [Accessed: 25-Jan-2021]. 

[3] S. Pagin, Guide to QR Codes for Print & How They Work, 04-Jan-2015. [Online]. Available: [Accessed: 25-Jan-2021]. 

[4] H. Chen, “Details and principles of QR code generation,” CoolShell, 29-Oct-2013. [Online]. Available: [Accessed: 26-Jan-2021]. 

[5] Y. Kumar TK, “QR Codes in the US – How Fast is It Growing and Who is Using It?,” Beaconstac RSS, 03-Dec-2020. [Online]. Available: [Accessed: 01-Feb-2021].

[6] R. Trivedi, T. Teichert, and D. Hardeck , “Effectiveness of pull-based print advertising with QR codes: Role of consumer involvement and advertisement appeal,” European Journal of Marketing, vol. 55, no. 1, Dec. 2019. 

[7] S. Okazakia, A. Navarrob, P. Mukherji, and K. Plangger, “The curious versus the overwhelmed: Factors influencing QR codes scan intention,” Journal of Business Research, vol. 99, pp. 498–506, Jun. 2019.

[8] Disney, [Online]. Available: [Accessed: 12-Feb-2021]

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *