Home EAN-13 / barcode

EAN-13 / barcode validator

How the EAN-13 / barcode format works

Format
8, 12, 13 or 14 digit GS1 barcode number (EAN-8, UPC-A, EAN-13, GTIN-14)
Example
4006381333931

Things to watch for

  • Covers EAN-8, UPC-A (12 digits), EAN-13, and GTIN-14 — the check-digit algorithm is the same GS1 mod-10 for every length
  • A 12-digit UPC-A can be converted to EAN-13 by prefixing a 0, which does not change the check digit
  • The check digit is always the last digit — a barcode scanner rejects the same mismatches this validator does
  • Leading zeros matter — don't strip them when pasting a barcode number
Regex for EAN-13 / barcode
^[0-9]{8}$|^[0-9]{12,14}$

A barcode number is the string of digits printed under the black-and-white bars on a retail package — the part a cashier can type in by hand if the scanner fails to read it. It belongs to the GTIN (Global Trade Item Number) family managed by GS1, and it comes in a few lengths depending on where and how the product is sold: EAN-13 for general retail worldwide, UPC-A for North America, EAN-8 for small items where a full barcode won’t fit, and GTIN-14 for shipping cartons and cases rather than individual units. All four share the same underlying idea — every digit but the last identifies the country/company prefix and item reference, and the final digit exists purely to catch mistakes.

Why the check digit matters

That last digit is calculated from the ones before it using GS1’s mod-10 formula, the same algorithm every retail scanner runs before accepting a scan. Validating it before a number goes into a spreadsheet, product feed, or inventory system catches a transposed or mistyped digit early — the kind of error that otherwise surfaces later as a listing that won’t scan at checkout or a catalogue import that silently rejects a row.

What a pass doesn’t tell you

A pass here means the number is the right length for its type and the check digit is arithmetically correct — nothing more. It does not confirm the number is actually assigned to a product, that the product exists, or what that product is. Two different-looking barcode numbers can both be perfectly valid and still refer to nothing real, since validation and registration are separate systems. If you need to know what a specific GTIN identifies, a GS1 GEPIR lookup or a commercial product database is the right next step — this tool only checks the math.

Content last reviewed 2026-07-09.

EAN-13 / barcode FAQ

What's the difference between EAN-13 and UPC-A?

UPC-A is the 12-digit code used mainly in North America; EAN-13 is the 13-digit code used almost everywhere else. A UPC-A number converts to EAN-13 by adding a leading zero, and the check digit doesn't change — so the same product can carry either form depending on where it was scanned into a system.

How is the last digit of a barcode number calculated?

It's a GS1 mod-10 checksum: each of the preceding digits is multiplied by an alternating weight of 1 and 3, the results are summed, and the check digit is whatever value brings that sum to the next multiple of ten. Every GTIN length — EAN-8, UPC-A, EAN-13, GTIN-14 — uses this same rule.

Does a valid barcode number tell me what the product actually is?

No. A pass only confirms the digits are the right length and the check digit is mathematically correct — it says nothing about which product, brand, or listing that number belongs to. To look up the actual product, use a GS1 GEPIR search or a product database that maps GTINs to real listings.

← More EAN-13 / barcode validators