SecLern
Blog · Video lessons · 3 min

Why a barcode still scans upside down

Why a barcode still scans upside down

By The SecLern Team · Dec 5, 2026

Transcript

Turn a pack of gum upside down. Drag it past the scanner, and it still beeps. How do stripes know which way up they are? Let's build one and find out. The first one was scanned in 1974, at a supermarket in Troy, Ohio. A ten-pack of Juicy Fruit gum, 67 cents. Now it happens about 10 billion times a day. A shop barcode, called a UPC, is just 12 digits. Say our gum gets 0, 12345, 67890. The first half names the company. The second half names the product. The last digit comes later. Now the stripes. Picture the code as 95 thin slots, each one either dark or light. Every digit gets exactly seven slots, drawn as two bars and two gaps. Here's a one: two light, two dark, two light, one dark. The taller bars at the start, middle and end are guards. They show the scanner how wide one slot is. So it reads every bar in slots, close up or far away. First, that last digit. Add the digits in odd positions, and multiply by three. Add the rest. For our gum, 60 plus 25 makes 85. The check digit tops that up to the next ten: five. Now a smudge turns the 7 into a 1. The total drops to 79, and 79 needs a check digit of one, not five. The scanner throws it away. No beep. The cashier scans again. Now, our upside-down question. Every digit on the left half has an odd number of dark slots. On the right half, digits are drawn in reverse colours, so they have an even number. Hold the pack upside down, and the scanner reads it from right to left. The first digit it meets is even. So it knows the code is backwards, and flips the answer. So the bars aren't a picture of the number. They're a code built to survive smudges and wrong-way-up packets. So remember it like this. Guards set the size. Odd and even give the direction. The check digit catches the mistakes. Want to learn how everyday tech works, hands-on? Try it free at seclern.com, and follow for more.

The SecLern TeamSecLern builds practice questions, performance-based questions and browser-based hands-on labs for IT certifications.