EAN-13 / UPC-A Barcode Generator

Generate a real, scannable EAN-13 or UPC-A retail barcode from a product number — check digit computed automatically, PNG download.

1,131 views

Check Digit
Full Code

How the Check Digit Actually Catches Errors

EAN-13 and UPC-A are the barcode formats printed on retail products worldwide — different from the Code 128 generator on this site, which targets logistics and asset labels rather than retail scanning. Type the first 12 digits (EAN-13) or 11 digits (UPC-A) and the final check digit is computed and appended automatically, following the exact weighted-sum method defined by GS1.

The method, step by step: starting from the left, digits are multiplied alternately by 1 and by 3 (position-dependent — for EAN-13 the pattern typically runs ×1, ×3, ×1, ×3 and so on across the 12 digits), the results are summed, and the check digit is whatever value brings that sum up to the next multiple of 10: check digit = (10 minus (sum mod 10)) mod 10. Concrete example: for the 12 digits 690123456789, weighting and summing according to the standard pattern yields a total; if that total is, say, 87, then 87 mod 10 = 7, and the check digit = (10 - 7) mod 10 = 3 — so the full EAN-13 code becomes 6901234567893. Change any single digit in the first 12, and the same formula produces a different check digit, which a scanner will flag as a mismatch.

This is precisely why the check digit exists: it is an error-detection mechanism, not a security feature. It catches the single most common real-world failure — a barcode scanner misreading one digit due to a smudge, a printing defect or an angle issue — because a single-digit change almost always breaks the weighted-sum arithmetic. If the scanned digits do not produce the expected check digit, the scanner rejects the read and asks for a rescan, rather than silently accepting a wrong product number.

The bars themselves are drawn using the real L/G/R module-width tables defined in the EAN-13 specification, so a physical barcode scanner reads this exactly as it would read a printed retail barcode.

Things Worth Knowing

  • UPC-A is structurally an EAN-13 code with an implicit leading 0 — a 12-digit UPC-A and the 13-digit EAN-13 code formed by prefixing a "0" scan as the identical barcode pattern, which is why EAN-13 scanners also read UPC-A codes without modification.
  • The checksum only detects a single-digit misread reliably — it cannot guarantee that a number was ever legitimately assigned to a real product; that assignment comes from GS1, not from the arithmetic.
  • Legitimate EAN/UPC prefixes are issued by GS1 or a regional member organization to businesses — this tool draws a mathematically correct barcode for any digits typed in, but drawing a valid pattern is not the same as registering a real product number.

Frequently Asked Questions

How exactly is the check digit calculated?

Digits are multiplied alternately by 1 and by 3 from left to right, the results are summed, and the check digit is the value that rounds the sum up to the next multiple of ten: check digit = (10 - (sum mod 10)) mod 10. The tool applies this automatically to whatever digits are entered.

What does the check digit actually protect against?

A single misread digit - a smudge, printing defect, or scan angle issue. Because changing any one digit in the code almost always changes the required check digit, a scanner can detect that mismatch and reject the read instead of accepting a wrong product number.

Where can a real product number be obtained?

Legitimate EAN/UPC prefixes are issued by GS1 (or a regional member organization) to businesses. This tool draws a correct barcode for any digits entered, but it does not register the number - an actual retail product needs a prefix issued by GS1.

How is UPC-A related to EAN-13?

UPC-A is structurally an EAN-13 code with an implicit leading 0 - a 12-digit UPC-A code and the 13-digit EAN-13 code formed by prefixing a "0" both scan as the same barcode pattern, which is why EAN-13 scanners also read UPC-A codes.

Can the check digit catch every possible error?

No - it reliably catches single-digit substitution errors, which are the most common real-world misreads, but it is a lightweight arithmetic check, not a cryptographic one, so it is not designed to catch every conceivable combination of multiple simultaneous errors.

Comments

No comments yet — be the first to write one!

Similar Tools