EAN13.ttf bulk encoder

Use this tool to generate alphanumeric string for EAN13.ttf font.
  1. Enter a single EAN-13 code (12 or 13 digits) or a list of codes, with each code on a separate line. The tool will calculate the checksum digit in any case.
  2. Click the "Make" button to convert it into an alphanumeric string for the EAN13.ttf font, available for download from Grandzebu.net.
  3. Copy and paste the alphanumeric string wherever you want and apply the EAN13.ttf font to the alphanumeric string to display a barcode that is readable by a scanner.
  4. Tested on Mac, Windows and Linux. It works in Office, Libreoffice and Adobe Suite. It is also useful for generating barcodes from CSV files.

For instructions and examples see below. The source code is hosted on GitHub. Before using this tool, read the LEGAL NOTES/DISCLAIMER.

How encoding of the alphanumeric string works

The original and complete explanation of EAN-13.ttf font can be found on the Grandzebu.net website.

We will omit the sizing of the EAN-13 bars and its functioning; our goal is to create barcodes using the appropriate font. The encoding of the alphanumeric string for the EAN13.ttf font is based on a mapping system that uses three character sets (A, B, and C) and a predefined pattern to determine how to encode each digit of the barcode.

Step 1: Checksum calculation

  • The base input is a 12-digit number from left to right.
  • The checksum (13th digit, on the far right) ensures the code's validity and can be verified by a scanner.
  • Checksum calculation formula:
    • If digits is taken from left to right:
      • sum the digits in odd position (1st, 3rd, 5th, etc.)
      • sum the digits in even positions (2nd, 4th, 6th, etc.) multiplied by 3.
    • If digits is taken from right to left:
      • sum the digits in odd position (1st, 3rd, 5th, etc.) multiplied by 3.
      • sum the digits in even positions (2nd, 4th, 6th, etc.).
    • Calculate the total sum.
    • The checksum is the difference between the next multiple of 10 and the total sum.

Step 2: encoding pattern from the dirst digit:

In this case, digits are always from left to right. The first digit of the code determines which pattern to use for encoding the next 6 digits (2-7).

First Digits Pattern
0 AAAAAA
1 AABABB
2 AABBAB
3 AABBBA
4 ABAABB
5 ABBAAB
6 ABBBAA
7 ABABAB
8 ABABBA
9 ABBABA

Step 3: Character Sets:

Digits are converted into letters using three character sets. The digits 2-7 according to the pattern, the digits 8-12 and last 13 digit(the checksum) is converted into letters according Set C.

Digit Set A Set B Set C
0 A K a
1 B L b
2 C M c
3 D N d
4 E O e
5 F P f
6 G Q g
7 H R h
8 I S i
9 J T j

Step 4: Final String Construction:

  • The first digits as is.
  • The next 6 characters, encoded based on the pattern (Set A or B).
  • The central separator *
  • The last 6 characters, encoded with Set C.
  • The checksum, encoded with Set C.
  • The final separator +.

Example of manual calculation

Code: 123456789012

Steps:

  1. Checksum Calculation.
    • Odd-position digits: 1 + 3 + 5 + 7 + 9 + 1 = 26
    • Even-position digits (multiplied by 3): (2 + 4 + 6 + 8 + 0 + 2) * 3 = 66
    • Total sum: 26 + 66 = 92. The next multiple of 10 is 100.
    • Checksum: 100 – 92 = 8
  2. Pattern for encoding the first 6 digits, determined by the first character (1).

    From the table, the pattern is: AABABB.

  3. Digits encoding according to pattern AABABB.
  4. First 6 digits (234567):
    • 2 → Set A → Character: C
    • 3 → Set A → Character: D
    • 4 → Set B → Character: O
    • 5 → Set A → Character: F
    • 6 → Set B → Character: Q
    • 7 → Set B → Character: R
    Central separator: *
    Last 6 digits (890128), encoded with Set C:
    • 8 → Set C → Character: i
    • 9 → Set C → Character: j
    • 0 → Set C → Character: a
    • 1 → Set C → Character: b
    • 2 → Set C → Character: c
    • Checksum (8) → Set C → Character: i
    • The final separator: +
  5. Final String.

    The resulting alphanumeric string is: 1CDOFQR*ijabci+

When you apply the EAN13.ttf font from Grandzebu.net to this alphanumeric string, you will obtain the barcode.

Comments