How Barcodes Work: A Comprehensive Explanation

Barcodes are everywhere—on almost every product you see in a store. They might look simple, but behind those black and white lines is a fascinating process that turns reflected light into vital product information. Let’s break down how barcodes work, step by step.
1. The Scanning Process
When you purchase an item, a barcode scanner (often using a laser) shines a beam over the barcode. The barcode is made up of 95 evenly spaced vertical columns. The scanner measures the amount of light each column reflects.
- Dark columns: Reflect very little light.
- Light columns: Reflect a lot of light.
Since computers understand only ones (1) and zeros (0), the scanner assigns:
- A 1 to columns that reflect little light.
- A 0 to columns that reflect a lot of light.
(This may seem reversed from what you’d expect, but it’s simply how the system was designed.)
An illustration of a barcode scanner emitting a laser to read a barcode.
2. Converting Light into Binary
As the scanner moves from left to right, it converts the pattern of reflected light into a long string of 95 digits—each being a 1 or a 0.
These 95 binary digits are then grouped into 15 sections:
- 12 sections: Represent the numbers printed below the barcode.
- 3 sections (Guard Bars): Act as markers to indicate where the barcode starts, ends, and where the left and right halves separate.
A schematic showing how reflected light from each column is converted into a binary sequence.
3. The Role of Guard Bars
The guard bars serve several essential functions:
- Defining the Barcode Boundaries: They let the computer know where the barcode begins and ends.
- Separating Digits: They mark where the six numbers on each side start and finish.
- Ensuring Correct Orientation:
- The left-hand side digits are encoded with an odd number of ones.
- The right-hand side digits always have an even number of ones.
This difference helps the system determine if the barcode has been scanned upside down. If it is, the computer can simply flip the numbers back into the correct order.
A diagram showing the structure of a barcode, highlighting the guard patterns and numeric sections.
4. Decoding the Product Information
Each section of the barcode conveys specific information:
- Barcode Type:
- The first digit (located outside the main barcode) tells us the barcode type:
0
for standard products,2
for weight items (like produce),3
for pharmacy items,5
for coupons.
- Manufacturer Code:
- The next five digits indicate who made the product. For example, a code might represent a company like the Campbell Soup Company.
- Product Code:
- The following five digits specify the particular product (e.g., a 10 and 3/4 ounce can of chicken noodle soup).
- Modulo Check Digit:
- The final digit on the right-hand side is used for error checking. It’s calculated using a specific formula to ensure that the barcode has been read correctly.
A detailed breakdown of a barcode showing the product type, manufacturer code, product code, and modulo check digit.
5. The Modulo Check: Error Checking
The modulo check digit is an extra layer of security to verify that the barcode has been accurately scanned. Here’s how it works:
- Add the Digits:
- Sum the digits in the odd-numbered positions.
- Sum the digits in the even-numbered positions.
- Multiply and Add:
- Multiply the sum of the odd-numbered digits by 3.
- Add this to the sum of the even-numbered digits.
- Calculate the Check Digit:
- Subtract the total from the next highest multiple of 10.
For example, if the total is 23, the next highest multiple of 10 is 30.
(30 – 23 = 7)
The resulting 7 is the modulo check digit.
A flowchart that illustrates the modulo check digit calculation process.
Conclusion
Barcodes efficiently convert a pattern of light and dark into a precise sequence of numbers using binary code, guard bars, and error-checking methods. From the moment a laser scans a product to the final modulo check, every step ensures that the correct information is captured and processed. Next time you see a barcode, you’ll know it’s more than just a series of lines—it’s a smart, error-resistant system that makes modern retail and inventory management possible.
Thank you for reading, and enjoy the next time you scan your favorite product at the store!
Note: The images used in this article are illustrative examples to help explain the underlying concepts of barcode technology.