You are here: Home page > Communications > 2D barcodes

Aztec code used on a mobile phone train ticket.

QR Code® and 2D barcodes

From buying groceries to tracking a UPS delivery, barcodes make our lives easier in all kinds of ways—but they've been doing so now for decades. Originally patented in the 1940s, barcodes were commercially tested in the 1960s and gradually became ubiquitous in the 1980s. The basic idea has barely changed in all that time: just like in the 1960s, a barcode is still a zebra pattern of stripes with numbers written underneath that needs a special scanning device to decode it. But all that could change soon as the 2D barcode—a kind of second-generation barcode technology—slowly takes over. Let's take a closer look at how it works!

Photo: An Aztec code used on a mobile phone train ticket.

Sponsored links

Contents

  1. What are 2D barcodes?
  2. What are the advantages of 2D barcodes?
  3. What are the different kinds of 2D barcode technology?
  4. What information does a QR code contain?
  5. What is 2D barcode technology used for?
  6. How can you make a QR code?
  7. Find out more

What are 2D barcodes?

You might have already noticed odd black-and-white squares appearing on your parcels, letters, utility bills, T-shirts, product packaging, and in all kinds of other places— a bit like mini crossword puzzles without any letters. They're called two-dimensional (2D) barcodes and, just like ordinary barcodes, they're machine-readable so they can quickly pass on information about a product in the blink of an electronic eye. Where a barcode presents a string of information as a one-dimensional line of black and white bars, a 2D barcode packs a lot more information into a grid of black and white, square-shaped dots.

What are the advantages of 2D barcodes?

If we already have barcodes, why do need something else as well? 2D barcodes are a step further, with lots of advantages:

Example of a QR code being used to good effect on a promotional marketing leaflet.

Photo: It's a great idea to turn your website address (URL) into a QR Code® and put it on all your promotional material—from advertisments and leaflets to T-shirts and delivery vans. Here's a QR Code being used to good effect on a promotional leaflet from the Swanage Railway. If I want to find out more, all I have to do is point my cellphone at the leaflet and click. Be careful how you print the code: although there's some tolerance for bad printing, it still needs to be printed reasonably clearly and accurately or it won't work. So crisp laser printing is fine, but smudgy inkjet prints probably aren't. Always test the final, printed code with a QR Code reader to make sure it takes you where it should!

What are the different kinds of 2D barcode technology?

Examples of five different data matrix codes compared side by side: QR code, Aztec, Maxicode, Micro QR, and PDF417.

Artwork: Five examples of this website's URL encoded wholly or partly in different 2D barcodes: 1) QR Code 2) Aztec code 3) MaxiCode 4) Micro QR Code 5) PDF417.

To an untrained eye, 2D barcodes all look much the same. Look more closely, though, and you'll see they do vary quite a bit. There are actually several different types of 2D barcode, some available in the public domain and some that are still proprietary.

Here are some of the best known (though there are literally dozens of others):

"Data-matrix code" is the name of the international (ISO) standards covering 2D barcodes, but not all 2D barcodes comply with them (Semacode does; QR codes and Aztec codes are slightly different).

What information does a QR code contain?

By their very nature, QR codes (and other data matrix codes) are meant to be read by machines, not humans, so there's only a certain amount we can tell just by looking at them. Although each code is different, they contain a few interesting, common features. Looking again at the explainthatstuff.com QR code up above, we have:

A labelled diagram showing the key features of QR codes, including the finder, timing, and alignment patterns and data cells.

Artwork: Above: Some of the key features in a QR code. Below: Features like this ensure a code can be read at high speed even when it's viewed at an angle, smudged, printed on a curved surface, or distorted in various other ways.

  1. Quiet zone: An empty white border that makes it possible to isolate the code from among other printed information (for example, on a dirty envelope, among the black and white print of a newspaper, or on smudged product packaging).
  2. Finder patterns: Large black and white squares in three of the corners make it easy to confirm that this is a QR code (and not, say, an Aztec code). Since there are only three of them, it's immediately obvious which way up the code is and which angle it's pointing at (unless the code is partly obscured or damaged in some way).
  3. Alignment pattern: This ensures the code can be deciphered even if it's distorted (viewed at an angle, printed on a curved surface, and so on).
  4. Timing pattern: This runs horizontally and vertically between the three finder patterns and consists of alternate black and white squares. The timing pattern makes it easy to identify the individual data cells within a QR code and is especially useful when the code is damaged or distorted.
  5. Version information: There are various different versions of the QR code standard; the version information (positioned near two of the finder patterns) simply identifies which one is being used in a particular code.
  6. Data cells: Each individual black or white square that's not part of one of the standard features (the timing, alignment, and other patterns) contains some of the actual data in the code.

Further reading

There are a number of other features and complications that I won't go into here; if you'd like more detail, you'll find it by looking at these two excellent references:

Sponsored links

What is 2D barcode technology used for?

The American space agency NASA was one of the earliest organizations to make widespread use of data matrix codes, in the mid-1980s: it engraved them onto parts from space rockets, such as the Space Shuttle, because they didn't come off, like paper labels, and could store so much more information.

Space Shuttle part with data matrix code engraved on it.

Photo: A data matrix code being engraved onto a Space Shuttle part. Photo courtesy of NASA.

You can put a 2D barcode anywhere you can put a barcode (software for generating codes is easy to find online) and use it in very similar ways for tracking and tracing all kinds of objects. Cellphones with built-in 2D barcode readers are leading to other, more exciting applications. Advertisers who want you to find out more about their products online simply print a 2D barcode in the corner of their ads. Just point your cellphone at the code, scan it in, and your phone browser will automatically read the code, decode the Web address of the advertiser's site, and take you there instantly—no need to type in a tedious URL (website address) or anything like that. It's especially convenient for billboards, posters, and other ads you catch site of while you're on the move.

Data matrix codes on a Royal Mail Smart Stamp letter.

Photo: Do-it-yourself postal systems, such as Royal Mail's SmartStamp® (in the UK) and Deutsche Post's Stampit (in Germany), let you print your own franking labels on parcels without the bother of going to a post office. They print a 2D barcode on the postage label to validate it and protect against fraud. The code is read and checked when the mail passes through automated sorting equipment. This is an example of a data-matrix code made from four separate segments.

Transportation is another increasingly popular application. Numerous airline, railroad and bus companies let you buy travel tickets online in advance through an easy-to-use app and store them on your cellphone. Your phone displays the details on its screen as a 2D barcode code, which becomes your electronic ticket; at the check-in-desk or onboard your bus or train, you just wave your phone past a scanner to validate your journey. The big drawback here is obviously the risk of your phone running out of power, so make sure you charge it up before you depart.

A bus ticket from the UK with a printed QR code at the bottom.

Photo: Paper bus tickets now use QR codes to reduce fraud. This is a one-day ticket giving unlimited travel. Previously, you would have just shown your ticket to the driver, who simply glanced, nodded, and waved you through; it was quite easy for people to use old or fake tickets. With an embedded QR code, the ticket is validated by an optical reader, so the risk of fraud is greatly reduced.

During the 2020/2021 pandemic, QR codes also found a new lease of life in what you might call "contactless" contact tracing. People were asked to check into venues (such as hotels or nightclubs) by scanning QR codes on their phones using a contact tracing app. Those people could then be tracked down and contacted, if necessary, and asked to isolate to help stop the spread of the pandemic.

How can you make a QR code?

There are lots of online generators that will do it for you. Bitly's QR Code Generator has a really neat one that shows you the QR code forming as you type, so you can get a sense of how a QR code is built from the information it contains, how adding more information changes the pattern, and how a code that contains more information generally leads to a more visually intricate pattern. Try it for yourself!

Screenshot of QR code generator.

Artwork: Some QR code generators show how the code changes as you add more information.

Sponsored links

Don't want to read our articles? Try listening instead

If you'd rather listen to our articles than read them, please subscribe to our new podcast on Apple Podcasts, Spotify, Audible, Amazon, Podchaser, or your favorite podcast app, or listen below:

Find out more

On this website

Books

Articles

Patents

There's much more technical detail about how data-matrix codes and readers work in the following patents:

Photos

Please do NOT copy our articles onto blogs and other websites

Articles from this website are registered at the US Copyright Office. Copying or otherwise using registered works without permission, removing this or other copyright notices, and/or infringing related rights could make you liable to severe civil or criminal penalties.

Text copyright © Chris Woodford 2009, 2023. All rights reserved. Full copyright notice and terms of use.

QR Code, iQR Code, SQRC, and FrameQR are registered trademarks of Denso Wave Incorporated. Semacode is a trademark of Semacode Corporation.

Follow us

Rate this page

Please rate or give feedback on this page and I will make a donation to WaterAid.

Tell your friends

If you've enjoyed this website, please kindly tell your friends about us on your favorite social sites.

Press CTRL + D to bookmark this page for later, or email the link to a friend.

Cite this page

Woodford, Chris. (2009/2023) QR codes and 2D barcodes. Retrieved from https://www.explainthatstuff.com/how-data-matrix-codes-work.html. [Accessed (Insert date here)]

Bibtex

@misc{woodford_2FA, author = "Woodford, Chris", title = "QR codes and 2D barcodes", publisher = "Explain that Stuff", year = "2009", url = "https://www.explainthatstuff.com/how-data-matrix-codes-work.html", urldate = "2023-02-18" }

Can't find what you want? Search our site below

More to explore on our website...

Back to top