Guide
Reading a barcode from a photo or a camera, and why the check digit decides what is shown
A barcode is a number written in stripes, and reading one is a matter of measuring them. A shop scanner does it with a laser; a phone camera does it with software. This page does it in your browser with a reader of its own, so it works on a laptop with a webcam, on a screenshot of a product listing, or on a photo you took of a label, without installing anything and without sending the picture anywhere.
What it reads
The built-in reader handles EAN-13 and EAN-8, the numbers on retail products worldwide, UPC-A, the twelve-digit American version, Code 128, the common choice for stock codes and shipping labels, and Code 39, an older code for capital letters and digits. The page also reads QR codes, and if your browser has its own barcode detector, it adds whatever that finds, such as ITF or Code 93. The result table says which reader found each code.
How a picture becomes a number
A barcode is read along a line. The page takes 48 horizontal lines across the picture and 48 vertical lines down it, so the code can sit anywhere and be upright, upside down or on its side. Each line is reduced to alternating runs of dark and light, using a threshold that follows the local brightness, so a shadow across the photo does not ruin it. The runs are then compared with the patterns of each barcode type, in both directions.
Why misreads are rejected
An EAN or UPC number ends with a check digit worked out from the others by weighting alternate digits one and three. If the reader gets a single digit wrong, the check fails and the code is thrown away rather than shown. Code 128 has a check symbol that does the same job with a sum modulo 103. Code 39 has no check digit, so the page asks two separate lines to agree before it believes a Code 39 read.
A worked example
Press Sample. The page draws an EAN-13 for 5901234123457 on a canvas, scans it as if it were a photo, and shows it in the table with the type EAN-13. The check digit works out as follows: the first twelve digits, 5 9 0 1 2 3 4 1 2 3 4 5, weighted 1, 3, 1, 3 and so on, add up to 83, and 10 minus the last digit of 83 gives 7, which is the thirteenth digit. The bars are 95 modules wide: a three-module start guard, six left digits of seven modules, a five-module centre guard, six right digits and a three-module end guard.
Taking a readable photo
Fill most of the frame with the barcode and keep the bars running straight across. Leave a little white space at each end, since the reader relies on it to find where the code starts. Use even light and avoid reflections on glossy packaging. Hold the camera steady until the text under the bars is sharp. Very small bars, with each only a pixel or so wide in the picture, are the commonest reason for a read to fail, so move closer rather than zooming in on a small image.
Camera, files and privacy
The camera button opens your device’s camera, preferring the rear one on a phone, and checks frames several times a second until it finds a code. You can instead drop or paste a picture; HEIC photos from some phones are converted first. Pictures and frames are processed in memory on your device. Nothing is uploaded, and the codes you scan are not saved when you leave the page.
Edge cases
A picture with several barcodes lists each of them. If the same value is found by more than one reader it appears once. A photo that is too dark or too bright may find nothing even when a code is present, in which case the message suggests a sharper, well-lit picture. Screenshots of a barcode on a screen usually read well, but moiré from photographing a monitor can spoil the bars.
Limits
The page’s own reader does not handle every type: ITF, Codabar, Code 93, UPC-E and two-dimensional codes other than QR depend on your browser’s detector, which some desktop browsers do not have. It cannot repair a damaged barcode, and it does not look up what a number belongs to, so it tells you the number and not the product.
Related tools
- QR Code Scanner reads QR codes and shows what they contain, such as links and Wi-Fi details.
- Barcode Generator draws a barcode you can scan back with this page.
- Bulk Barcode Sheet Generator prints labels you can check with the camera.
- EAN-13 and UPC Check Digit Calculator works out the final digit that the reader verifies.
Checked against the current version of the Barcode Scanner (Read Barcodes from Camera or Image) on .

