EAN 13 Barcode Explained

Code EAN 13 Example

Introduction to EAN 13

Code EAN 13 is by far the most common barcode symbology worldwide. Used exclusively in retail and at the point-of-sale, almost every product carries an EAN barcode. EAN, short for European Article Numbering, is derived from the US-american UPC barcode symbology and was introduced in Europe in the early 1970s.

Contents:

  1. How to recognize an EAN 13 barcode
  2. EAN 13 vs UPC-A
  3. EAN 13 vs GTIN-13
  4. EAN 13 vs GTIN-14
  5. Data content of an EAN 13 barcode
  6. In-house EAN 13
  7. EAN 13 add-on codes
  8. EAN 13 SC sizes
  9. EAN 13 check digit calculation
  10. How to get an EAN 13 code
  11. Scanning EAN 13 barcodes
  12. EAN 13 printing considerations
  13. Online barcode generators for EAN 13
  14. Create EAN barcodes with a font
  15. Creating EAN 13 barcodes in Adobe Illustrator, InDesign
  16. Creating EAN 13 with a stand-alone barcode generator
  17. Bulk creating EAN 13
  18. Creating EAN 13 in Excel, Google Sheets
  19. Creating EAN 13 with Node JS, Python, C#, PHP, Java, Swift

How to recognize an EAN 13 barcode

An EAN 13 barcode is easily recognized: It always starts and ends with two thin bars, the "start" and "stop" patterns. It also has two thin bars right in the center of the symbol. When printed with human-readable text the first digit is placed to the left of the code. Additionally, a ">" (also known as light margin indicator or LMI) can be placed to the right of the code. Both features indicate the so called "quiet zones". This space must be kept free of other graphical elements.

A "module" is the thinnest bar of a barcode symbol. The selected SC size (see below) determines the width and height of a module from which all other dimensions are derived.

Here's the code from the introduction with annotations:

Annotated example of Code EAN 13

EAN 13 vs UPC-A

Major differences (and similarities) between EAN 13 and UPC-A:

  1. EAN 13 encodes thirteen digits (twelve digits for data, one check digit) while UPC-A encodes twelve digits (eleven for data plus check digit). Any UPC-A data string can be encoded into an EAN 13 symbol by prepending "0" (in lieu of the "country code") to the data.
     
  2. Bit patterns of EAN and UPC are actually identical, likewise the Modulo 10 check digit calculation is the same.

    Here's an example; both codes encode "01234567890" and have an identical check digit ("5"):

    Code EAN 13 vs UPC-A - Differences and Similarities
  3. Placement of human readable text is slightly different as can be seen in the image; with UPC-A, the first and the last digit are set outside the actual code symbol while with EAN only the first digit is outside. In both cases, the "external" digits have the purpose of keeping the space left and right of the code free of other graphical elements to improve the scanning reliability. With EAN, the standard recommends to add a ">" to the right of the code to assume the role of UPC's twelfth digit.

EAN 13 vs GTIN-13

Originally the 13 digit EAN number and the 13 digit EAN code were both referred to as EAN 13. Unifying the separate EAN and UPC standards under the GS1 umbrella introduced the GTIN (from Global Trade Item Number) to the world. The previous 13 digit EAN number became the GTIN-13 - another name but the same data content. With the introduction of new barcode symbologies (namely Code 128 GS1 and Data Matrix GS1) the EAN 13 barcode is now just one of several barcode symbologies that can be used to create a machine-readable representation of a GTIN-13.

EAN 13 vs GTIN-14

Any EAN 13 number (i.e. GTIN-13) can be converted into a GTIN-14 by prepending a "0" to the data. Once converted, the GTIN-14 can be encoded into Code 128 GS1, Data Matrix GS1 or ITF-14 barcodes.

Data content and format of an EAN 13 barcode

EAN 13 encodes twelve digits plus a mandatory check digit, hence the name EAN 13. The thirteen digits of an EAN 13 encode the following content:

Digit 1-2: Country identifier, e.g. 40, 41, 42 for Germany *

Digit 3-7: Manufacturer identifier **

Digit 8-12: Article number

Digit 13: Check digit

* Country code plus manufacturer identifier is also known as "company prefix", the two digits of the country code usually denote the country of the issuing GS1 branch; however, that's not necessarily the country where the article was produced. Codes beginning with "45" and "49" are used exclusively in Japan, here EAN 13 is referred to as JAN (Japanese Article Numbering).

** Length can vary; larger manufacturers have shorter IDs for a bigger pool of available article numbers; GS1 maintains a database of manufacturers

EAN 13 with Price (Restricted Circulation Numbers)

EAN 13 codes beginning with "20" - "29" are so-called in-store or in-house codes (officially: Restricted Circulation Numbers). They encode prices or weights, for example of produce or other articles where the sales price depends on the weight. Here's an example of an in-store EAN for salad that encodes a price (EUR 1.94):

EAN 13 In House Barcode with price

An identical code, created with the Softmatic Barcode Extension for Adobe Illustrator:

EAN 13 In Store Barcode

In-house EANs will literally only work properly at the store where they were created; in other stores the codes will be rejected at checkout.

EAN 13 Add-on Barcodes

An EAN 13 symbol can carry an add-on barcode, sometimes also called a satellite code. The add-on can encode another two or five digits of data. With such an add-on EAN 13 usually encodes an ISBN or ISSN.

Example EAN 13 with a five digit add-on code:

Sample Code EAN 13 with Add-on

EAN 13 SC Sizes

EAN 13 sizes are standardized (see this reference of EAN SC sizes). The module width and height are only allowed to vary within certain limits. The default, or 100%, size is called SC2. For SC2, the module width is set to 0.33mm, the height to 22.85mm. This yields a barcode that is roughly 26mm high and 37mm wide (including the textline and the left and right quiet zones):

EAN 13 Size and Dimensions

It is permitted to vary the module width down to 80% and up to 200%. In addition, it is permitted to reduce the height to some degree, this is also known as truncation. As a rule, the height of a standard-sized EAN 13 should not be below 10mm.

Example of a truncated EAN (50%):

Sample Code EAN 13 Truncated

Code EAN 13 check digit

EAN 13 uses a modulo 10 checksum scheme. Starting from the right the numbers are multiplied alternating with "3" and "1" and added up. The sum is integer divided by ten, the reminder (or modulo) is subtracted from ten which then yields the check digit.

Example Check Digit Calculation for Code EAN 13

Using the sample barcode from above, our numbers are "401234567890".

Summing up: 0 * 3 + 9 * 1 + 8 * 3 + 7 * 1 + 6 * 3 + 5 * 1 + 4 * 3 + 3 * 1 + 2 * 3 + 1 * 1 + 0 * 3 + 4 * 1 = 89
Dividing: 89 / 10 = 8 Reminder 9
Check digit: 10 - 9 = 1

Note that using a check digit is mandatory. A code without the proper check digit will not scan.

How to get an EAN 13 code

EAN numbers are maintained and issued by your country's GS1 branch, please see obtaining an EAN number for details. Only the national GS1 branches can issue valid (i.e. unique) company prefixes and numbers. Once you've been assigned a pool of EAN numbers, you can use one of Softmatic's barcode generators to create the actual, valid EAN 13 barcodes, see below for the various options.

NOTE: We do not recommend obtaining EAN 13 numbers from third parties who advertise on the Internet with slogans like "Only need one EAN barcode?". These vendors will sell you a number from their own pool, exploiting a (historic) loophole in the assignment of EAN / UPC numbers. While those numbers are in principle valid, there's no guarantee that they are actually unique.

Sample Code EAN 13

Sample shows an EAN 13 in SC 2 size with human-readable text and light margin indicator:

Code EAN 13 Example

Scanner recommendation for Code EAN 13

It is safe to assume that all barcode scanners available today support reading EAN 13. Especially older barcode scanners may have problems with codes printed with low resolution or when reading from a distance. Most current smartphones will also read EAN barcodes with the built-in camera, either with the "Camera" app or with a dedicated barcode scanner app.

EAN 13 is a very demanding barcode with tight tolerances in the range of 1/100mm (less than half a thou in inches). The minimum recommended print resolution is 300dpi. This is usually not a problem when printing the barcode with current laser or thermal printers. When printing with inkjets, choosing the right paper is paramount; most standard copier or laser paper will behave like blotting paper and cause so called ink spread. This effect will "thicken" the bars of the code, resulting in a symbol that does not conform to the standard.

In many cases, the barcode will have to be created with reduced bar width to compensate for ink spread or -growth. The amount of bar width reduction depends on the respective printing process. Laser, thermal or offset printing will have very low values (to the order of 0-2%) while silicon pad or screen printing will have higher values.

Printing EAN with dot-matrix printers is possible, provided the printer has at least a 24-pin print head and supports near letter quality (NLQ) with 300-plus dpi resolution. 9-pin printers do not have sufficient output resolution.

Online generators for EAN barcodes

A quick search for "create ean barcode online" will produce quite a few web services, some of which will also create EAN 13 codes. However, online generators are not without issues, especially when it comes to the very demanding and tightly specified EAN barcodes. We found that the created codes do often not comply with the GS1 standard; some generators will even let you enter arbitrary data, resulting in invalid codes. Here's an example EAN 13 from an online generator:

Online EAN Barcode Generator Wrong Check Digit

This is not a valid EAN 13 barcode; the final and check digit ("2") is wrong, it should be "7". As a result, this barcode will not scan. In addition, the GS1 makes precise requirements how to format and place the human readable text which the online generator clearly does not respect. It goes without saying that such a barcode will make your packaging or artwork look extremely unprofessional.

Compare to a standards compliant EAN 13:

Compliant EAN ISBN

Here's an example from another online barcode generator:

Online EAN Barcode Generator Sample Quality Issues

This online generator has the correct check digit but the text is far too small and the overall resolution is too low. This results in a symbol where the spaces and bars are very uneven; this is very noticable near the center of the code. The three single-width bars we highlighted in the image should all have the exact same width which they clearly don't. Likewise, the two-width bar directly to the left is far too thick. With some luck, the code will scan if printed with high enough resolution; however, it is evident that it does not comply with the standard and will fail a test with a barcode verifier.

Create EAN Barcodes with a font

Barcode fonts are a quick and easy way to create barcodes - provided the barcode is not too complicated, a good example would be Code 39. With EAN, using a barcode font is more involved because there is no direct mapping between the EAN number and the characters of the font. It is therefore not sufficient to simply select the numbers in Word, Excel or Google Docs and change the font to "EAN 13". Additional software is needed to calculate the check digit and format the number to work with the barcode font's character mapping.

Other problems come from the fact that the font renderer may try to "beautify" the text output. This causes small positional adjustments for each character which may render the code out of spec. Finally, as we've seen above, the created EAN barcode may require bar width reduction to compensate for ink spread, something that's impossible to achieve with a font.

Create EAN Barcodes in Illustrator, InDesign

Easy to use barcode plug-ins and extensions for the Adobe flagship applications, seen here in Adobe Illustrator:

Softmatic's extensions for Adobe InDesign, Illustrator und Photoshop let you create EAN 13 directly in your documents and designs. For more videos, see the Softmatic Youtube Channel.

The Softmatic barcode plug-ins and extensions for InDesign, Illustrator and Photoshop are available on the Adobe Exchange.

Stand-alone EAN 13 generator

Fast and easy creation of standards-compliant EAN 13 barcodes with BarcodePlus V5, Softmatic's time tested barcode generator:

EAN 13 Barcode Bulk Generator

For batch creation of EAN 13 and the related ISBN / ISSN codes, use Softmatic BarcodeFactory V5, our time-tested bulk barcode generator. The software will create thousands of EAN symbols in seconds, with data coming from the built-in serial number generator, the clipboard or via import from Excel, Numbers or CSV text files. Ideal for mass creation of artwork for packaging, book or magazine covers etc.:

Generate EAN 13 barcodes with a font in Excel or Google Sheets

An easy way to add EAN 13 codes to your spreadsheet is via a barcode font. An add-in or macro that is supplied with the font handles check digit calculation and data conversion to create a valid barcode, like in this example:

EAN 13 barcode font in Excel

More about the Softmatic EAN 13 add-in for Excel.

EAN 13 REST API - Node JS, Python, PHP, C#, Java, Swift

Developers love our easy to use Barcode REST API for Code EAN 13. The Barcode API supports all common linear and 2D code symbologies and can be used from JavaScript / Node, Ruby, Python, PHP, Swift and many other languages and environments. The API comes with a generous free tier and is available through RapidAPI. Documentation and sample code are here.