Barcode Decoder
Decode barcodes from images online. Upload, drag & drop, or paste images. All processing happens in your browser for privacy.
Drag and drop a barcode image here
Supports PNG, JPG, GIF, BMP, WebP and other common image formats
You can also use Ctrl+V to paste an image from clipboard
What is a Barcode Decoder?
A barcode decoder is a tool that reads and decodes barcode images back into their original content. By uploading an image containing a barcode, the tool automatically recognizes and decodes the stored numeric or text information. It supports common 1D barcode formats including CODE128, EAN-13, EAN-8, CODE39, UPC-A, UPC-E, Codabar, and ITF, as well as 2D formats like QR Code, Data Matrix, PDF417, and Aztec. This tool runs entirely in your browser - your images never leave your device, ensuring complete privacy. Before publishing or submitting, open the output and check readability, cropping, resolution, ordering, and missing content.
How to Use
How to use
- Click the upload area to select a barcode image, or drag and drop an image into the area
- You can also use Ctrl+V (Cmd+V on Mac) to paste an image from your clipboard
- The tool will automatically detect and decode the barcode content
- The decoded result will appear below, showing the barcode format and content type
- Click the "Copy Result" button to copy the decoded content, or open URL directly if it's a link
Decoding Tips
- Use a clear, high-contrast image with the full barcode visible; blur, glare, cropping, and strong perspective distortion reduce recognition accuracy.
- If a URL or product code is decoded, verify the destination or identifier before using it in production records.
Use Cases
Technical Principle
A 1D barcode (UPC, EAN, Code 39, Code 128, ITF, Codabar) is a sequence of parallel bars and spaces whose widths encode digits, letters, or the full ASCII range. A 2D barcode (QR Code, Data Matrix, PDF417, Aztec) is a 2D pattern of modules (cells) arranged on a quiet zone, usually with three position-detection patterns in the corners for orientation. Decoding a barcode is the reverse: image → preprocess → locate the symbol → measure bar/space widths (or sample the 2D grid) → look up the encoding table → apply a checksum to validate the result. The image pipeline matters. The source image goes through grayscale conversion (luma = 0.299 R + 0.587 G + 0.114 B, the Rec. 601 weights), then a global or adaptive threshold (Otsu's method picks a threshold that maximises inter-class variance, which works for most well-lit scans; Sauvola's adaptive threshold handles uneven lighting better). Edge detection (Sobel kernel: 3×3 Gx and Gy) finds vertical bar transitions; a Hough transform on those lines gives orientation; connected-component analysis then finds the bounding rectangle of the symbol. The quiet zone (the mandatory blank margin around the symbol, 10× the X-dimension for QR Code, 9× the bar width for Code 128) is verified before the symbol is accepted as a valid candidate. For 1D codes, the decoder measures the X-dimension (the width of the narrowest bar, the unit length) and reads bar-space widths as multiples of X. A Code 39 character is 9 bars + 9 spaces (one of which is an inter-character gap); 3 of the 9 elements are wide (representing 1) and 6 are narrow (representing 0). A Code 128 character is 11 modules: a start pattern, 6 encoded bars/spaces, and a stop pattern. Each character is therefore 11 modules; 11 × character_count + 13 (for start + stop + check + quiet) gives the symbol width. Code 128 has three encoding sets: A (uppercase + control), B (uppercase + lowercase), C (paired digits 00-99) — set-switch codes let the encoder pick the most efficient set per substring. For 2D codes, the algorithm differs. QR Code uses Reed-Solomon error correction (EC level L/M/Q/H adds 7%, 15%, 25%, 30% redundancy) and a configurable masking pattern (one of 8; the encoder picks the one that minimises the penalty score). After masking, the bit stream is placed on a square grid of 21×21 (Version 1) up to 177×177 (Version 40) modules; the three 7×7 finder patterns in the corners and the 5×5 alignment patterns at the inner corners provide orientation and scale. Data Matrix uses a similar layout with an L-shaped solid border on two sides and alternating dark/light on the other two. PDF417 is a stacked linear code (17 modules wide, up to 90 rows) used on US driver's licences and airline boarding passes. This page uses the ZXing ('Zebra Crossing') library, an open-source Apache-2.0 multi-format decoder originally from the Google ZXing project. ZXing runs the full pipeline (locate → preprocess → decode) and tries each known symbology in turn. It supports UPC-A, UPC-E, EAN-8, EAN-13, Code 39, Code 93, Code 128, ITF, Codabar, QR Code, Data Matrix, PDF417, and Aztec. For 2D codes the success rate in good lighting is ~99% on a 1080p photo; for 1D codes it's lower (~85-95%) because perspective, blur, and glare distort the bar widths. This tool only accepts image input (file upload, drag-and-drop, or clipboard paste); it does not provide live camera scanning. Checksums matter. UPC/EAN use a single modulo-10 check digit (sum of odd-position digits × 3 + sum of even-position digits, mod 10, subtracted from 10). Code 128 uses a modulo-103 check character. Code 39 does not require a check digit but the mod-43 check is recommended for logistics. QR Code uses Reed-Solomon EC; if the EC decoder finds more errors than the code can correct, decode fails. The page surfaces decode failures with the reason (checksum mismatch, quiet zone too small, mask conflict) when the library exposes it.
- 1D barcodes (UPC, EAN, Code 39, Code 128, ITF) encode data in bar/space widths; 2D codes (QR Code, Data Matrix, PDF417, Aztec) encode in a 2D grid of modules. Both need a quiet zone of ~10× the unit width to be valid.
- Image pipeline: Rec. 601 grayscale (0.299R + 0.587G + 0.114B) → Otsu or Sauvola threshold → Sobel edge detection → Hough transform for orientation → connected-component analysis to find the bounding box of the symbol.
- Code 128 has 3 encoding sets: A (uppercase + control), B (uppercase + lowercase), C (paired digits 00-99). Set-switch codes let the encoder pick the most compact set per substring, packing UPC-A '123456789012' tighter than Code 39 would.
- Code 39: 9 bars + 9 spaces per character, 3 wide (1) and 6 narrow (0); start/stop character '*'. Optional mod-43 check digit. Widely used in automotive, defence, and US government (MIL-STD-1189).
- Code 93 is the predecessor of Code 128, with 9 modules per character (6 data + start/stop) and 47 unique characters; superseded by Code 128 in most applications but still seen in some Canadian pharmacy and USPS applications.
- QR Code: Reed-Solomon EC at L/M/Q/H levels (7%/15%/25%/30% redundancy), 8 masking patterns, 21×21 to 177×177 modules (Version 1 to 40). Three 7×7 finder patterns in the corners provide orientation; 5×5 alignment patterns on larger versions correct perspective distortion.
- Data Matrix: L-shaped solid border on two sides, alternating dark/light on the other two; used for small-item marking in electronics and pharmaceuticals (ISO/IEC 16022).
- ZXing ('Zebra Crossing', Apache-2.0, Google): the open-source multi-format decoder used here. Supports UPC-A/E, EAN-8/13, Code 39/93/128, ITF, Codabar, QR Code, Data Matrix, PDF417, and Aztec. This tool only decodes from image files (upload, drag-and-drop, or clipboard paste); it does not provide live camera scanning.
- Checksums: UPC/EAN use mod-10, Code 128 uses mod-103, Code 39 uses optional mod-43, QR Code uses Reed-Solomon EC. A checksum mismatch tells you the image is corrupted, not that the data is wrong.
Examples
Product Barcode Recognition
Upload a supermarket product photo, decode EAN-13 barcode to get 6901234567890, then search for product name, manufacturer, price, etc.Tracking Number Retrieval
Photograph shipping label barcode, decode to get tracking number like SF1234567890, enter on courier website to check logistics statusBook ISBN Decoding
Scan barcode on book back cover, decode ISBN number like 9787111234567, search book database for detailed informationFAQ
Which barcode formats are decoded?
Common 1D codes including CODE 128, EAN-13, EAN-8, UPC-A, UPC-E, CODE 39, CODE 93, ITF (Interleaved 2 of 5), Codabar, plus 2D codes such as QR Code, Data Matrix, Aztec, and PDF417. The page uses the ZXing library in your browser to detect and decode all these formats from a single uploaded image.
Is the image uploaded for decoding?
No. Decoding happens entirely in your browser via WebAssembly or pure JavaScript. Drop the image and the bytes are read locally; nothing is sent to a server. You can verify in the browser's Network tab.
Why won't my barcode decode?
Common causes: the image is blurry, the barcode is rotated more than the decoder allows, contrast is too low, or there are reflections. Try cropping closer to the barcode, increasing brightness/contrast, and ensuring the image is at least 200-300 pixels wide for the full code. Glossy printed codes photographed under direct light often fail.
What input formats are accepted?
PNG, JPEG, GIF, WebP, and BMP are supported. Upload a file, drag and drop, or paste from clipboard. The image is read into a hidden canvas for decoding - nothing is sent to a server.
What does the result include?
The decoded text content and the detected barcode format. If the decoded text is a URL, a button appears to open it in a new tab. The character count and format name are also displayed.
Are EAN-13 check digits validated?
ZXing only returns a result when the barcode passes its internal checks, including the format's check digit. If decoding fails, the page shows "No barcode detected" without distinguishing between an unreadable image and a checksum error.
Can I decode multiple barcodes from one image?
The page detects the clearest code in the image. For images with multiple barcodes, crop each one individually and upload them separately for the most reliable results.