How to Read and Decode Barcodes
How to read barcodes with a scanner or phone, what the digits under an EAN or UPC mean, how to check a check digit, and how to decode GS1-128 shipping labels.
By StylQR Editorial TeamPublished 5 min read

Table of contents
To read a barcode, point a barcode scanner or a scanning app at it: the device measures the widths of the bars and spaces, decodes them into characters, checks the check digit, and outputs the result. To read it yourself, use the digits printed below the bars. On an EAN-13 or UPC, they tell you the GS1 prefix, the company's number, the item number and the check digit.
Below are both routes: the tools, what the numbers mean, how to decode a GS1 shipping label by hand, and what to check when a code won't read.
How a scanner decodes a barcode
Every 1D scanner does roughly the same thing:
- Lights the code. A laser line or an LED illuminates the bars. Dark bars reflect little light; white spaces reflect a lot.
- Measures widths. A sensor turns the reflected light into a signal of highs and lows, and the decoder measures each bar and space in modules (multiples of the narrowest element).
- Finds the edges. The blank quiet zone and the start or guard pattern tell the decoder where the code begins and which symbology it is.
- Decodes characters. Each pattern of widths maps to a character in that symbology's table.
- Checks the result. It verifies the check digit. If it doesn't match, the scanner discards the read and tries again rather than reporting a wrong number.
- Sends the data. Most USB and Bluetooth scanners act as a keyboard: they type the decoded characters into whatever field has focus, followed by Enter.
The scanner types are covered in more depth in how supermarkets scan barcodes.
Tools for reading barcodes
- Handheld USB or Bluetooth scanner. Plug it in, open a spreadsheet or text editor, and scan. No software needed. Laser and linear-imager models read 1D codes only; 2D imagers read both 1D and 2D.
- Phone. Phone camera apps are built mainly around QR codes. For 1D barcodes on Android, Google Lens usually reads them; on iPhone and other phones, a barcode scanner app is the reliable choice. Results vary by phone and app.
- Webcam and software. Inventory and point-of-sale apps often include a camera scanner.
For QR codes, Data Matrix, PDF417 and Aztec codes, the StylQR QR code scanner reads them from your camera or a screenshot in the browser. It reads 2D codes, not 1D barcodes like EAN or Code 128.
Reading the digits on an EAN-13 or UPC
The digits under a retail barcode are the same data as the bars. Take 8906123456781:
| Digits | Part | What it tells you |
|---|---|---|
890 | GS1 prefix | Issued through GS1 India |
61234 (varies) | Rest of the company prefix | The brand that licensed the number |
5678 (varies) | Item reference | One specific product variant |
1 | Check digit | Confirms the other 12 were read correctly |
The split between company prefix and item reference varies by company, so you can't tell it from the number alone. The prefix shows which GS1 organization issued the number, not where the product was made. Special prefixes are worth knowing: 978 and 979 mean a book (ISBN), 977 a magazine or serial (ISSN), and numbers starting 02 or 20 to 29 are store-internal codes, often for weighed items.
A 12-digit UPC-A works the same way, minus the leading digit: 098765432105 is the GTIN 0098765432105. The UPC guide covers its parts.
Checking the check digit by hand
You can confirm a number is valid without a scanner. For EAN-13, multiply the first 12 digits alternately by 1 and 3, starting with 1, and add them up. For 890612345678 the total is 129. The check digit is whatever brings that up to the next multiple of 10: 130 − 129 = 1. If the printed last digit isn't 1, the number has a typo. The EAN-13 guide shows the full working.
Decoding the bars by eye
It's possible, if slow. EAN-13 and UPC digits each take 7 modules. On the left half, written as 1 for a dark module and 0 for light, a 0 is 0001101 and a 1 is 0011001. The right half uses the inverse, so a 0 there is 1110010. Guard patterns 101 at each end and 01010 in the middle mark the halves. Nobody reads barcodes like this in practice, but it shows why the quiet zone and clean bar edges matter: a decoder is counting modules, and a smudge of one module changes the digit.
Reading a GS1-128 shipping label
GS1-128 labels on cartons and pallets carry several pieces of data, each introduced by an Application Identifier (AI) in brackets. The brackets are printed in the text below the bars but aren't encoded in the bars themselves.
A line such as (01)18906123456788(17)271231(10)LOT42 reads as:
- (01) GTIN of the trade item:
18906123456788, a 14-digit carton number - (17) Expiry date in YYMMDD:
271231, so 31 December 2027 - (10) Batch or lot number:
LOT42
Other common AIs include (00) for an 18-digit SSCC pallet number, (11) production date, (15) best-before date, (21) serial number and (310x) net weight in kilograms, where x is the number of decimal places. GS1 Sweden's AI guide lists the most used ones, and what a GS1 barcode is explains how they're structured.
When a barcode won't read
Work through these before blaming the code:
- Symbology turned off. Many scanners ship with less common types disabled. Code 39 Full ASCII, Interleaved 2 of 5, EAN-8 and UPC-E are frequent culprits. The scanner's manual has setting barcodes to enable them.
- 2D code, 1D scanner. Laser and linear scanners can't read QR or Data Matrix codes at all.
- Missing quiet zone. Text or a border too close to the bars stops the scanner finding the edges.
- Low contrast or red bars. Red-light scanners see red as white.
- Too small or too dense for the scanner's resolution, or too far away.
- Glare from glossy film or curved bottles. Tilt the scanner slightly.
- Damaged bars across the full height. 1D codes have no error correction, though a scan line through an undamaged part of the bars can still work.
If you're making your own codes in the barcode generator, print a proof at actual size and scan it with the device that will really be used before you print the full run. How to generate barcodes online for free covers sizing so codes read first time.
Frequently asked questions
Can I find out who made a product from its barcode?
Often, yes. GS1 runs a lookup service where you can enter a GTIN to see the company that licensed it, if that company's data is published. The prefix alone only tells you which GS1 organization issued the number.
Can a barcode contain a virus or a link?
A 1D barcode holds only a short string of characters, and a scanner simply types them. A QR code can hold a link, which is why it's worth checking where a QR code points before you open it.
Why does my scanner add an extra character at the end?
Most scanners send an Enter key after each scan so the cursor moves to the next field. You can change or remove this suffix by scanning a setting code from the scanner's manual.
Do barcodes have to be scanned the right way up?
No. EAN, UPC, Code 128 and most other symbologies are designed to be read in either direction, and 2D codes can be read at any rotation.


