Barcode BasicsHow it works

What Is a Barcode and How Does It Work?

Follow a barcode from its printed pattern to the decoded data and a database result, with a UPC-A example and common scanning questions.

Share
Table of contents

A barcode is a machine-readable pattern that represents data. A scanner captures the pattern, a decoder interprets it using the rules for that barcode type, and an application uses the resulting data. For a typical retail UPC, that data identifies a product; the checkout system can then look up its description and price in a database. The pattern, the number read from it, and the information found using that number are three different things.[1][2]

From a printed symbol to a result

  1. A barcode carries data. A linear barcode uses bars and spaces; a two-dimensional (2D) barcode uses a pattern arranged in two dimensions. Different symbologies have different rules for encoding and reading their data.[1]
  2. A scanner captures the pattern. Depending on the device, it may measure reflected light or capture an image. The reader needs sufficient contrast and a clear view of the symbol.[3]
  3. A decoder returns data. The result could be a number, text or other data, depending on what was encoded and the symbology. The application receives that result.[2]
  4. An application decides what to do. A store may use a product identifier to find a description and price in its own system. A QR code may contain a web address instead. The result depends on both the encoded data and the application handling it.

For example, if the scanner reads a product number but the store has no matching record, the barcode may have decoded successfully even though the lookup failed. Check the returned value and the correct database before assuming the symbol is damaged.

A UPC-A example: bars, digits and the lookup

GS1’s published UPC-A example displays the digits 0 12345 00005 8, which together make 012345000058.[4] Its structure illustrates the distinction:

  • The bars and spaces form the machine-readable symbol. Clear areas called quiet zones sit outside the left and right ends. Guard patterns mark the ends and center of this UPC-A symbol.[4]
  • The printed digits, including the smaller outer digits, are the human-readable number. Copy all 12 digits, including the initial zero and final check digit.
  • A product record, if one exists in the system being searched, is separate from those printed digits. It could contain details such as a description or price.

This is a standards example, not a product lookup or a test scan performed for this article. A check digit helps check the structure of a number; it does not prove that a product is genuine or that a particular database has the correct record.

What information can a barcode contain?

It depends on the type and the data chosen by its issuer. A UPC-A retail symbol carries a GTIN-12 product identifier. That identifier is used to retrieve associated information; it does not by itself tell you the current price in every store.[4] Other barcode applications can encode additional fields. For example, GS1 describes certain 2D and linear formats that can carry batch or expiration information using application identifiers.[1]

A barcode does not automatically reveal a product’s origin, ownership or authenticity. Check the appropriate source for the question you are trying to answer. If a number produces no result in one app, try the relevant issuer or system rather than changing the number.

Linear and 2D barcodes

A linear barcode presents data in a pattern read across one dimension. UPC-A on retail packaging is one example. A 2D barcode uses a two-dimensional pattern; QR Code and Data Matrix are examples. A camera-based reader may support both, but the formats a particular scanner can read depend on its hardware and settings.[1][3]

The symbol and data rules matter more than the shape alone. A code on a ticket, a shipping label and a retail item may require different applications or receiving systems even if they can all be photographed.

What if a barcode will not scan?

Make sure the entire code is visible, clean and in focus. Adjust distance and angle to reduce glare; check that the reader supports the code type. If the scanner returns a value, compare it with the printed human-readable text or a trusted record. If it returns the expected value but the application has no record, investigate the lookup rather than repeatedly rescanning.

If a label is damaged or its digits are incomplete, do not guess the missing data. Ask the label issuer for the correct value or a replacement. A successful scan under one set of conditions is not a formal print-quality grade or proof that a trading partner will accept the label.

References

[1] GS1. What is a barcode? https://support.gs1.org/support/solutions/articles/43000734193-what-is-a-barcode-

[2] GS1. GS1 System Architecture, section 5.2.1, Generic AIDC Workflow Functions. https://www.gs1.org/docs/architecture/GS1_System_Architecture.pdf

[3] GS1 US. What Is a Barcode? https://www.gs1us.org/upcs-barcodes-prefixes/what-is-a-barcode

[4] GS1. GS1 General Specifications, Release 24.0, section 5.2.2.3 and Figure 5.2.2.3-1. https://ref.gs1.org/standards/genspecs/24.0.0/