Recover barcodes that won't scan from the brightness profile of each scan line, with unreadable digits verified against the check digit
Everything runs inside your browser. Your image is never sent to a server.
Several horizontal scan lines are taken from the image at different heights and skews, and each one is turned into a brightness profile. The falling and rising edges of that profile give the run lengths, from which the smallest module width is estimated; the grid is then fitted to the start guard and every module is re-read. Digits that could not be read are filled with tentative values, and only the combinations whose check digit works out are offered as candidates.
Automatically tries combinations of binarization threshold (including an automatically estimated one) x black/white inversion x rotation (0/90/180/270 degrees). Useful for photos where the barcode is standing vertically, or for labels printed white-on-black.
Drag on the "before" preview below to select an area and the chosen operation is applied to that area only. You can invert just the part crushed by a shadow, or darken just the part that is blown out. Fixes stack up and can be removed one by one afterwards.
You photographed a product on the shelf or a shipping label, but the barcode will not scan - usually because of defocus, camera shake, uneven lighting, a shadow, a reflection, or simply too little resolution. This free online tool combines image processing (enhancement, locally adaptive binarization, region-limited fixes) with per-scan-line brightness profile analysis and the barcode-specific check digit to try to recover a barcode that could not be read.
A QR code carries Reed-Solomon error correction and can mathematically recover up to about 30% of its area. An ordinary barcode has no error correction code at all. All it has is a single check digit at the end, and that exists to notice an error, not to fix one. In exchange, a barcode has a different strength: the same information is repeated as hundreds of scan lines down the height of the bars. If the top half is crushed by a shadow but one line in the bottom half survives, reading that line alone is enough.
A single threshold for the whole image crushes shadowed areas to solid black and blows out bright areas to solid white. This tool includes locally adaptive binarization (deciding black or white by comparing each pixel with the average brightness around it, computed quickly with an integral image) among its automatic attempts, so photos with uneven lighting are judged by "is this darker than its surroundings" instead. If that is still not enough, you can drag on the preview to invert, lighten, darken or fill with white just that area, stacking as many fixes as you need.
In EAN-13 (JAN-13) the 13th digit is a check digit, uniquely determined from the first 12 digits weighted 1, 3, 1, 3 and so on. Of all the combinations produced by guessing, only about one in ten passes the check digit. EAN-13 goes further: whether each of the six left-hand digits uses the odd-parity (L) or even-parity (G) encoding encodes the first digit, and only 10 of the 64 possible patterns are valid. CODE128 has a modulo-103 check character as well. This tool keeps only the combinations that satisfy all of these.
It helps when an intact scan line survives above or below the damage, when the thin bars have smeared together, or when a shadow darkens one side. It struggles when bars are missing horizontally - when part of the number is simply gone. The more digits are lost, the more candidates survive, and the check digit alone cannot pick one. In that case several candidates are shown, but they contain guesses, so always cross-check against the physical item before using them. The ZXing (zxing-js) library is also used alongside the built-in reader.
No. Everything - loading, enhancement, binarization, scan line extraction and decoding - runs entirely inside your browser using Canvas and JavaScript. Neither the image nor the decoded result is ever sent to or stored on an external server, so you can safely use photos you would rather keep private, such as product packaging or shipping labels.
EAN-13 (JAN-13), UPC-A, EAN-8, CODE128 and CODE39. Only symbologies that were actually generated as images, damaged with a dark shadow and then recovered by this tool are listed here. EAN-13 and UPC-A share the same 95-module structure, so a UPC-A code is reported as UPC-A and its digits are shown as the 13-digit form including the leading zero.
A barcode carries a check digit at the end, and comparing it with the value computed from the other digits tells you whether the reading is valid. Brute-forcing tentative values into the digits that could not be read produces many candidates, but keeping only the combinations whose check digit works out cuts them down to roughly one in ten. EAN-13 adds another rule: the pattern of odd-parity and even-parity encodings across the six left-hand digits encodes the first digit, and only 10 of the 64 possible patterns are valid. CODE128 also has a modulo-103 check character. This is a barcode-specific way to narrow down candidates that QR codes do not have.
No, recovery has limits. A barcode is one-dimensional, carries almost no redundancy, and has no error correction code like a QR code does. This tool looks for a readable scan line using multiple scan heights, skew correction and locally adaptive binarization, and fills in the remaining digits with tentative values checked against the check digit - but the more digits that cannot be read, the more candidates appear and the less certain the answer becomes. If any part of the bars survives vertically, recovery is likely; if the code is badly cut horizontally, it is difficult.
The candidates are combinations produced by assigning tentative values to the digits that could not be read and keeping only those whose check digit works out. A valid check digit only guarantees that the value is not impossible; it does not guarantee that it matches the original barcode. Every candidate except one with zero guessed digits contains guesses. Always cross-check the number against the physical item or another source before using it for real work.