## Bar Code 25 Implementation

Code 25 (Interleaved 2 of 5) is numbers only (each character is 0 thru 9).

Minimum space when document will be scanned:

 # digits of datadon't count start/stop characters length (in) height (in) including quiet zone 4 0.9 0.2 6 1.2 0.3 8 1.5 0.3 10 1.8 0.4 12 2.1 0.4 14 2.4 0.5

For documents that will be scanned:
quiet zone: 3/16" minimum
aspect ratio: 4:1 (tolerates 10° of skew, increasing the height to 3:1 ratio will tolerate 15° of skew)
density: 6.5 characters/in
There is no space required above or below the bars.

### Check Digits for Bar Code 25

Acordex recommends the use of a checksum for all bar codes. By convention, Bar Code 25 uses a weighted Modulo 10 scheme. The check digit is the last character in the bar code. Since Bar Code 25 must always have an even number of digits, the leftmost character may need to be a zero when the check digit is added. The standard check digit is calculated by assigning alternating 3,1,3,1.. weights to respective data digits. These weights are then multiplied by their respective data digits and the products are summed. The check digit is the digit needed to be added to the sum to make it an even multiple of 10. An example would be if the sum of the products was 37, the check digit would be 3.

Here is another explanation of how to calculate the check digit. Starting with the left most character, multiply every other digit (odd positions) by 3 and sum the results with the values of the even positions. (The check digit is always an even position so it is never multiplied by 3.) The sum should be a multiple of 10. To compute the check digit for printing a bar code, perform the summing operation above without the check digit, do a modulo 10 on the result, and subtract the value from 10 to yield the check digit. (If you start with an even number of digits, make sure you add a leading zero before you do the calculation.)

Note: When printing bar codes the check digit should NOT be printed in the human readable number above the bar code. The user does not enter the check digit in the event that the bar code cannot be automatically read and would be confused by the extra digit that is not part of the document number.

For example if the number to be bar coded was:
`1234567`
then the sum would be:
`(1*3) + (2*1) + (3*3) + (4*1) + (5*3) + (6*1) + (7*3) =`
`3 + 2 + 9 + 4 + 15 + 6 + 21 = 60`
remainder of `60/10 = 0`
check digit = `10 - 0 = 0`
barcoded number = `12345670`

Another example if the number to be bar coded was:
`83456`
`(8*3) + (3*1) + (4*3) + (5*1) + (6*3) =`
`24 + 3 + 12 + 5 + 18 = 62`
remainder of `62/10 = 2`
check digit = `10 - 2 = 8`
barcoded number = `834568`

Try a checksum calculation.
Input string:
BarCode 25 checksum:

### Check Your Bar Code 25

After you print your bar code, check that it conforms to the Bar Code 2 of 5 specification. Here's how a visual inspection can be easily accomplished:

1. Bar code 25 must have a quiet zone before the bars start and after the bars end. Check that both are at least 3/16" for optimal reading.
2. Bar code 25 must have a start character. Check that your bar code starts with: Narrow bar, Narrow space, Narrow bar, Narrow space.
3. The first digit of the encoded data is encoded in the bars and the next digit is encoded in the spaces. Similarly, the third digit is coded in the bars and the fourth digit in the spaces, and so on. The encoded digits are "Interleaved" together. Look up each digit in your data, and check that the bars (or spaces) match the Narrow/Wide (N W) sequence in the adjacent table.
4. Bar code 25 must end with the stop character. Check that your bar code ends with: Wide bar, Narrow space, Narrow bar.
5. There is no space required above or below the bars.
Bar Code 25
NumberPattern
0N N W W N
1W N N N W
2N W N N W
3W W N N N
4N N W N W
5W N W N N
6N W W N N
7N N N W W
8W N N W N
9N W N W N