EAN-13 / UPC-A Barcode Validator

Validate EAN-13 and UPC-A barcodes and compute check digits

Validate EAN-13 (13-digit) and UPC-A (12-digit) retail barcodes with the correct mod-10 check digit, auto-detecting the type by length and showing the expected check digit on failure. Runs entirely in your browser. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

How is an EAN-13 check digit calculated?

Multiply the 13 digits by alternating weights starting with 1 then 3 from the left (odd positions weight 1, even positions weight 3), sum the products, and the barcode is valid if the total is divisible by 10.

EAN-13 and UPC-A are the two dominant retail barcode number systems printed on almost every product sold worldwide. Both end in a mod-10 check digit that barcode scanners use to detect misreads in real time. This free validator auto-detects the type by digit count and runs the correct checksum — and shows you the expected correct check digit when one is wrong.

How it works

Both systems use a weighted modulus-10 check digit, but with mirrored weight patterns:

  • EAN-13 (13 digits): alternate weights 1, 3, 1, 3, ... from the left — odd positions ×1, even positions ×3. Sum all 13 weighted digits; the barcode is valid when the total is divisible by 10.
  • UPC-A (12 digits): alternate weights 3, 1, 3, 1, ... from the left — odd positions ×3, even positions ×1. Sum all 12 weighted digits; valid when divisible by 10.

To compute what the check digit should be: weight the leading 12 (EAN-13) or 11 (UPC-A) digits, sum them, and take check = (10 − (sum mod 10)) mod 10.

Worked example — EAN-13 validation

Barcode: 4006381333931 (13 digits)

Position: 1  2  3  4  5  6  7  8  9  10 11 12 13
Digit:     4  0  0  6  3  8  1  3  3  3  9  3  1
Weight:    1  3  1  3  1  3  1  3  1  3  1  3  —
Product:   4  0  0  18 3  24 1  9  3  9  9  9
Sum = 4+0+0+18+3+24+1+9+3+9+9+9 = 89 + check digit 1 = 90 ✓ (divisible by 10)

The barcode is valid. The check digit 1 makes the total exactly 90.

The UPC-A / EAN-13 relationship

A UPC-A barcode is structurally identical to an EAN-13 with a leading zero prepended. The barcode 036000291452 (UPC-A) is the same product as 0036000291452 (EAN-13). This is why GS1 describes UPC-A as GTIN-12 — it is a subset of the Global Trade Item Number system, where EAN-13 is GTIN-13.

When a scanner reads a UPC-A, it can expand it to a 13-digit EAN-13 by prepending a 0, allowing the same database to handle both formats.

Structure of an EAN-13 number

DigitsComponentNotes
1–3GS1 Company Prefix (country or issuer)Not a “country of origin” — it identifies the GS1 member
4–12Company and product codeLength split depends on prefix length assigned
13Check digitComputed from the first 12

Prefixes starting with 50 are assigned to the UK. Prefixes 00–09 are US and Canada (UPC/EAN). Prefixes 978–979 are for books (ISBN). Prefix 977 is for periodicals (ISSN).

Common uses for this validator

  • E-commerce data entry: Verify barcode digits before uploading a product catalogue to Amazon, eBay, or Shopify.
  • Inventory management: Catch OCR transcription errors when barcodes are manually entered.
  • Print pre-flight: Confirm a barcode’s check digit matches before sending artwork to press.
  • Software development: Test barcode parsing code against known-valid and known-invalid inputs.

All validation runs locally in your browser — no barcode data is sent to a server.