Barcode Repair Tool
Lost a digit to a smudge, a scuff, or a bad OCR read? Mark the unknowns with ? or * and the GS1 mod-10 check digit does the rest. Handles GTIN-8, GTIN-12, GTIN-13 and GTIN-14 with up to three missing positions, all in your browser.
By The eancheck teamPublished
? or * for unknown digits.No unknownsTry one of these
Strict mode rejects any character that isn't a digit or a wildcard. The total length must be 8, 12, 13 or 14 characters.
Type a barcode with ? or * in the smudged positions to see the candidate list here.
Why check digits make repair possible
Every GTIN ends with a check digit calculated from all the others. The GS1 algorithm multiplies each digit by alternating weights of 3 and 1, starting from the right of the payload, sums the results, and takes the number that rounds the total up to the next multiple of 10. That gives every non-check digit exactly one correct check digit it pairs with. Change any single payload digit and the expected check digit changes too.
That tight coupling is what makes repair work at all. If you know the check digit and all but one payload digit, you can reconstruct the missing one with a ten-way brute force: try 0 through 9 at the unknown position, compute the resulting check digit, keep the one that matches. Because the arithmetic is linear mod 10, exactly one of those ten attempts will succeed. Never zero, never two.
Two unknowns give you about 10 valid candidates out of 100 combinations, since one in ten satisfies the check digit equation. Three unknowns give you about 100 out of 1,000. You can see the relationship in the visualiser below: hover any digit to watch how changing it shifts the check digit. Every alternative value produces a different result, which is exactly why the brute force works.
Edit the GTIN below. Hover or focus any digit card to see how changing that digit would change the check digit.
Sum of contributions: 78
Check digit: (10 − 78 mod 10) mod 10 = 2
✓ Valid, the provided check digit matches.
When to use this tool
Barcode repair is an unglamorous problem that shows up in a few distinct places. Each has its own texture, but they share the same underlying need: you have most of a GTIN, you need the rest, and retyping blindly isn’t an option.
Warehouse receiving and returns
Cartons get scuffed in transit. A forklift fork catches a label, a conveyor belt rubs one corner thin, a puddle takes out two digits. Receiving staff don’t have time to call the supplier for every damaged label, and rescanning isn’t an option if the symbol itself is gone. Typing in everything you can read plus a wildcard for each smudge takes seconds, and in the common one-smudge case the answer is unique.
OCR cleanup pipelines
OCR on receipts, invoices, or scanned documents is good enough to recognise most digits and bad enough to occasionally miss one. A typical OCR stage emits a confidence score per character; anything below the threshold becomes a ?, and the whole string flows into this tool. The valid-check-digit constraint acts as an automatic error-correcting code. OCR engineers sometimes call it “free redundancy”, since they didn’t have to add it themselves.
Damaged retail labels
Shelf stickers get peeled. Promo labels cover part of the original code. Customers at the till pull old labels from clothes. Any time a human needs to key a GTIN into a cash register or inventory system and the label is partially unreadable, this tool beats guesswork.
Data-entry cleanup
Sometimes the problem isn’t a physical label at all. It’s a legacy spreadsheet where the last digit was dropped by a mangled CSV export, or an order form where someone wrote the GTIN by hand and their 3s and 8s are indistinguishable. A wildcard in the problem position plus the rest of the digits resolves it in one keystroke.
Limits and edge cases
It’s worth being explicit about what this tool does not do, because honesty up front saves everyone a round trip.
- More than 3 unknowns is out of scope.The brute-force space stays manageable through 3 (up to 1,000 combinations, ~100 valid candidates) but explodes from there. Four unknowns gives you 10,000 combinations and around 1,000 valid candidates. Nobody’s going to scan that list productively.
- Non-GTIN identifiers aren’t supported. SSCC-18, GLN-13, ITF-14 (structurally the same as GTIN-14 so it works), ISBN-10 (mod-11, different algorithm), and other identifiers either use different check digit schemes or carry different semantic constraints. We’ll build dedicated tools for them rather than bending this one to fit.
- Label context doesn’t factor in.The tool doesn’t know your company prefix, your supplier list, or your product catalogue. If you have that context elsewhere, use the candidate list as a shortlist to cross-reference.
- No OCR or image upload. The input is always text. If your workflow starts with a photo, run it through an OCR pipeline first and feed the uncertain characters here as wildcards.
- Padding is deliberately missing in tolerant mode. Tolerant mode strips stray characters (dashes, spaces, dots) but doesn’t pad short inputs with leading zeros. Padding would fabricate known-good digits, which is exactly wrong for a repair tool: every digit the tool treats as known actually has to be known.
The algorithm, in plain English
Under the hood the tool does the simplest thing that works. Given your input, it first normalises * to ? (so both wildcard styles behave identically), strips stray characters if you’re in tolerant mode, and validates the total length against the four legal GTIN lengths of 8, 12, 13 and 14. If anything about the character set or length is off, it refuses to guess and tells you why.
Then it finds the positions of every ?and counts them. Zero unknowns means there’s nothing to repair. More than three means there’s too much to repair. Between one and three, the tool enumerates every combination of digits that could fill those positions (at most a thousand). For each combination it asks the GS1 check digit function whether the resulting GTIN is valid. Valid combinations go into the candidate list; invalid ones are discarded.
There’s no cleverness beyond that. The mod-10 arithmetic is so cheap that even the full 1,000-case search finishes in well under a millisecond; the whole thing runs synchronously on every keystroke with no debounce. The formal spec lives in the GS1 General Specifications, section 7.9, if you want to roll your own.
Frequently asked questions
What does the ? character do in the input?
The ? marks a digit position you can't read. The tool treats each ? as an unknown and tries every combination of 0–9 that would produce a valid GS1 mod-10 check digit. * works the same way; both normalise to the same wildcard.
Why are check digits enough to recover a missing digit?
The check digit is calculated from all the others. If one digit is smudged and the rest are readable, exactly one value makes the check digit add up. For two unknowns, about ten combinations work. For three, about a hundred. Brute force is cheap at this scale.
How many unknowns can this tool handle?
Between 1 and 3. Zero means there's nothing to repair; use the main calculator instead. More than 3 blows up the candidate list past anything you can eyeball: 4 unknowns gets you up to 1,000 matches, 5 gets you 10,000, and most of them would look equally plausible without more context.
What if the tool returns multiple candidates?
It means your known digits don't pin down a single GTIN. Look at the physical label for context clues you might have missed: a visible prefix, a country flag, a brand logo. Then use the filter box to narrow the list. Recovering even one more digit from the label drops the candidate count by roughly 10×.
Does the repair tool work for EAN, UPC, and ISBN?
Yes for EAN (GTIN-13) and UPC (GTIN-12). Both are GTIN variants and both use GS1 mod-10. ISBN-13 uses the same algorithm too, so a scratched ISBN-13 will work here. ISBN-10 is out of scope: it uses a different mod-11 scheme and needs its own tool.
Is my barcode data sent to a server?
No. Every candidate is computed in your browser. There's no API call, no analytics payload carrying your input, no server-side processing at all. Open the devtools network tab while you type if you want to see for yourself: nothing fires. This matters if you're using the tool on warehouse data or anything internal that shouldn't leave your network.
What if my label is so damaged I can't see most of the digits?
Honestly, this tool can't help and no tool could. If four or more digits are gone, you're better off looking up the product by something else: a brand name, a supplier reference, a PO line item, a photo of the packaging. This tool is built for the common case: a single smudge, a scuffed corner, one digit rubbed off by a scanner belt.
Can I use this for non-GTIN identifiers like SSCC or GLN?
Not yet. SSCC-18 and GLN-13 also use GS1 mod-10, but the length constraints are different and the label context (logistics vs. retail) changes how you'd use the repair. A dedicated SSCC/GLN tool is on the roadmap.
By The eancheck teamPublished
Questions or corrections? Email the eancheck team.