Understanding Barcode Specifications Completely (with Sample Barcodes)

A barcode is a one-dimensional symbol that represents information through combinations of the widths of bars (lines) and spaces (gaps). From the JAN code on a product to a logistics management label, the characters that can be handled and the use cases differ by standard (symbology). In this article we explain the specifications of the major barcodes, together with samples generated for real.

The sample barcodes on this page are generated on the spot inside your browser. Try scanning them with a barcode reader app to check them for yourself.

1. The basic structure of one-dimensional codes

Most one-dimensional barcodes are made up of the following elements.

2. Major symbologies (standards)

StandardCharacters supportedNumber of digitsMain use
EAN-13 / JAN-13Digits13 (1 of which is a CD)Globally shared product code (JAN in Japan)
EAN-8 / JAN-8Digits8 (1 of which is a CD)Short version for small products
UPC-ADigits12 (1 of which is a CD)North American product code
CODE39Digits, uppercase letters, symbolsVariableIndustry, logistics, automotive parts
CODE128Full ASCIIVariableLogistics, shipping labels (basis of GS1-128)
ITF (ITF-14)Digits (even number of digits)Variable/14Cartons and other group packaging
Codabar (NW-7)Digits, some symbolsVariableLibraries, blood bags, courier delivery
MSIDigitsVariableInventory management, shelf labels

3. Seen in real samples

We generated representative standards for real. Pay attention to differences such as the density of the bars and how characters are handled.

4. How EAN/JAN works and the check digit

Japan's JAN code is the same standard as EAN-13, and the first two (or three) digits represent the country code. Japan begins with "45" or "49". This is followed by the manufacturer code and the product item code, with the final digit being the check digit.

Calculating the check digit (modulo 10 / weight 3-1)

The EAN-13 check digit is obtained with the following procedure.

  1. Counting from the rightmost digit, multiply the sum of the even-position digits by 3 and the sum of the odd-position digits by 1.
  2. Find that total.
  3. Subtract the remainder of the total divided by 10 from 10 (if the remainder is 0, the result is 0).
Because of the check digit, typical errors can be detected, such as a single-digit misread or the transposition of adjacent digits. With the generator tool on this site, the CD is calculated automatically, so you only need to enter the main number (12 digits for EAN-13) to create the code.

5. The difference between one-dimensional codes and two-dimensional codes (QR)

AspectOne-dimensional (barcode)Two-dimensional (QR, etc.)
Data volumeSmall (around a few dozen characters)Large (thousands of characters)
DirectionHorizontal onlyReadable from any direction
Error correctionMainly a check digitRecoverable with Reed-Solomon
Main useProduct codes, inventoryURLs, payments, tickets

The QR code specification is explained in a separate article, "Understanding QR Code Specifications Completely".

Free Tool Create one for real with the Barcode Generator Generate various standards including CODE128, EAN/JAN, UPC and CODE39 by specifying bar width, height, color and margins, and download as PNG / SVG.

Frequently Asked Questions (FAQ)

Are JAN codes and EAN-13 the same thing?

Japan's JAN code is the same standard as EAN-13. It has 13 digits, where the first two (or three) digits represent the country code; Japan begins with "45" or "49". This is followed by the manufacturer code and the product item code, with the final digit being the check digit.

What is the purpose of a check digit?

It is a verification digit used to prevent misreads. With it, typical errors such as a single-digit misread or the transposition of adjacent digits can be detected. In EAN-13 it is calculated using the modulo 10 / weight 3-1 method.

What is the difference between one-dimensional barcodes and two-dimensional codes (QR)?

One-dimensional barcodes hold little data (around a few dozen characters), are read only horizontally, and rely mainly on a check digit for error handling. Two-dimensional codes such as QR can hold thousands of characters, can be read from any direction, and can be recovered using Reed-Solomon codes.

← Back to the Tech Blog list