How Do QR Codes Work? 2D Barcodes Explained

By: Jonathan Atteberry & Austin Henderson  | 
A woman holds a card with a QR code for a man to scan so he can pay for his coffee
Compared to their low-tech 1D predecessors, 2D bar codes can hold mountains of information. Today, we use QR Codes to view restaurant menus, conduct payment transactions and more. wera Rodsawang / Getty Images

You can find UPC codes on practically every product on the shelves. Like all bar codes, UPC codes provide anyone with a bar code scanner instantaneous access to the data that a bar code contains.

Like all of the first bar code formats, UPC codes were 1D, meaning they only carried information in one direction. Those worked fine for carrying small amounts of data like numeric product codes, but the need for a bar code capable of carrying more data became apparent.

Advertisement

That's where 2D bar codes, or QR codes, come in. But how do QR codes work?

The Transition to Stacked and 2D Bar Codes

One solution still used today is the stacked bar code, which, as the name implies, contain a number of 1D codes piled one on top of another. Although stacked bar codes can accommodate more information than their traditional 1D counterparts, they can quickly grow very large in order to store more data and can be difficult to read.

In order to have a bar code that was small in size, easy to read and capable of holding both a large amount of data and a large variety of character types, the market called for a new approach.

Advertisement

Enter: 2D bar codes.

As you might have guessed, 2D bar codes (sometimes called matrix codes) carry information in two directions: vertically and horizontally.

2D bar codes are capable of holding tens and even hundreds of times as much information as 1D bar codes. For instance, one of the most popular 2D bar code formats, Denso Wave's QR Code, can hold more than 7,000 digits or 4,000 characters of text, whereas even the most complex 1D codes top out around 20 characters.

Still, 2D codes aren't perfect for every application. Because they're more complex than 1D codes, they require more powerful scanners to decode.

What's more, some people are simply unfamiliar with the technology, which slowed widespread adoption. But thanks to the smartphone in your pocket, that is quickly changing.

Advertisement

2D Bar Code Generators and Scanners

Diagram of a 2-D bar code
HowStuffWorks.com

The Adoption Challenge: UPC Codes vs. 2D Bar Codes

When the now-ubiquitous UPC code first started making waves in the 1970s, retailers everywhere immediately recognized its potential. Unfortunately, the technology faced something of a catch-22.

Retailers refused to buy the expensive scanners needed to read the codes until manufacturers began putting UPC codes on all of their products. Manufacturers meanwhile stonewalled on adopting them until they knew retailers could read the codes [source: Rawsthorne]. Eventually, large retailers like Kmart jumped in to kick-start the technology.

Advertisement

Fortunately for proponents of 2D bar codes, we buy millions of scanners every year in the form of our smartphones. The iPhone and Android each comes with a built in QR Code scanner, helping to clear perhaps the largest hurdle to widespread adoption.

Advertisement

Decoding QR Code Technology

But how does a smartphone — or any bar code scanner, for that matter — actually make sense of the seemingly unintelligible patterns of lines and squares that 2D bar codes contain? Part of the answer lies in the bar code itself, which is designed to make the scanning process as accurate and speedy as possible.

Alignment and Data

Every QR Code contains a finder pattern: an arrangement of squares that helps the QR scanner detect the size of the QR Code, the direction it's facing and even the angle at which the code is being scanned.

Advertisement

Next, every QR Code contains an alignment pattern, which is another pattern of squares designed to help a QR reader determine if the 2D bar code is distorted (perhaps it's placed on a round surface, for instance).

Once the smartphone's camera processes the code's image, the software goes to work analyzing the image. By calculating the ratio between the black and white areas of the QR Code image, it can quickly identify which squares are part of the alignment patterns and which squares contain actual data.

Allowing for Imperfection

Of course, QR Code scanning has a margin for error. Even if part of the pattern is smudged or obscured, you can still scan QR Codes with a QR Code reader.

Using built-in patterns and error correction of the QR Code system, the software can also compensate for any distortion or obscured areas of the bar code. After the software has digitally "reconstructed" the QR Code, it examines the jumble of black and white squares in the QR Code's data section and outputs the data contained within.

How to Create QR Codes

You can make your own 2D bar code using QR Code generators online. They let you generate QR codes and adjust everything from the format you want to use to the size of the code.

So the next time you're putting up a flyer for your local garage sale, consider using a QR Code generator to add a code with the sale details. Who knows how many smartphone-carrying bargain hunters you might attract?

Scan Smart

On the flip side, you don't want to accidentally scan a malicious QR Code created to steal data stored on your device. Certain apps and scanners will check to make sure you're only able to open legitimate QR Codes, providing a comforting level of added security.

Advertisement

Variety in 2D Bar Codes

The QR Code is only one example of a 2D bar code. The shipping company UPS uses a format called MaxiCode, which workers scan quickly as packages fly down the conveyor belt, whereas the U.S. Department of Defense has adopted DataMatrix — a 2D bar code capable of holding a lot of information in a very small area.

Regardless of the format, 2D bar codes contain both data and built-in patterns to help the scanner decode the information each bar code contains. In many cases, one device can read a variety of different formats, even traditional 1D bar codes.

Advertisement

2D Bar Code Advertising

If you can think of a way to sell a product, it's probably been done.

Blimps with giant company logos, televisions inside taxis that stream ads to passengers and even advertisements printed in edible ink on food — nothing is off-limits from advertisers. But even they have long faced a difficult challenge as they try to determine the effectiveness of their physical ads.

Advertisement

That all changed with 2D bar codes. For the first time, companies could simply add a 2D bar code to their advertisement and directly track how many times consumers scanned the code. If someone scans it, the advertisers can track whether that person then visits the company's website or purchases a particular product.

Real-World Applications

The fashion company Tommy Bahama added a 2D bar code into Esquire Magazine that, when scanned, took readers directly to a web page featuring the pair of sunglasses shown in the magazine ad. With one click of their mouse (or tap on their smartphone screens), readers could then buy the sunglasses for a cool $138.

Target has also explored the capabilities of 2D bar codes by adding dynamic QR codes to its magazine advertisements. When curious readers scan a QR code, Target serves them a video from a famous interior designer explaining how to use the product.

Future of 2D Bar Codes in Advertising

Advertisers say this level of interactivity is perfect for a new generation of tech-savvy consumers who want instantaneous access to product information, reviews and more. The codes have become such a popular way to advertise in Japan, they're even found on billboards where they can be scanned at highway speeds from a passing car.

Currently, the codes aren't quite as popular in the United States as they are in Japan, so data on just how many advertisers are using them and what sort of results they get is hard to come by. Still, as more people purchase smartphones and learn about the capabilities of scanning QR Codes, 2D bar codes may take off much like their 1D predecessors.

This article was updated in conjunction with AI technology, then fact-checked and edited by a HowStuffWorks editor.

Advertisement

Lots More Information

Related Articles

  • Collins, Nick. "Bar code: invention history behind new Google doodle." The Telegraph. March 20, 2011. (March 18, 2011) http://www.telegraph.co.uk/technology/google/6268827/Bar-code-invention-history-behind-new-Google-doodle.html
  • Denso Wave. "About 2D Code." (March 18, 2011) http://www.denso-wave.com/qrcode/aboutqr-e.html
  • Denso Wave. "What is a bar code?" (March 18, 2011) http://www.denso-wave.com/en/adcd/fundamental/barcode/index.html
  • Harnick, Chris. "Esquire uses 2D bar codes within magazine for mobile commerce." Mobile Commerce Daily. Feb. 4, 2010. (March 18, 2011) http://www.mobilecommercedaily.com/2010/02/04/esquire-uses-2d-bar-codes-within-magazine-for-mobile-commerce
  • Haselton, Todd. "German man programs 'Hello World' into wheat field." Ars Technica. June 11, 2007. (March 18, 2011) http://arstechnica.com/gaming/news/2007/06/german-programmer-programs-hello-world-into-wheat-field.ars
  • Kats, Rimma. "Tommy Bahama print ad sells sunglasses via click-to-buy QR Code." Mobile Commerce Daily. Sept. 27, 2010. (March 18, 2011) http://www.mobilemarketer.com/cms/news/advertising/9191.html
  • Mobile Marketer. "Target implements QR codes in print ads to engage readers." Feb. 25, 2011. (March 18, 2011) http://www.mobilemarketer.com/cms/news/advertising/9191.html
  • QRMe. "Understanding a QR Code." (March 18, 2011)http://www.qrme.co.uk/qr-code-resources/understanding-a-qr-code.html
  • QRMe. "QR Codes Explained." (March 18, 2011) http://www.qrme.co.uk/qr-codes-explained.html
  • QR Code. "QR Code Standardization." (March 18, 2011)http://www.qrcode.com/qrstandard-e.html
  • Rawsthorne, Alice. "Scan Artists." The New York Times. Feb. 23, 2010. (March 18, 2011) http://www.nytimes.com/2010/02/28/t-magazine/womens-fashion/28talk-rawsthorn.html
  • Schonfeld, Erick. "See That Funny 2D Barcode In The Store Window? It Might Pull Up A Google Listing." TechCrunch. Dec. 6, 2009. (March 18, 2011) http://techcrunch.com/2009/12/06/google-local-maps-qr-code/
  • Story, Louise. "New Bar Codes Can Talk With Your Cellphone." The New York Times. April 1, 2007. (March 18, 2011) http://www.nytimes.com/2007/04/01/business/01code.html?_r=2
  • Synthesis Journal. "QR Code." 2008. (March 18, 2011) http://qrbcn.com/imatgesbloc/Three_QR_Code.pdf

Advertisement

Loading...