### EAN code encoding

The 13-digit EAN code consists of a string of 12 digits plus a verification number at the end. The 12-digit numbers are a unique string that has never been assigned to a retail product before, Corrects the last digits for errors in scanning or data entry. There is a 5-step process used to calculate the verification number based on the previous 12 digits:

1: Start at the end of the barcode number and add each alternate number. Do not include the test number if it already exists. for example , If our barcode number is 0712345678911, So we will remove the number 1 at the end (because it is the verification number), Then we add every second number that starts on the right side. So we get 1 + 8 + 6 + 4 + 2 + 7 = 28

2: Multiply the result from the previous step by 3. 28 x 3 = 84

3: sum up all the remaining numbers (except for the checkbox again if it exists), So in our example this would be 0 + 1 + 3 + 5 + 7 + 9 = 25

4: Add the result from step 3 to the result from step 4. 84 + 25 = 109

5: The check number is the smallest number that can be added to the result of step 4 to create a multiple of 10. So in our case, We can add 1 to 109 to get 110, multiplier 10. This makes 1 our check box. The black bars of a barcode encode the numbers represented under them in a format that can be read by a digital scanner. Each number is represented by two black bars and two white blank spaces. The width of bars and spaces is what distinguishes the numbers when scanning a barcode. There are three different encoders (different bar combinations for each number from 0 to 9), They are known as L, G and R. All EAN barcodes begin with the coded L number and end with the coded R number, Which means that scanners can identify the start and end of a barcode and thus scan it upside down without problems. 