Introduction
Selling products on Amazon, Shopify, or a retail marketplace and need to validate an EAN barcode? EAN (European Article Number) is the global retail barcode standard managed by GS1. EAN-13 uses 13 digits with a mod-10 check digit algorithm, while EAN-8 is a compact 8-digit version for small products. This tool validates and generates EAN check digits for both formats. Paste your number and get instant validation. No data leaves your browser.
What this tool does
- Validates EAN-13 (13 digits) and EAN-8 (8 digits) barcodes using the mod-10 algorithm with alternating weights of 1 and 3.
- Generates the correct check digit from the data digits, producing the full valid EAN code.
- Strips hyphens and spaces automatically before computation.
- Reports both the provided check digit and the expected check digit for easy error identification.
- Runs entirely client-side with no network requests.
How this tool works
Select the EAN variant (EAN-13 or EAN-8) and the mode (Validate or Generate). In Validate mode, paste the full EAN code (hyphens and spaces are ignored). The tool computes the alternating weighted sum and checks whether the check digit makes the total a multiple of 10. It reports VALID or INVALID with both the provided and expected check digits. In Generate mode, enter the data digits (12 for EAN-13, 7 for EAN-8) and the tool computes and appends the check digit. The Swap button toggles between modes.
How the EAN check digit works
The EAN check digit algorithm is defined by GS1 and is identical to the ISBN-13 check digit algorithm. It uses a mod-10 system with alternating weights of 1 and 3.
For EAN-13, the first 12 digits are multiplied by weights that alternate between 1 and 3, starting with 1 for the first digit. The check digit (the 13th digit) is chosen so that the sum of all 13 weighted digits is a multiple of 10. Formally: check_digit = (10 - (sum of weighted first 12 digits mod 10)) mod 10.
For EAN-8, the same algorithm applies but the weights start with 3 for the first digit (alternating 3, 1, 3, 1, ...). The check digit is the 8th digit.
The EAN-13 structure encodes: a 2-3 digit GS1 country code (or prefix), a 4-5 digit company code, a 5-digit product code, and the check digit. The 978 and 979 prefixes are reserved for ISBN (books). Other prefixes identify geographic regions: 000-139 for the US and Canada, 400-440 for Germany, 450-459 and 490-499 for Japan, 500-509 for the UK, and so on.
EAN-13 was originally developed as a superset of UPC-A (the North American 12-digit barcode). A UPC-A code can be converted to EAN-13 by prepending a 0. Since 2005, the GS1 Global Trade Item Number (GTIN) standard unifies UPC and EAN under a single system, and most retail scanners worldwide can read both formats.
How to use this tool
- Select EAN-13 or EAN-8 and choose Validate or Generate mode.
- In Validate mode, paste the full EAN code. Hyphens and spaces are stripped automatically.
- Read the result: VALID means the check digit is correct. INVALID means it is not, and the tool shows what the check digit should be.
- In Generate mode, enter the data digits (12 for EAN-13, 7 for EAN-8).
- The tool displays the computed check digit and the full EAN code.
Real-world examples
Validating a product EAN-13
An e-commerce seller receives a product list from a supplier and needs to verify the barcodes. Input: 4006381333931. The tool computes 1*4 + 3*0 + 1*0 + 3*6 + 1*3 + 3*8 + 1*1 + 3*3 + 1*3 + 3*3 + 1*9 + 3*3 = 4+0+0+18+3+24+1+9+3+9+9+9 = 89. Check digit 1 gives 89+1 = 90, a multiple of 10. The tool reports VALID.
Generating an EAN-8 check digit
A small product label needs an EAN-8 barcode. The seller enters the first 7 digits: 7351353. The tool computes the weighted sum with weights 3,1,3,1,3,1,3 and determines the check digit is 7, displaying the full EAN-8: 73513537.
Converting UPC-A to EAN-13
A US retailer needs to list a product on a European marketplace that requires EAN-13. The product has UPC-A 036000291452. Prepend 0 to get 0036000291452 (13 digits). Validate with the EAN-13 tool: the check digit 2 passes the mod-10 test, confirming the conversion is correct.
Comparison with similar methods
| Method | Complexity | Typical use |
|---|---|---|
| EAN-13 (mod-10, weights 1/3) | O(n), alternating weighted sum | Global retail barcodes (GS1) |
| EAN-8 (mod-10, weights 3/1) | O(n), alternating weighted sum | Compact retail barcodes for small products |
| UPC-A (mod-10, weights 3/1/3/1...) | O(n), alternating weighted sum | North American retail (subset of EAN-13) |
| ISBN-13 (mod-10, weights 1/3) | O(n), identical to EAN-13 | Books (EAN-13 with 978/979 prefix) |
Limitations or considerations
This tool validates the mathematical correctness of the EAN check digit only. It does not verify that the EAN has been registered with GS1 or that it corresponds to a real product. The EAN-13 check digit algorithm does not catch all adjacent transposition errors. Specifically, swapping two adjacent digits where one has weight 1 and the other has weight 3 may not be detected if the difference is a multiple of 10. For ISBN-13 validation specifically, you can also use the ISBN-13 Checksum tool.
Frequently asked questions
What is the difference between EAN-13 and UPC-A?
UPC-A is a 12-digit barcode used in North America. EAN-13 is a 13-digit barcode used globally. A UPC-A code can be converted to EAN-13 by prepending a 0. Since 2005, GS1 unified both under the GTIN standard, and most scanners read both formats.
How do I get an EAN code for my product?
You need to join GS1 (gs1.org) and purchase a company prefix. GS1 assigns you a unique prefix, and you generate product codes within that prefix. The check digit is computed using the algorithm this tool implements.
Can this tool validate ISBN-13 barcodes?
Yes. ISBN-13 uses the same check digit algorithm as EAN-13. All ISBN-13s are EAN-13 barcodes with the 978 or 979 prefix. You can validate any ISBN-13 with this tool.
What is EAN-8 used for?
EAN-8 is a compact 8-digit barcode for products where a full EAN-13 would not fit physically, such as small candies, pencils, or individual cigarettes. GS1 assigns EAN-8 codes directly to companies to avoid wasting a full company prefix on a small product line.
Conclusion
This EAN checksum tool validates and generates check digits for both EAN-13 and EAN-8 barcodes. It handles hyphens and spaces, reports both provided and expected check digits, and runs entirely in your browser. For related tools, try the ISBN-13 Checksum, the ISBN-10 Checksum, or the Luhn Algorithm tool.