# Barcode Reader

> Decode EAN-13, UPC-A, Code 128, Code 39, ITF, Data Matrix and more from a picture, with a GS1 check-digit test for retail product numbers.

Use it online (free, runs in your browser): https://directory.milunir.com/developer-tools/generators-validators/barcode-reader/

To read a barcode from a picture, choose the image and the reader decodes the bars into their digits or text. An EAN-13 such as 4006381333931 is shown with its symbology and a GS1 check-digit test: the first twelve digits weighted 1 and 3 sum to 89, so the last digit must be 1.

Stock clerks, online sellers and developers often have a barcode only as a photo: a supplier's product shot, a label in a PDF, a shipping sticker someone sent by chat. This reader decodes it from the image. It covers the retail symbologies (EAN-13, EAN-8, UPC-A, UPC-E), logistics and industrial codes (Code 128, Code 39, Code 93, Codabar, ITF, DataBar) and 2D codes such as QR, Data Matrix, Aztec and PDF417. You can limit the search to 1D or 2D symbols when a label carries both. For an EAN, UPC or ITF-14 number the GS1 check digit is recomputed, which catches a misread or a mistyped product number. Decoding uses zxing-cpp compiled to WebAssembly and runs on your device. It reads the number only; it does not look up which product or company the number belongs to.

## How to use

1. **Choose the picture**: Press the file button or drop a JPG, PNG or WebP image that shows the barcode, ideally straight on and in focus.
2. **Narrow the search if needed**: Keep Any barcode, or pick 1D or 2D when a label carries several codes and you want only one kind.
3. **Read the value**: The decoded digits or text appear with the symbology, the GS1 check-digit result and a table of every code found.

## Examples

### An EAN-13 product barcode

- Look for: Any barcode
- Picture of the barcode: fixture:barcode-ean13-4006381333931.png

Result: Decoded value: 4006381333931 Barcode type: EAN13 Codes found: 1

The bars decode to 4006381333931. The first twelve digits weighted 1 and 3 add up to 89, so the check digit must be 1, which matches the last digit printed under the bars.

### Search only for 1D barcodes

- Look for: 1D (EAN, UPC, Code 128)
- Picture of the barcode: fixture:barcode-ean13-4006381333931.png

Result: Decoded value: 4006381333931 Barcode type: EAN13 Codes found: 1

Restricting the search to linear symbologies skips QR and Data Matrix detection; the same EAN-13 is found and the steps show the check digit working.

## How it works

`GS1 check digit = (10 − (Σ digitᵢ × weightᵢ) mod 10) mod 10, with weights 3 and 1 alternating from the rightmost data digit`

The picture is turned upright, converted to greyscale and scanned line by line. For a linear code zxing-cpp measures the widths of bars and spaces and matches them against each symbology's patterns: an EAN-13 has 95 modules made of guard bars and twelve 7-module digit patterns, and the leading digit is implied by the odd and even parity of the left six. 2D codes are found by their finder shapes and repaired with Reed–Solomon codewords. For EAN-8, UPC-A, EAN-13 and ITF-14 values the tool then repeats the GS1 modulo-10 check on the decoded digits and reports whether it matches the final digit.

Sources:

- [ISO/IEC 15420: EAN/UPC bar code symbology specification](https://www.iso.org/standard/46143.html), ISO

## When not to use it

- To find a product name, price or maker; the reader returns the number, not database records.
- For scanning items live at a till; it reads a saved picture, not a camera feed.

## Common mistakes

- Cutting off the blank quiet zone at the ends of a 1D barcode, which the decoder needs to find where the symbol starts.
- Expecting the first digits of an EAN-13 to show the country where a product was made; the GS1 prefix shows only which national office issued the number.

## Questions

### Why won't my barcode photo decode?

Linear barcodes need the bars sharp enough to tell a narrow bar from a wide one. Blur, a strong angle, curved packaging, glare over the bars or a cropped margin at either end can all stop a read. Take the picture straight on, fill most of the frame with the code and keep a little white space at both sides.

### What does a check digit mismatch mean?

The last digit of an EAN or UPC number is computed from the others. If the reader reports a mismatch, the decoded number does not obey the GS1 rule, so either a bar was misread or the label itself is printed wrong. A genuine retail barcode always passes.

### Can it tell me which product a barcode belongs to?

No. A barcode holds only a number or text. Product names are kept in the brand owner's records and in the GS1 registry, which this page does not query, so it shows the number and its symbology only.
