﻿ EAN-13 Barcode makebarcode.com

# EAN-13 EAN-13 is used world-wide for marking retail goods. The symbol encodes 13 characters: the first two or three are a country code which identifies the country in which the manufacturer is registered (not necessarily where the product is actually made).  The country code is followed by 9 or 10 data digits (depending on the length of the country code) and a single digit checksum. 2-digit and 5-digit supplemental barcodes may be added for a total of 14 or 17 data digits.

The USA has begun the process of moving to the EAN-13 symbol, known as the UPC-13 symbol in the USA.  Existing UPC-A codes do not have to be changed, but new identification numbers issued will follow the UPC-13 format. This means that imported products labeled with EAN-13 codes do not have to be re-labeled for USA retail sale.  The official date by which all retail scanning systems were required to accept the EAN-13 code was January 1, 2005.

The Uniform Code Council (registrar for the USA) and the European Article Numbering organization (registrar for the rest of the world) have merged into a single organization: GS1. Visit their website and click on the Contact link to find the office for any country in the world.

The checksum (last digit in the barcode) is a Modulo 10 calculation:

1. Add the values of the digits in the even-numbered positions: 2, 4, 6, etc.
2. Multiply this result by 3.
3. Add the values of the digits in the odd-numbered positions: 1, 3, 5, etc.
4. Sum the results of steps 2 and 3.
5. The check character is the smallest number which, when added to the result in step 4, produces a multiple of 10.

Example: Assume the barcode data = 001234567890

1. 0 + 2 + 4 + 6 + 8 + 0 = 20
2. 20 * 3 = 60
3. 0 + 1 + 3 + 5 + 7 + 9 = 25
4. 60 + 25 = 85
5. 85 + X = 90 (nearest equal or higher multiple of 10), therefore X = 5 (checksum)

Here is a sample Visual Basic function to calculate the checksum:

``` Function Append_EAN_Checksum (RawString as String) Dim Position as Integer Dim CheckSum as Integer CheckSum = 0 For Position = 2 to 12 step 2 Checksum = Checksum + Val(Mid\$(RawString, Position, 1)) Next Position CheckSum = CheckSum * 3 For Position = 1 to 11 Step 2 CheckSum = CheckSum + Val(Mid\$(RawString, Position, 1)) Next Position CheckSum = CheckSum Mod 10 CheckSum = 10 - CheckSum If CheckSum = 10 Then CheckSum = 0 End If Append_Ean_Checksum = RawString Format\$(CheckSum, "0") End Function ```