# QR code

A QR code, quick-response code, is a type of two-dimensional matrix barcode invented in 1994 by Masahiro Hara of Japanese company Denso Wave for labelling automobile parts. It features black squares on a white background with fiducial markers, readable by imaging devices like cameras, and processed using Reed–Solomon error correction until the image can be appropriately interpreted. The required data is then extracted from patterns that are present in both the horizontal and the vertical components of the QR image.
Whereas a barcode is a machine-readable optical image that contains information specific to the labeled item, the QR code contains the data for a locator, an identifier, and web-tracking. To store data efficiently, QR codes use four standardized modes of encoding: numeric, alphanumeric, byte or binary, and kanji. Compared to standard UPC barcodes, the QR labeling system was applied beyond the automobile industry because of faster reading of the optical image and greater data-storage capacity in applications such as product tracking, item identification, time tracking, document management, and general marketing.

## History

The QR code system was invented in 1994, at the Denso Wave automotive products company, in Japan. The initial alternating-square design presented by the team of researchers, headed by Masahiro Hara, was influenced by the black counters and the white counters played on a Go board; the pattern of the position detection markers was determined by finding the least-used sequence of alternating black-white areas on printed matter, which was found to be (1:1:3:1:1). The functional purpose of the QR code system was to facilitate keeping track of the types and numbers of automobile parts, by replacing individually-scanned bar-code labels on each box of auto parts with a single label that contained the data of each label. The quadrangular configuration of the QR code system consolidated the data of the various bar-code labels with Kanji, Kana, and alphanumeric codes printed onto a single label.

## Adoption

As of 2024, QR codes are used in a much broader context, including both commercial tracking applications and convenience-oriented applications aimed at mobile phone users (termed mobile tagging). QR codes may be used to display text to the user, to open a webpage on the user's device, to add a vCard contact to the user's device, to open a Uniform Resource Identifier (URI), to connect to a wireless network, or to compose an email or text message. There are a great many QR code generators available as software or as online tools that are either free or require a paid subscription. The QR code has become one of the most-used types of two-dimensional code.
During June 2011, 14 million American mobile users scanned a QR code or a barcode. Some 58% of those users scanned a QR or barcode from their homes, while 39% scanned from retail stores; 53% of the 14 million users were men between the ages of 18 and 34.
In 2022, 89 million people in the United States scanned a QR code using their mobile devices, up by 26 percent compared to 2020. The majority of QR code users used them to make payments or to access product and menu information.
In September 2020, a survey found that 18.8 percent of consumers in the United States and the United Kingdom strongly agreed that they had noticed an increase in QR code use since the then-active COVID-19-related restrictions had begun several months prior.

## Standards

Several standards cover the encoding of data as QR codes:
* October 1997 – AIM (Association for Automatic Identification and Mobility) International
* January 1999 – JIS X 0510
* June 2000 – ISO/IEC 18004:2000 Information technology – Automatic identification and data capture techniques – Bar code symbology – QR code (now withdrawn) Defines QR code models 1 and 2 symbols.
* 1 September 2006 – ISO/IEC 18004:2006 Information technology – Automatic identification and data capture techniques – QR Code 2005 bar code symbology specification (now withdrawn) Defines QR code 2005 symbols, an extension of QR code model 2. Does not specify how to read QR code model 1 symbols, or require this for compliance.
* 1 February 2015 – ISO/IEC 18004:2015 Information – Automatic identification and data capture techniques – QR Code barcode symbology specification Renames the QR Code 2005 symbol to QR Code and adds clarification to some procedures and minor corrections.
* May 2022 – ISO/IEC 23941:2022 Information technology – Automatic identification and data capture techniques – Rectangular Micro QR Code (rMQR) bar code symbology specification Defines the requirements for Micro QR Code.
At the application layer, there is some variation between most of the implementations. Japan's NTT DoCoMo has established de facto standards for the encoding of URLs, contact information, and several other data types. The open-source "ZXing" project maintains a list of QR code data types.

## Uses

QR codes have become common in consumer advertising. Typically, a smartphone is used as a QR code scanner, displaying the code and converting it to some useful form (such as a standard URL for a website, thereby obviating the need for a user to type it into a Web browser).
QR codes have become a focus of advertising strategy to provide a way to access a brand's website more quickly than by manually entering a URL. Beyond mere convenience to the consumer, the importance of this capability is the belief that it increases the conversion rate: the chance that contact with the advertisement will convert to a sale. It coaxes interested prospects further down the conversion funnel with little delay or effort, bringing the viewer to the advertiser's website immediately, whereas a longer and more targeted sales pitch may lose the viewer's interest.
Although initially used to track parts in vehicle manufacturing, QR codes are used over a much wider range of applications. These include commercial tracking, warehouse stock control, entertainment and transport ticketing, product and loyalty marketing, and in-store product labeling. Examples of marketing include where a company's discounted and percent discount can be captured using a QR code decoder that is a mobile app, or storing a company's information such as address and related information alongside its alpha-numeric text data as can be seen in telephone directory yellow pages.
They can also be used to store personal information for organizations. An example of this is the Philippines National Bureau of Investigation (NBI) where NBI clearances now come with a QR code. Many of these applications target mobile-phone users (via mobile tagging). Users may receive text, add a vCard contact to their device, open a URL, or compose an e-mail or text message after scanning QR codes. They can generate and print their own QR codes for others to scan and use by visiting one of several pay or free QR code-generating sites or apps. Google had an API, now deprecated, to generate QR codes, and apps for scanning QR codes can be found on nearly all smartphone devices.
QR codes storing addresses and URLs may appear in magazines, on signs, on buses, on business cards, or on almost any object about which users might want information. Users with a camera phone equipped with the correct reader application can scan the image of the QR code to display text and contact information, connect to a wireless network, or open a web page in the phone's browser. This act of linking from physical world objects is termed hardlinking or object hyperlinking. QR codes also may be linked to a location to track where a code has been scanned. Either the application that scans the QR code retrieves the geo information by using GPS and cell tower triangulation (aGPS) or the URL encoded in the QR code itself is associated with a location. In 2008, a Japanese stonemason announced plans to engrave QR codes on gravestones, allowing visitors to view information about the deceased, and family members to keep track of visits. Psychologist Richard Wiseman was one of the first authors to include QR codes in a book, in Paranormality: Why We See What Isn't There (2011). Microsoft Office and LibreOffice have a functionality to insert QR code into documents.
QR codes have been incorporated into currency. In June 2011, The Royal Dutch Mint (Koninklijke Nederlandse Munt) issued the world's first official coin with a QR code to celebrate the centenary of its current building and premises. The coin can be scanned by a smartphone and originally linked to a special website with content about the historical event and design of the coin. In 2014, the Central Bank of Nigeria issued a 100-naira banknote to commemorate its centennial, the first banknote to incorporate a QR code in its design. When scanned with an internet-enabled mobile device, the code goes to a website that tells the centenary story of Nigeria.
In 2015, the Central Bank of the Russian Federation issued a 100-rubles note to commemorate the annexation of Crimea by the Russian Federation. It contains a QR code into its design, and when scanned with an internet-enabled mobile device, the code goes to a website that details the historical and technical background of the commemorative note. In 2017, the Bank of Ghana issued a 5-cedis banknote to commemorate 60 years of central banking in Ghana. It contains a QR code in its design which, when scanned with an internet-enabled mobile device, goes to the official Bank of Ghana website.
Credit card functionality is under development. In September 2016, the Reserve Bank of India (RBI) launched the eponymously named BharatQR, a common QR code jointly developed by all the four major card payment companies – National Payments Corporation of India that runs RuPay cards along with Mastercard, Visa, and American Express. It will also have the capability of accepting payments on the Unified Payments Interface (UPI) platform.

### Augmented reality

QR codes are used in some augmented reality systems to determine the positions of objects in 3-dimensional space.

### Mobile operating systems

QR codes can be used on various mobile device operating systems. While initially requiring the installation and use of third-party apps, both Android and iOS (since iOS 11) devices can now natively scan QR codes, without requiring an external app to be used. The camera app can scan and display the kind of QR code along with the link. These devices support URL redirection, which allows QR codes to send metadata to existing applications on the device.

### Virtual stores

QR codes have been used to establish "virtual stores", where a gallery of product information and QR codes is presented to the customer, e.g. on a train station wall. The customers scan the QR codes, and the products are delivered to their homes. This use started in South Korea, and Argentina, but is currently expanding globally. Walmart, Procter & Gamble and Woolworths have already adopted the Virtual Store concept.

### QR code payment

QR codes can be used to store bank account information or credit card information, or they can be specifically designed to work with particular payment provider applications. There are several trial applications of QR code payments across the world. In developing countries including China, India QR code payment is a very popular and convenient method of making payments. Since Alipay designed a QR code payment method in 2011, mobile payment has been quickly adopted in China. As of 2018, around 83% of all payments were made via mobile payment.
In November 2012, QR code payments were deployed on a larger scale in the Czech Republic when an open format for payment information exchange – a Short Payment Descriptor – was introduced and endorsed by the Czech Banking Association as the official local solution for QR payments. In 2013, the European Payment Council provided guidelines for the EPC QR code enabling SCT initiation within the Eurozone.
In 2017, Singapore created a task force including government agencies such as the Monetary Authority of Singapore and Infocomm Media Development Authority to spearhead a system for e-payments using standardized QR code specifications. These specific dimensions are specialized for Singapore.
The e-payment system, Singapore Quick Response Code (SGQR), essentially merges various QR codes into one label that can be used by both parties in the payment system. This allows for various banking apps to facilitate payments between multiple customers and a merchant that displays a single QR code. The SGQR scheme is co-owned by MAS and IMDA. A single SDQR label contains e-payments and combines multiple payment options. People making purchases can scan the code and see which payment options the merchant accepts.

### Website login

QR codes can be used to log into websites: a QR code is shown on the login page on a computer screen, and when a registered user scans it with a verified smartphone, they will automatically be logged in. Authentication is performed by the smartphone, which contacts the server. Google deployed such a login scheme in 2012.

### Mobile ticket

There is a system whereby a QR code can be displayed on a device such as a smartphone and used as an admission ticket. Its use is common for J1 League and Nippon Professional Baseball tickets in Japan. In some cases, rights can be transferred via the Internet. In Latvia, QR codes can be scanned in Riga public transport to validate Rīgas Satiksme e-tickets.

### Restaurant ordering

Restaurants can present a QR code near the front door or at the table allowing guests to view an online menu, or even redirect them to an online ordering website or app, allowing them to order and/or possibly pay for their meal without having to use a cashier or waiter. QR codes can also link to daily or weekly specials that are not printed on the standardized menus, and enable the establishment to update the entire menu without needing to print copies. At table-serve restaurants, QR codes enable guests to order and pay for their meals without a waiter involved – the QR code contains the table number so servers know where to bring the food. This application has grown especially since the need for social distancing during the 2020 COVID-19 pandemic prompted reduced contact between service staff and customers.

### Joining a Wi‑Fi network

By specifying the SSID, encryption type, password/passphrase, and if the SSID is hidden or not, mobile device users can quickly scan and join networks without having to manually enter the data. A MeCard-like format is supported by Android and iOS 11+.
* Common format: WIFI:S:<SSID>;T:<WEP|WPA|nopass>;P:<PASSWORD>;H:<true|false|blank>;;
* Sample: WIFI:S:MySSID;T:WPA;P:MyPassW0rd;;

### Funerary use

A QR code can link to an obituary and can be placed on a headstone. In 2008, Ishinokoe in Yamanashi Prefecture, Japan began to sell tombstones with QR codes produced by IT DeSign, where the code leads to a virtual grave site of the deceased. Other companies, such as Wisconsin-based Interactive Headstones, have also begun implementing QR codes into tombstones. In 2014, the Jewish Cemetery of La Paz in Uruguay began implementing QR codes for tombstones.

### Electronic authentication

QR codes can be used to generate time-based one-time passwords for electronic authentication.

### Loyalty programs

QR codes have been used by various retail outlets that have loyalty programs. Sometimes these programs are accessed with an app that is loaded onto a phone and includes a process triggered by a QR code scan. The QR codes for loyalty programs tend to be found printed on the receipt for a purchase or on the products themselves. Users in these schemes collect award points by scanning a code.

### Counterfeit detection

Serialised QR codes have been used by brands and governments to let consumers, retailers and distributors verify the authenticity of the products and help with detecting counterfeit products, as part of a brand protection program. However, the security level of a regular QR code is limited since QR codes printed on original products are easily reproduced on fake products, even though the analysis of data generated as a result of QR code scanning can be used to detect counterfeiting and illicit activity. A higher security level can be attained by embedding a digital watermark or copy detection pattern into the image of the QR code. This makes the QR code more secure against counterfeiting attempts; products that display a code which is counterfeit, although valid as a QR code, can be detected by scanning the secure QR code with the appropriate app.
The treaty regulating apostilles (documents bearing a seal of authenticity), has been updated to allow the issuance of digital apostilles by countries; a digital apostille is a PDF document with a cryptographic signature containing a QR code for a canonical URL of the original document, allowing users to verify the apostille from a printed version of the document.

### Product tracing

Different studies have been conducted to assess the effectiveness of QR codes as a means of conveying labelling information and their use as part of a food traceability system. In a field experiment, it was found that when provided free access to a smartphone with a QR code scanning app, 52.6% of participants would use it to access labelling information. A study made in South Korea showed that consumers appreciate QR code used in food traceability system, as they provide detailed information about food, as well as information that helps them in their purchasing decision. If QR codes are serialised, consumers can access a web page showing the supply chain for each ingredient, as well as information specific to each related batch, including meat processors and manufacturers, which helps address the concerns they have about the origin of their food.

### COVID-19 pandemic

After the COVID-19 pandemic began spreading, QR codes began to be used as a "touchless" system to display information, show menus, or provide updated consumer information, especially in the hospitality industry. Restaurants replaced paper or laminated plastic menus with QR code decals on the table, which opened an online version of the menu. This prevented the need to dispose of single-use paper menus, or institute cleaning and sanitizing procedures for permanent menus after each use. Local television stations have also begun to utilize codes on local newscasts to allow viewers quicker access to stories or information involving the pandemic, including testing and immunization scheduling websites, or for links within stories mentioned in the newscasts overall.
In Australia, patrons were required to scan QR codes at shops, clubs, supermarkets, and other service and retail establishments on entry to assist contact tracing. Singapore, Taiwan, the United Kingdom, and New Zealand used similar systems.
QR codes are also present on COVID-19 vaccination certificates in places such as Canada and the EU (EU Digital COVID certificate), where they can be scanned to verify the information on the certificate.

## Design

Unlike the older, one-dimensional barcodes that were designed to be mechanically scanned by a narrow beam of light, a QR code is detected by a two-dimensional digital image sensor and then digitally analyzed by a programmed processor. The processor locates the three distinctive squares at the corners of the QR code image, using a smaller square (or multiple squares) near the fourth corner to normalize the image for size, orientation, and angle of viewing. The small dots throughout the QR code are then converted to binary numbers and validated with an error-correcting algorithm.

### Information capacity

The amount of data that can be represented by a QR code symbol depends on the data type (mode, or input character set), version (1, ..., 40, indicating the overall dimensions of the symbol, i.e. 4 × version number + 17 dots on each side), and error correction level. The maximum storage capacities occur for version 40 and error correction level L (low), denoted by 40-L:
Maximum character storage capacity (40-L) Character refers to individual values of the input mode (data type). :
| Input mode | Max. characters | Bits/char. | Possible characters, default encoding |
| Numeric only | 7,089 | 31⁄3 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 |
| Alphanumeric | 4,296 | 51⁄2 | 0–9, A–Z (upper-case only), space, $, %, *, +, -, ., /, : |
| Binary/byte | 2,953 | 8 | ISO/IEC 8859-1 |
| Kanji/kana | 1,817 | 13 | Shift JIS X 0208 |
Here are some samples of QR codes:
* Version 1 (21×21). Content: "Ver1"
* Version 2 (25×25). Content: "Version 2"
* Version 3 (29×29). Content: "Version 3 QR Code"
* Version 4 (33×33). Content: "Version 4 QR Code, up to 50 char"
* Version 10 (57×57). Content: "VERSION 10 QR CODE, UP TO 174 CHAR AT H LEVEL, WITH 57X57 MODULES AND PLENTY OF ERROR CORRECTION TO GO AROUND. NOTE THAT THERE ARE ADDITIONAL TRACKING BOXES" (actually encoded in all capital letters). (Tracking boxes are more commonly called alignment patterns.)
* Version 25 (117×117). Content: 1,269 characters of ASCII text describing QR codes
* Version 40 (177×177). Content: "Version 40 QR Code can contain up to 1852 chars ..." (and followed by four paragraphs of ASCII text describing QR codes). The text refers to a QR Code with a "Level H" error correction. Other levels provide higher capacity.

### Error correction

QR codes use Reed–Solomon error correction over the finite field $\mathbb {F} _{256}$ or GF(2$^8$), the elements of which are encoded as bytes of 8 bits; the byte $b_{7}b_{6}b_{5}b_{4}b_{3}b_{2}b_{1}b_{0}$ with a standard numerical value $\textstyle \sum _{i=0}^{7}b_{i}2^{i}$ encodes the field element $\textstyle \sum _{i=0}^{7}b_{i}\alpha ^{i}$ where $\alpha \in \mathbb {F} _{256}$ is taken to be a primitive element satisfying $\alpha ^{8}+\alpha ^{4}+\alpha ^{3}+\alpha ^{2}+1=0$. The primitive polynomial is $x^{8}+x^{4}+x^{3}+x^{2}+1$, corresponding to the polynomial number 285, with initial root = 0 to obtain generator polynomials.
The Reed–Solomon code uses one of 37 different polynomials over $\mathbb {F} _{256}$, with degrees ranging from 7 to 68, depending on how many error correction bytes the code adds. It is implied by the form of Reed–Solomon used (systematic BCH view) that these polynomials are all on the form ∏$_{i=0}$$^{n−1}$(x−α$^i$){\textstyle \prod _{i=0}^{n-1}(x-\alpha ^{i})}. However, the rules for selecting the degree $n$ are specific to the QR standard.
For example, the generator polynomial used for the Version 1 QR code (21×21), when 7 error correction bytes are used, is: $g(x)=x^{7}+\alpha ^{87}x^{6}+\alpha ^{229}x^{5}+\alpha ^{146}x^{4}+\alpha ^{149}x^{3}+\alpha ^{238}x^{2}+\alpha ^{102}x+\alpha ^{21}$.
This is obtained by multiplying the first seven terms: $g(x)=(x+1)(x+\alpha )(x+\alpha ^{2})(x+\alpha ^{3})(x+\alpha ^{4})(x+\alpha ^{5})(x+\alpha ^{6})$.
The same may also be expressed using decimal coefficients (over $\mathbb {F} _{256}$), as: $g(x)=x^{7}+127x^{6}+122x^{5}+154x^{4}+164x^{3}+11x^{2}+68x+117$.
The highest power of $x$ in the polynomial (the degree $n$, of the polynomial) determines the number of error correction bytes. In this case, the degree is 7.
When discussing the Reed–Solomon code phase there is some risk for confusion, in that the QR ISO/IEC standard uses the term codeword for the elements of $\mathbb {F} _{256}$, which with respect to the Reed–Solomon code are symbols, whereas it uses the term block for what with respect to the Reed–Solomon code are the codewords. The number of data versus error correction bytes within each block depends on (i) the version (side length) of the QR symbol and (ii) the error correction level, of which there are four. The higher the error correction level, the less storage capacity. The following table lists the approximate error correction capability at each of the four levels:
| Level L (Low) | 7% of data bytes can be restored. |
| Level M (Medium) | 15% of data bytes can be restored. |
| Level Q (Quartile) | 25% of data bytes can be restored. |
| Level H (High) | 30% of data bytes can be restored. |
In larger QR symbols, the message is broken up into several Reed–Solomon code blocks. The block size is chosen so that no attempt is made at correcting more than 15 errors per block; this limits the complexity of the decoding algorithm. The code blocks are then interleaved together, making it less likely that localized damage to a QR symbol will overwhelm the capacity of any single block.
The Version 1 QR symbol with level L error correction, for example, consists of a single error correction block with a total of 26 code bytes (made of 19 message bytes and seven error correction bytes). It can correct up to 2 byte errors. Hence, this code is known as a (26,19,2) error correction code over GF(2$^8$) . It is also sometimes represented in short, as (26,19) code.
Due to error correction, it is possible to create artistic QR codes with embellishments to make them more readable or attractive to the human eye, and to incorporate colors, logos, and other features into the QR code block; the embellishments are treated as errors, but the codes still scan correctly.
It is also possible to design artistic QR codes without reducing the error correction capacity by manipulating the underlying mathematical constructs. Image processing algorithms are also used to reduce errors in QR-code.

### Encoding
#### Format information and masking

The format information records two things: the error correction level and the mask pattern used for the symbol. Masking is used to break up patterns in the data area that might confuse a scanner, such as large blank areas or misleading features that look like the locator marks. The mask patterns are defined on a grid that is repeated as necessary to cover the whole symbol. Modules corresponding to the dark areas of the mask are inverted. The 5-bit format information is protected from errors with a BCH code, and two complete copies are included in each QR symbol. A (15,5) triple error-correcting BCH code over GF(2$^4$) is used, having the generator polynomial $g(x)=x^{10}+x^{8}+x^{5}+x^{4}+x^{2}+x+1$. It can correct at most 3 bit-errors out of the 5 data bits. There are a total of 15 bits in this BCH code (10 bits are added for error correction). This 15-bit code is itself X-ORed with a fixed 15-bit mask pattern (101010000010010) to prevent an all-zero string.

#### Error correction bytes

To obtain the error correction (EC) bytes for a message "www.wikipedia.org", the following procedure may be carried out:
The message is 17 bytes long, hence it can be encoded using a (26,19,2) Reed-Solomon code to fit in a Ver1 (21×21) symbol, which has a maximum capacity of 19 bytes (for L level error correction).
The generator polynomial specified for the (26,19,2) code, is: $g(x)=x^{7}+127x^{6}+122x^{5}+154x^{4}+164x^{3}+11x^{2}+68x+117$, which may also be written in the form of a matrix of decimal coefficients:
The 17-byte long message "www.wikipedia.org" as hexadecimal coefficients (ASCII values), denoted by M1 through M17 is:
The encoding mode is "Byte encoding". Hence the 'Enc' field is [0100] (4 bits). The length of the above message is 17 bytes hence 'Len' field is [00010001] (8 bits). The 'End' field is End of message marker [0000] (4 bits).
The message code word (without EC bytes) is of the form:
Substituting the hexadecimal values, it can be expressed as:
This is rearranged as 19-byte blocks of 8 bits each:
Using the procedure for Reed-Solomon systematic encoding, the 7 EC bytes obtained (E1 through E7, as shown in the symbol) which are the coefficients (in decimal) of the remainder after polynomial division are:
or in hexadecimal values:
These 7 EC bytes are then appended to the 19-byte message. The resulting coded message has 26 bytes (in hexadecimal):
Note: The bit values shown in the Ver1 QR symbol below do not match with the above values, as the symbol has been masked using a mask pattern (001).

#### Message placement

The message dataset is placed from right to left in a zigzag pattern, as shown below. In larger symbols, this is complicated by the presence of the alignment patterns and the use of multiple interleaved error-correction blocks.
* Meaning of format information. In the above figure, the format information is protected by a (15,5) BCH code, which can correct up to 3 bit errors. The total length of the code is 15 bits, of which 5 are data bits (2 EC level + 3 mask pattern) and 10 are extra bits for error correction. The format mask pattern for these 15 bits is: [101010000010010]. Note that we map the masked values directly to its meaning here, in contrast to image 4 "Levels & Masks" where the mask pattern numbers are the result of putting the 3rd to 5th mask bit, [101], over the 3rd to 5th format info bit of the QR code.
* Message placement within a Ver 1 QR symbol (21×21). The message is encoded using a (255,248) Reed Solomon code (shortened to (26,19) code by using "padding") that can correct up to 2 byte-errors. A total of 26 code-words consist of 7 error-correction bytes, and 17 data bytes, in addition to the "Len" (8 bit field), "Enc" (4 bit field), and "End" (4 bit field). The symbol is capable of level L error correction. The EC level is 01(L), and mask pattern is 001. Hence the first 5 bits of the format information are 01001 (without the format mask). After masking, the 5 bits become 11100, as seen here.
* Larger symbol (Ver 3, 29×29) illustrating interleaved blocks. The message has 26 data bytes and is encoded using two Reed-Solomon code blocks. Each block is a (255,233) Reed Solomon code (shortened to (35,13) code), which can correct up to 11 byte-errors in a single burst, containing 13 data bytes and 22 "parity" bytes appended to the data bytes. The two 35-byte Reed-Solomon code blocks are interleaved (resulting in a total of 70 code bytes), so it can correct up to 22 byte-errors. The symbol achieves level H error correction.
The general structure of a QR encoding is as a sequence of 4 bit indicators with payload length dependent on the indicator mode (e.g. byte encoding payload length is dependent on the first byte).
| Mode indicator | Description | Typical structure '[ type : sizes in bits ]' |
| 1 = 0b0001 | Numeric | [0001 : 4] [ Character Count Indicator : variable ] [ Data Bit Stream : 31⁄3 × charcount ] |
| 2 = 0b0010 | Alphanumeric | [0010 : 4] [ Character Count Indicator : variable ] [ Data Bit Stream : 51⁄2 × charcount ] |
| 4 = 0b0100 | Byte encoding | [0100 : 4] [ Character Count Indicator : variable ] [ Data Bit Stream : 8 × charcount ] |
| 8 = 0b1000 | Kanji encoding | [1000 : 4] [ Character Count Indicator : variable ] [ Data Bit Stream : 13 × charcount ] |
| 3 = 0b0011 | Structured append | [0011 : 4] [ Symbol Position : 4 ] [ Total Symbols: 4 ] [ Parity : 8 ] |
| 7 = 0b0111 | ECI | [0111 : 4] [ ECI Assignment number : variable ] |
| 5 = 0b0101 | FNC1 in first position | [0101 : 4] [ Numeric/Alphanumeric/Byte/Kanji payload : variable ] |
| 9 = 0b1001 | FNC1 in second position | [1001 : 4] [ Application Indicator : 8 ] [ Numeric/Alphanumeric/Byte/Kanji payload : variable ] |
| 0 = 0b0000 | End of message | [0000 : 4] |
Four-bit indicators are used to select the encoding mode and convey other information.
Encoding modes :
| Indicator | Meaning |
| 0001 | Numeric encoding (10 bits per 3 digits) |
| 0010 | Alphanumeric encoding (11 bits per 2 characters) |
| 0100 | Byte encoding (8 bits per character) |
| 1000 | Kanji encoding (13 bits per character) |
| 0011 | Structured append (used to split a message across multiple QR symbols) |
| 0111 | Extended Channel Interpretation (select alternate character set or encoding) |
| 0101 | FNC1 in first position (see Code 128 for more information) |
| 1001 | FNC1 in second position |
| 0000 | End of message (Terminator) |
Encoding modes can be mixed as needed within a QR symbol. (e.g., a url with a long string of alphanumeric characters )
After every indicator that selects an encoding mode is a length field that tells how many characters are encoded in that mode. The number of bits in the length field depends on the encoding and the symbol version.
Number of bits in a length field (Character Count Indicator) :
| Encoding | Ver. 1–9 | 10–26 | 27–40 |
| Numeric | 10 | 12 | 14 |
| Alphanumeric | 9 | 11 | 13 |
| Byte | 8 | 16 | 16 |
| Kanji | 8 | 10 | 12 |
Alphanumeric encoding mode stores a message more compactly than the byte mode can, but cannot store lower-case letters and has only a limited selection of punctuation marks, which are sufficient for rudimentary web addresses. Two characters are coded in an 11-bit value by this formula:
    V = 45 × C$_1$ + C$_2$
This has the exception that the last character in an alphanumeric string with an odd length is read as a 6-bit value instead.
Alphanumeric character codes :
| Code | Character | Code | Character | Code | Character | Code | Character | Code | Character |
| 00 | 0 | 09 | 9 | 18 | I | 27 | R | 36 | Space |
| 01 | 1 | 10 | A | 19 | J | 28 | S | 37 | $ |
| 02 | 2 | 11 | B | 20 | K | 29 | T | 38 | % |
| 03 | 3 | 12 | C | 21 | L | 30 | U | 39 | * |
| 04 | 4 | 13 | D | 22 | M | 31 | V | 40 | + |
| 05 | 5 | 14 | E | 23 | N | 32 | W | 41 | - |
| 06 | 6 | 15 | F | 24 | O | 33 | X | 42 | . |
| 07 | 7 | 16 | G | 25 | P | 34 | Y | 43 | / |
| 08 | 8 | 17 | H | 26 | Q | 35 | Z | 44 | : |

### Decoding example

The following images offer more information about the QR code.
* 1 – Introduction
* 2 – Structure
* 3 – Layout & Encoding
* 4 – Levels & Masks
* 5 – Protocols

## Variants
### Model 1

Model 1 QR code is an older version of the specification. It is visually similar to the widely seen model 2 codes, but lacks alignment patterns. Differences are in the bottom right corner, and in the midsections of the bottom and right edges are additional functional regions.
* Model 1 QR code example
* Model 1 QR code functional regions

### Micro QR code

Micro QR code is a smaller version of the QR code standard for applications where symbol size is limited. There are four different versions (sizes) of Micro QR codes: the smallest is 11×11 modules; the largest can hold 35 numeric characters, or 21 ASCII alphanumeric characters, or 15 bytes (128 bits).
* Micro QR code example
* Micro QR code functional regions

### Rectangular Micro QR Code

Rectangular Micro QR Code (also known as rMQR Code) is a two-dimensional (2D) matrix barcode invented and standardized in 2022 by Denso Wave as ISO/IEC 23941. rMQR Code is designed as a rectangular variation of the QR code and has the same parameters and applications as original QR codes; however, rMQR Code is more suitable for rectangular areas, and has a difference between width and height up to 19 in the R7x139 version.
* Rectangular Micro QR Code (rMQR Code) example

### iQR code

iQR code is an alternative to existing square QR codes developed by Denso Wave. iQR codes can be created in square or rectangular formations; this is intended for situations where a longer and narrower rectangular shape is more suitable, such as on cylindrical objects. iQR codes can fit the same amount of information in 30% less space. There are 61 versions of square iQR codes, and 15 versions of rectangular codes. For squares, the minimum size is 9 × 9 modules; rectangles have a minimum of 19 × 5 modules. iQR codes add error correction level S, which allows for 50% error correction. iQR Codes had not been given an ISO/IEC specification as of 2015, and only proprietary Denso Wave products could create or read iQR codes.
* iQR code example

### Secure QR code

Secure Quick Response (SQR) code is a QR code that contains a "private data" segment after the terminator instead of the specified filler bytes "ec 11". This private data segment must be deciphered with an encryption key. This can be used to store private information and to manage a company's internal information.

### Frame QR

Frame QR is a QR code with a "canvas area" that can be flexibly used. In the center of this code is the canvas area, where graphics, letters, and more can be flexibly arranged, making it possible to lay out the code without losing the design of illustrations, photos, etc.

### HCC2D

Researchers have proposed a new High Capacity Colored 2-Dimensional (HCC2D) Code, which builds upon a QR code basis for preserving the QR robustness to distortions and uses colors for increasing data density (as of 2014 it is still in the prototyping phase). The HCC2D code specification is described in details in Querini et al. (2011), while techniques for color classification of HCC2D code cells are described in detail in Querini and Italiano (2014), which is an extended version of Querini and Italiano (2013).
Introducing colors into QR codes requires addressing additional issues. In particular, during QR code reading only the brightness information is taken into account, while HCC2D codes have to cope with chromatic distortions during the decoding phase. In order to ensure adaptation to chromatic distortions that arise in each scanned code, HCC2D codes make use of an additional field: the Color Palette Pattern. This is because color cells of a Color Palette Pattern are supposed to be distorted in the same way as color cells of the Encoding Region. Replicated color palettes are used for training machine-learning classifiers.

### AQR

Accessible QR is a type of QR code that combines a standard QR code with a dot-dash pattern positioned around one corner of the code to provide product information for people who are blind and partially sighted. The codes, announce product categories and product details such as instructions, ingredients, safety warnings, and recycling information. The data is structured for the needs of users who are blind or partially sighted and offers larger text or audio output. It can read QR codes from a metre away, activating the smartphone's accessibility features like VoiceOver to announce product details.

## License

The use of QR code technology is freely licensed as long as users follow the standards for QR code documented with JIS or ISO/IEC. Non-standardized codes may require special licensing.
Denso Wave owns a number of patents on QR code technology, but has chosen to exercise them in a limited fashion. In order to promote widespread usage of the technology Denso Wave chose to waive its rights to a key patent in its possession for standardized codes only. In the US, the granted QR code patent is 5726435, and in Japan 2938338, both of which have expired. The European Patent Office granted patent 0672994 to Denso Wave, which was then validated into French, UK, and German patents, all of which expired in March 2015.
The text QR Code itself is a registered trademark and wordmark of Denso Wave Incorporated. In UK, the trademark is registered as E921775, the term QR Code, with a filing date of 3 September 1998. The UK version of the trademark is based on the Kabushiki Kaisha Denso (DENSO CORPORATION) trademark, filed as Trademark 000921775, the term QR Code, on 3 September 1998 and registered on 16 December 1999 with the European Union OHIM (Office for Harmonization in the Internal Market). The U.S. Trademark for the term QR Code is Trademark 2435991 and was filed on 29 September 1998 with an amended registration date of 13 March 2001, assigned to Denso Corporation. In South Korea, trademark application filed on 18 November 2011 was refused at 20 March 2012, because the Korean Intellectual Property Office viewed that the phrase was genericized among South Korean people to refer to matrix barcodes in general.

## Risks

The only context in which common QR codes can carry executable data is the URL data type. These URLs may host JavaScript code, which can be used to exploit vulnerabilities in applications on the host system, such as the reader, the web browser, or the image viewer, since a reader will typically send the data to the application associated with the data type used by the QR code.
In the case of no software exploits, malicious QR codes combined with a permissive reader can still put a computer's contents and user's privacy at risk. This practice is known as "attagging", a portmanteau of "attack tagging". They are easily created and can be affixed over legitimate QR codes. On a smartphone, the reader's permissions may allow use of the camera, full Internet access, read/write contact data, GPS, read browser history, read/write local storage, and global system changes.
Risks include linking to dangerous web sites with browser exploits, enabling the microphone/camera/GPS, and then streaming those feeds to a remote server, analysis of sensitive data (passwords, files, contacts, transactions), and sending email/SMS/IM messages or packets for DDoS as part of a botnet, corrupting privacy settings, stealing identity, and even containing malicious logic themselves such as JavaScript or a virus. These actions could occur in the background while the user is only seeing the reader opening a seemingly harmless web page. In Russia, a malicious QR code caused phones that scanned it to send premium texts at a fee of $6 each. QR codes have also been linked to scams in which stickers are placed on parking meters and other devices, posing as quick payment options, as seen in Austin, San Antonio and Boston, among other cities across the United States and Australia.