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 Updated
? or * for unknown digits.No unknownsStrict mode accepts only digits and wildcards. The 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.
Where a damaged GTIN turns up
You have most of a GTIN and need the rest. Retyping blindly is not an option, because a wrong digit puts the wrong product into a stock system or onto a new label.
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 do not have time to call the supplier for every damaged label, and rescanning is not 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. Then print a new ITF-14 for the carton. If the same carton also has a GS1-128 label with an (01), that is the carton's GTIN as well: scan it and read the string with the GS1-128 parser.
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 check digit then does the correction: for a single unknown, only one digit fits.
Damaged retail labels
Shelf stickers get peeled. Promo labels cover part of the original code. Customers at the till pull old labels from clothes. When someone has to key a GTIN into a cash register or inventory system and the label is partly unreadable, this tool replaces guesswork. Once you have the full number, you can print the UPC again or, for a scratched ISBN-13, draw a new book barcode.
Data-entry cleanup
Sometimes the problem is not a physical label at all. It is 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 look the same. A wildcard in the problem position plus the rest of the digits resolves it in one keystroke. When the last digit is missing from a whole column, paste the column into the check digit calculator and press Calculate instead.
Limits and edge cases
The tool repairs a GTIN typed as text, with up to three unknown digits. These cases fall outside that.
- More than 3 unknowns. Three unknowns mean up to 1 000 combinations and about 100 valid candidates. Four mean 10 000 combinations and around 1 000 valid candidates, too many to check by hand, so the tool stops at three.
- SSCC-18 and ISBN-10. The tool accepts only the four GTIN lengths of 8, 12, 13 and 14 digits, so an 18-digit SSCC is refused, and ISBN-10 uses a mod-11 check the tool does not run. An ITF-14 carries a GTIN-14, so it works. To check a complete SSCC or ISBN-10, paste it into the barcode identifier, which runs both checks.
- Label context. The tool does not 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.
- Photos. The input is always text. If your workflow starts with a photo, run it through OCR first and type the uncertain characters here as wildcards. For a damaged QR code, the QR code recovery tool works from the image itself.
- Zero padding. Tolerant mode strips stray characters (dashes, spaces, dots) but does not pad short inputs with leading zeros. Padding would invent known digits, which is wrong for a repair tool: every digit the tool treats as known 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 are 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 is nothing to repair. More than three means there is 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.
Nothing more clever happens. The mod-10 arithmetic is cheap enough that the search runs synchronously on every keystroke, with no debounce. The formal spec lives in the GS1 General Specifications, section 7.9, if you want to write your own.
Frequently asked questions
What does the ? character do in the input?
The ? marks a digit position you cannot read. The tool treats each ? as an unknown, tries every digit from 0 to 9 in that position, and keeps the combinations that give a valid GS1 mod-10 check digit. The * character 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. With no unknowns there is nothing to repair; check the number with the check digit calculator instead. Past 3, the candidate list grows beyond anything you can read through: 4 unknowns give up to 1 000 matches, 5 give 10 000, and without more context they all look equally likely.
What if the tool returns multiple candidates?
It means the digits you know do not pin down a single GTIN. Look at the physical label for clues you might have missed, such as a visible prefix or a brand logo, then use the filter box to narrow the list. Each extra digit you recover from the label cuts the candidate count by about ten times.
Does the repair tool work for EAN, UPC, and ISBN?
Yes for EAN (GTIN-13) and UPC (GTIN-12). Both are GTINs and both use GS1 mod-10. ISBN-13 uses the same algorithm, so a scratched ISBN-13 works here too. ISBN-10 is out of scope: it uses a different mod-11 check, and the tool refuses a 10-character input instead of testing it against the wrong rule.
Is my barcode data sent to a server?
No. The candidates are computed in your browser as you type, so stock numbers from a warehouse system or a supplier spreadsheet stay on your machine. The only thing the tool stores is your choice of strict or tolerant mode, and it keeps that in your own browser's localStorage.
What if my label is so damaged I cannot see most of the digits?
Then this tool cannot help, and no check digit could. If four or more digits are gone, look the product up by something else: a brand name, a supplier reference, a purchase order line, a photo of the packaging. This tool is built for a single smudge, a scuffed corner or one digit rubbed off by a conveyor belt.
Can I use this for non-GTIN identifiers like SSCC or GLN?
Partly. A GLN-13 has 13 digits and the same GS1 mod-10 check as a GTIN-13, so the tool repairs it as if it were a GTIN-13. An SSCC has 18 digits, and the tool accepts only the four GTIN lengths of 8, 12, 13 and 14 digits, so it refuses an SSCC. Use the context on the label to tell a GLN from a GTIN.
Can the tool recover a smudged check digit?
Yes. The check digit is a position like any other: type ? in its place and the tool returns the one digit that fits, because a single unknown anywhere in a GTIN always has exactly one answer. If a whole list of numbers is missing only the check digit, the check digit calculator is quicker: paste the numbers without their last digit and press Calculate.
Should I reprint a damaged barcode or type the number in?
Both, in that order. Type the repaired number at the till or the goods-in desk so the item can move on, then print a new label from it with the barcode generator and stick it over the old one, so a scanner sees only one barcode. Before you print, check the number against the product or the supplier's list. The repair tool shows that the digits fit the check digit, not that they name the right product.
By The eancheck teamPublished Updated
Questions or corrections? Email the eancheck team.