EAN-13 number generator — test barcodes and check digit calculator

Generate 13-digit EAN test numbers with a correct check digit, starting 20–29 so they stay clear of real products, or type the first 12 digits of any EAN to get its check digit.

Live demo · real result from this tool
Mode

Press Generate to create a result.

Processed on your device — nothing is uploaded.

How to use the EAN-13 generator

  1. Choose the Mode: Generate test values or Validate or complete.
  2. To generate, choose a Prefix: 20–29: restricted circulation (in-store use; safe for tests) or Any prefix (may collide with real products). Set How many (up to 500) and press Generate.
  3. To check a number, type it into EAN-13 (or the first 12 digits to get the check digit). Spaces and dashes are ignored.
  4. With 12 digits you get the Check digit and the Full EAN-13. With 13 digits you get Result, Check digit given and Check digit expected.

What it does and when to use it

EAN-13 is the barcode number on most retail products outside North America. Point-of-sale systems, stock apps and online shops all check its last digit. Developers and testers need valid numbers to fill product tables and test scanners without using someone else’s real product codes. Shop owners sometimes need a quick check digit when they label their own items for in-store use.

The validator catches typing mistakes, because changing any single digit changes the check digit. For the shorter code on small packs, see the EAN-8 generator. For the 12-digit North American version, use the UPC-A generator. For internal stock codes without a barcode standard, the serial number generator may suit you better.

How it works

The check digit uses the GS1 mod-10 method:

  1. Take the first 12 digits. Counting from the left, multiply digits in odd positions by 1 and in even positions by 3.
  2. Add the results.
  3. The check digit is the amount needed to reach the next multiple of 10 (0 if the sum already is one).

For generated numbers, the first two digits come from 20–29 (or anything, with Any prefix), the other ten are random from crypto.getRandomValues, and the check digit is added.

Worked examples

  • A real product code. 4006381333931 gives Result: Valid. For the first 12 digits, 4×1 + 0×3 + 0×1 + 6×3 + 3×1 + 8×3 + 1×1 + 3×3 + 3×1 + 3×3 + 9×1 + 3×3 = 89, and 90 − 89 = 1, the last digit.
  • Completing a number. Typing 590123412345 returns Check digit: 7 and Full EAN-13: 5901234123457.
  • A typo. 4006381333932 gives Result: Invalid with Check digit expected: 1.
  • Test numbers. One run gave 2366010546814 and 2933776035434, followed by the note “Test values only: they pass the check-digit rules but are random…”.

Limits and tips

  • A valid check digit does not mean the product exists. Only GS1’s registry can tell you who owns a number.
  • Numbers of the wrong length get a short message, such as “An EAN-13 has 13 characters; this has 8.”
  • Some shops encode price or weight inside 20–29 numbers. Check your till system’s rules before using them in-store.

Frequently asked questions

Can I print these numbers on products I sell?
No. Numbers for goods sold through shops and marketplaces must come from GS1, the organisation that issues company prefixes. Generated numbers are format-valid test values only. Using made-up EANs on real listings can get them removed and may break marketplace rules.
Why do the test numbers start with 20 to 29?
GS1 keeps the prefixes 20–29 for restricted circulation, meaning numbers a shop assigns for its own internal use. They are not given to brand owners, so a test number in that range will not clash with a real product. The Any prefix option drops this protection.
How do I turn the number into a barcode image?
Copy the 13 digits into the barcode generator and choose the EAN-13 type. The check digit must already be correct, which it will be for numbers from this page.
Is an EAN the same as a GTIN-13?
Yes. GTIN-13 is GS1's current name; EAN-13 is the older and still common one. Many retailers also call it a European Article Number or simply the barcode number.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close