What Is a Barcode and How Does It Work
A barcode is a pattern of lines, spaces, or squares that a machine can read. You have probably seen one on a packet of food, a book, a parcel, or a boarding pass. At a shop till, the cashier scans the barcode and the price appears on the screen. That moment can make a barcode look like a price tag, but it is not. A barcode is a label that carries an identifier, and the shop system looks up what that identifier means. This guide explains what a barcode is, how a scanner reads it, what the numbers mean, and where barcodes fall short.
What Is a Barcode?
In plain terms, a barcode is a machine-readable way to write a short piece of information. The most familiar form is the one-dimensional barcode, made of vertical black bars and white spaces of different widths. Another form is the two-dimensional barcode, such as a QR code, which stores information in a grid of squares. This article focuses mainly on the familiar line barcode you see on products, because that is the one most people meet in shops and warehouses. The key idea is simple: the pattern stands for characters, usually numbers, and a scanner turns that pattern back into those characters.
A barcode does not contain a description, a price, or a story about the product. It contains a code. The meaning of that code lives in a database somewhere else. When a shop scans a tin of beans, the scanner reads the code, the till system finds the matching product in its database, and it shows the name and price that the shop has stored for that code. If the shop has not entered the product, or if the price has not been updated, the scan will not magically fix that. The barcode is only the link between the physical item and the record about it.
How Does a Scanner Read the Lines?
A barcode scanner works by looking at light and dark. In a simple explanation, the scanner shines light onto the barcode and measures how much light comes back. White spaces reflect more light, and black bars reflect less. As the scanner moves across the code, or as the code moves past the scanner, it records a pattern of light and dark. It then turns the widths of the bars and spaces into numbers or letters using the rules of that barcode type. Those rules are called a symbology. Different symbologies use different rules, so a scanner must know which type it is reading, or be set to recognise several types.
Most modern scanners use a camera or a laser to capture the pattern, but the principle is the same: contrast matters. A barcode that is faded, torn, wrinkled, or printed with low contrast is harder to read. A barcode printed on a curved bottle, a shiny wrapper, or a crumpled parcel can also be harder to read, because the light reflects unevenly. That is why labels are usually printed on a flat, matte area with enough white space around the code. That white space, like the quiet zone around a QR code, helps the scanner find where the code starts and ends.
Once the scanner has read the characters, it sends them to a computer system, just as if someone had typed them. The system then does the useful work. In a shop, it looks up the price. In a warehouse, it may update stock, record that a parcel has arrived, or check that the right box is on the right shelf. In a library, it may link a book to a borrower record. The scanner itself does not know what the product is. It only reads the code accurately and quickly, without typing errors.
UPC and EAN: The Codes You See on Products
Two of the most common product barcode systems are UPC and EAN. UPC, which stands for Universal Product Code, is widely used in North America. EAN, which stands for European Article Number, is widely used in many other parts of the world, although the names and regions have become less strict over time as trade has become global. Both systems use a row of bars and a row of digits printed underneath. Those digits are there so a person can type the code if the scanner cannot read it.
A UPC barcode often has twelve digits. An EAN barcode often has thirteen digits. The digits are not random. In a typical product code, part of the number identifies the company or brand owner, and part identifies the specific product, such as a particular size or flavour. The final digit is usually a check digit. A check digit is calculated from the other digits using a set formula. It gives the scanner and the system a quick way to spot a misread. If one digit is read wrongly, the check digit will often not match, and the system can reject the scan or ask for it to be repeated. That does not make the code secure, but it does reduce simple reading errors.
It is important not to read too much into the digits. You cannot reliably tell the country of origin, the factory, or the exact ingredients from the barcode alone. Some digits may be assigned in blocks, and those blocks may change over time. The safest way to understand a product is to read the label, the ingredients list, and the information from the seller, not to decode the barcode by guessing what each digit means. A barcode is an identifier, not a description.
How to Read a Barcode in Practice
Step 1: Find the code and the printed digits
Look for the row of bars and the digits printed beneath them. If the bars are damaged, the printed digits are a useful backup. Keep the label flat and clean, and avoid covering the code with tape, a sticker, or a fold.
Step 2: Scan it or type the digits
Use a barcode scanner, a phone app that reads barcodes, or type the digits into the system you are using. If you are typing, check each digit twice, because a single wrong digit can point to a different product or to no product at all.
Step 3: Check what the system returns
Compare the name, size, and other details returned by the system with the physical item in front of you. If they do not match, do not assume the barcode is wrong and the system is right, or the other way round. Stop and check the label, the database entry, and the code again.
Step 4: Fix the record, not the barcode alone
If the price or description is wrong, the fix usually belongs in the database or price list, not in the barcode pattern. Changing the barcode without updating the record can create a new mismatch. In a small business, it helps to have one person responsible for keeping product records accurate.
Worked Example: A Small Shop and a Jar of Jam
Priya runs a small food shop. She sells a jar of strawberry jam made by a local producer. The jar has a printed barcode with thirteen digits. The digits are a fictional example for this guide: 890 1234 56789 0. In this example, the first part identifies the brand owner, the middle part identifies this specific jar of jam, and the final digit is the check digit. Priya does not need to memorise what each block means. She needs the barcode to link the jar to the correct record in her till system.
When Priya first stocks the jam, she creates a product record in her till system with the barcode number, the product name, the size, and the price. When a customer brings the jar to the till, the cashier scans the barcode. The scanner reads the digits, the till system finds the matching record, and it shows the jam and the price. The scan is faster and more accurate than typing a long product name. Later, if Priya changes the price, she updates the price in the till system. The barcode on the jar stays the same, because the barcode is not the price. It is the identifier that points to the record.
One day, a jar is scanned and the till shows a different flavour. Priya checks the jar and finds that two flavours share similar packaging. She checks the barcode digits on each jar and finds that the till record for one flavour was linked to the wrong barcode. She fixes the record, tests both jars again, and the correct names appear. The lesson is practical: a barcode system is only as good as the records behind it. The scan itself was correct. The lookup was wrong because the data entry was wrong.
A Barcode Is Not a Serial Number
It is easy to confuse a barcode with a serial number, but they are not the same. A product barcode usually identifies a type of product, not one single item. Every jar of the same jam, in the same size, will usually carry the same product barcode. A serial number, by contrast, is meant to identify one single item, such as one laptop, one appliance, or one parcel. A serial number is often printed separately from the product barcode, and it may be in a different format.
This distinction matters. If a shop scans a product barcode, it learns which product it is, not which individual jar was sold. If a shop needs to track one specific item, for warranty, for a recall, or for a repair, it needs a unique identifier for that item, such as a serial number or a unique parcel tracking number. A product barcode alone cannot tell you whether this jar was the one sold on Tuesday or the one sold on Friday. It can only tell you that it is that type of jam.
Some barcodes do carry unique numbers. Parcel tracking barcodes, boarding pass barcodes, and some asset labels are examples. In those cases, the code is designed to be unique to one parcel, one journey, or one asset. The difference is in how the system uses the code, not in the fact that it looks like lines. Always check what a barcode is meant to identify before you assume it is unique.
Limitations
Barcodes have clear limits. They can be damaged, faded, or hard to read on curved or shiny surfaces. They depend on a database or lookup system, so a scan is useless if the record is missing, outdated, or wrong. They do not carry much information on their own, and they do not prove that a product is genuine. A barcode can be copied, printed, and stuck onto a different product. It can also be misread if the wrong barcode type is assumed or if the printed digits are typed incorrectly. For these reasons, a barcode is a convenient identifier, not a form of proof.
Barcodes also have limits for tracking. A product barcode does not tell you where an item has been, who handled it, or whether it is still in date. Those facts need separate records, such as stock counts, delivery notes, expiry dates, and batch records. If a business needs to trace a batch of food, for example, it needs batch and date records as well as barcodes. The barcode can help link those records to the physical item, but it cannot replace them.
Do Not Rely on a Barcode for Security
Do not treat a barcode as a password, a ticket that cannot be copied, or proof that a product is authentic. A barcode is easy to photograph, copy, and reprint. A printed barcode on a ticket or a label can be shared, duplicated, or forged. If access, payment, or identity depends on a barcode alone, an attacker who copies the pattern can copy the access. For important checks, a barcode should be one part of a larger system, with a check against a live record, a time limit, an identity check, or another form of verification. In a shop, the till should check the price record. At an event, a ticket barcode should be checked against a list that marks it as used. For high-value goods, a barcode should not be the only proof of authenticity.
Frequently Asked Questions
Does a barcode contain the price?
No. A product barcode usually contains an identifier. The price is stored in the shop system and looked up when the code is scanned. That is why the same barcode can show a different price in different shops, or after a price change.
Can two different products have the same barcode?
They should not, if the system is managed correctly, but errors can happen. A data entry mistake, a reused code, or a copy of a label can cause two different products to share a code. If a scan returns the wrong product, check the record and the label rather than assuming the scanner is faulty.
Why does a scanner sometimes fail to read a barcode?
Common reasons include low contrast, damage, wrinkles, glare, a curved surface, a code that is too small, or a scanner that is too far away or too close. Try flattening the label, improving the light, cleaning the scanner window, and scanning at a normal distance.
Is a barcode the same as a QR code?
No. A traditional barcode stores information in lines and is usually read in one direction. A QR code stores information in a grid of squares and can hold more data, such as a web address or contact details. Both are machine-readable codes, but they use different formats and different rules.
Final Checklist
A barcode is a machine-readable identifier, not a price, a description, or a serial number. A scanner reads the pattern of light and dark, turns it into characters, and a system looks up what those characters mean. UPC and EAN codes identify products and include a check digit to catch simple errors. A barcode system works well when the labels are clear and the records behind them are accurate. It should not be trusted as proof of authenticity or as a security control on its own. If you remember that a barcode is a link to a record, not the record itself, you will use it more accurately and avoid the most common mistakes.
Try a Tool
Free, in your browser — no sign-up.
Related Articles
How to Share a Big File Without Email (the Simple Way)
Share a big file without email using a cloud link. Learn how to check size, set expiry, control access, and avoid sharing…
Read article →How to Name Your Files So You Can Find Them Later
Name files with date, project, and version so you can find them later: no spaces, one pattern every time, and do not…
Read article →How to Back Up Your Work Before You Format It
Before you format a drive, back up your work with the 3-2-1 rule, verify the backup, and keep a copy off-device so…
Read article →