Barcode image decoder

Upload an image to read a common one-dimensional barcode.

  • Runs locally
  • Free

Use the tool

Your files are processed in your browser and are not uploaded to a server.

About this tool

Upload an image with a one-dimensional barcode to read its type and value. Supports Code 128, Code 39, Code 93, EAN, UPC, ITF and Codabar — handy for reading product or tracking numbers without a scanner.

Typical uses

  • Read the EAN on a product packaging photo
  • Extract a tracking number from a shipping label screenshot
  • Check that a barcode you generated reads correctly

How to use

  1. Upload a sharp image containing a complete one-dimensional barcode.

  2. Read its detected format and value, then copy the result if needed.

Good to know

Images are limited to 30 MB. Supported common formats include Code 128, Code 39, Code 93, EAN, UPC, ITF and Codabar.

Supported formats and what the result shows

Decoding runs in your browser with ZXing’s JavaScript port (@zxing/browser 0.1.5) with nine one-dimensional formats enabled. The table shows real results: each example value from this site’s batch barcode generator was turned into bars and read back with a reader set up the same way. The “Format” column is the reader’s internal name, shown as is.

Generator formatValue entered (→ with check digit)“Format” shownDecoded text
Code 128DOC80-12345CODE_128DOC80-12345
Code 39DOC80-12345CODE_39DOC80-12345
Code 93DOC80-12345CODE_93DOC80-12345
EAN-13590123412345 → 5901234123457EAN_135901234123457
EAN-89638507 → 96385074EAN_896385074
UPC-A03600029145 → 036000291452UPC_A036000291452
UPC-E425261 → 04252614UPC_E04252614
ITF1234567890ITF1234567890
ITF-141001234567890 → 10012345678902ITF10012345678902
CodabarA123456ACODABARA123456A
  • ITF-14 is reported as ITF. UPC-E shows 8 digits (number system 0, six digits, check digit). An EAN-13 that starts with 0 is reported as UPC_A without that 0: 0012345678905 appears as UPC_A 012345678905. Keep the length difference in mind when matching stock numbers.
  • Codabar results keep the A–D start and stop letters (A123456A); other scanners may leave them out, so compare like with like.
  • ITF needs at least 6 digits: the 4-digit 1234 was not found.
  • QR codes, Data Matrix, PDF417 and GS1 DataBar are not read; use the QR code decoder for QR.
Check digits are verified

The last digit of EAN and UPC codes is a check digit. The reader recomputes it and treats a mismatch as “not found”; it never shows a doubtful result. The rule: multiply the body digits by 3, 1, 3, 1 … starting from the right, add them up and take the distance to the next multiple of 10. For the body 490123456789 the weighted sum is 126, so the check digit is 4 and the full number 4901234567894. When we replaced the bar pattern of the last digit of 5901234123457 with the pattern for 8, the reader returned “No barcode found. Try a sharp, complete, high contrast image.”

Which rows are scanned, and which angles work

Decoding runs in four passes, most reliable first: (1) the original quick scan of 15 rows around the middle; (2) the same quick scan on the image turned 90° clockwise; (3) if still nothing, a “try harder” scan of the whole image, starting at the middle row and alternating up and down to the top and bottom edges, with rows spaced the image height ÷ 256 apart (rounded down, at least 1 px); (4) the same on the turned image. A result from passes 3 and 4 is kept only if it is confirmed: a separate 10 px strip just above or below the row it came from must give the same value and format with the quick scan. The table shows the rows the try-harder scan covers:

Image heightRow spacingRows scanned (px)Rows
600 px2 px0–598300
1000 px3 px2–998333
2448 px9 px0–2439272
3024 px11 px5–3019275
4000 px15 px5–3995267
  • Tested: a 40 px tall EAN-13 in a 1000 px tall image was read when centred at every position we tried, y = 20, 50, 250, 500, 750, 950, 980. In a 4000 px tall image (rows 15 px apart), barcodes 16 px tall or more were read at all three offsets we tried; 8 and 12 px tall ones only at some.
  • Orientation: upside down (180°) makes no difference, because each row is also read backwards. Passes 2 and 4 search the image turned 90°, so vertical barcodes are read too: a vertical EAN-13 decoded in 900 × 400, 400 × 900, 4000 × 3000, 3000 × 4000 images.
  • Tilt: barcodes within about 20° of horizontal or vertical were read (tested: 10°, 20°, 70°, 80°); diagonal angles such as 30°, 45°, 60° were not. Straighten those first.
  • Why the confirmation: we ran 60 barcode-free 1000 × 750 images of each kind (random grey noise, random coloured rectangles, dense 14 px text lines, random vertical stripes). The try-harder scan alone “found” a barcode that is not there in 1, 3, 7, 0 of them respectively (text pages came back as EAN-13 or EAN-8, for example); the original quick scan and the four-pass page found 0.
  • Each image returns one result. A sharp barcode at 1 px per module still decoded in our tests, so small size alone was not what made barcodes fail.

Blank space beside the bars: how much each format needs

Barcodes need a blank area (quiet zone) to their left and right. We placed dark vertical marks on both sides and moved them away step by step to find the smallest gap, in modules (the width of the narrowest bar), that still decoded. This site’s barcode generator always leaves 12 modules per side.

FormatSmallest gap (modules)
EAN-133
UPC-A3
Code 1287
Code 398
ITF10
CodabarFails with any dark mark on the same row
  • EAN and UPC are the most tolerant and ITF the most demanding. When a price tag, text or the edge of a package sits next to the bars in a photo, leave more background on both sides when you crop.
  • Codabar is the exception. The reader used here treats everything from the first to the last dark pixel of a row as the barcode, so any other dark object on the same horizontal line, even 40 modules away, stops it. Crop Codabar images down to the barcode itself.

Messages and what to do

MessageCause and fix
Choose an image file.The file has no image type and its extension is not png, jpg, jpeg, webp, gif or bmp.
Image must be at most 30 MB.The file is larger than 30 MB. Compress or crop it and retry.
No barcode found. Try a sharp, complete, high contrast image.Every failure ends here: no barcode, a QR code, a barcode tilted diagonally (about 30°–60°), a barcode shorter than the row spacing, too little blank space, a wrong check digit, or an image format the browser cannot open. Work through the sections above; cropping close to the barcode and turning it level or upright fixes most cases.

Choosing a file under “Upload barcode image” starts decoding at once, and Ctrl+V / ⌘V pastes a screenshot (“You can also paste an image from your clipboard.”); after a success, “Copy content” copies the text. Neither the image nor the result is uploaded.

Frequently asked questions

Why did reading fail?

Use a sharp, complete image without strong tilt or glare, with clear space on both sides of the barcode.

Can it read QR codes?

This tool reads one-dimensional barcodes. Use the QR code decoder for QR codes.

Image size limit?

Up to 30 MB per image.