EAN Validator
Validate EAN‑8, EAN‑13, UPC and GTIN barcodes, verify check digits, and decode basic prefix information.
EAN Barcode Validator
Supports EAN‑13, EAN‑8, UPC‑A (12 digits) and GTIN‑14. Non‑digit characters are ignored automatically.
How the EAN check digit works
EAN barcodes use a single check digit to detect common typing and scanning errors. The check digit is calculated from the other digits using a modulo‑10 algorithm defined by GS1.
EAN‑13 / GTIN‑13 formula
Steps:
- Take the first 12 digits (exclude the check digit).
- From right to left, multiply digits in odd positions by 3 and digits in even positions by 1.
- Sum all the products.
- Compute sum mod 10.
- The check digit is (10 − (sum mod 10)) mod 10.
Example (EAN‑13: 4006381333931):
Digits without check digit: 4 0 0 6 3 8 1 3 3 3 9 3
Weights (right→left): 3 1 3 1 3 1 3 1 3 1 3 1
Products: 12 0 0 6 9 8 3 3 9 3 27 3 → sum = 83
83 mod 10 = 3 → check digit = (10 − 3) mod 10 = 7 → expected
check digit = 7
EAN‑8 formula
EAN‑8 uses the same idea but with the weights applied in the opposite order:
- Take the first 7 digits.
- From right to left, multiply digits in odd positions by 3 and digits in even positions by 1.
- Then apply the same modulo‑10 rule to get the check digit.
Supported formats
- EAN‑13 / GTIN‑13 – 13 digits, global retail standard.
- EAN‑8 – 8 digits, used for very small packages.
- UPC‑A – 12 digits, North American format (validated with the same algorithm).
- GTIN‑14 – 14 digits, used for cases and logistics units.
Limitations
This validator checks only the mathematical validity and basic structure of the code. It does not query GS1 or any product database, and therefore cannot confirm:
- whether the code is actually registered,
- which company or product it belongs to,
- whether it is being used correctly on packaging.
For authoritative information about ownership and product data, use official GS1 services such as Verified by GS1 or your local GS1 member organization.
FAQ
Can I validate multiple EANs at once?
Yes. Paste a list of codes separated by commas, spaces or new lines. The tool will normalize each entry, ignore non‑digit characters, and show a validation result for every code.
What errors can the EAN check digit detect?
The modulo‑10 algorithm reliably detects all single‑digit errors and most adjacent digit transpositions (e.g., typing 123456 instead of 123546). It cannot detect all possible multi‑digit permutations, so a valid check digit does not guarantee that the number is the intended one.
Why does my code show “invalid length”?
After removing non‑digit characters, the validator expects one of the supported lengths: 8, 12, 13 or 14 digits. If your code is shorter or longer, or if you accidentally omitted the leading zero of a UPC‑A when treating it as EAN‑13, you will see an invalid‑length message.
Is this validator suitable for production systems?
The algorithm implemented here follows the official GS1 specification and can be used as a reference. For mission‑critical applications (e‑commerce, warehouse management, POS), you should integrate validation directly into your backend or use a GS1‑certified library and, where required, connect to official GS1 data sources.