## Code 25 barcode specification

Example:

Code 2 of 5 is a popular barcode for encoding numeric data.

Key features:

- 2 different width of bar/space.
- Symbol set consists of digits 0-9
- Each character is made up of 2 wide and 3 narrow elements.
- Start sequence is narrow bar, narrow space, narrow bar, narrow space.
- End sequence is wide bar, narrow space, narrow bar.
- Characters are encoded in pairs consisting of 5 bars and 5 spaces. The bars encode the first character of a pair and the spaces encode the other.
- No spaces between the pairs of characters ensure a higher density than non-interleaved variants.
- The number of bars plus 1 must be divisible by 5.
- Optional checksum character.
- An odd number of characters should be padded with a leading zero before encoding.

**Specification:**

Due to the nature of the interleaved format the Visual Pattern shows the character as it would appear in the bars of a character pair. The spaces are not set for any particular character.

Symbol | Narrow/Wide Pattern | Visual Pattern |

0 | NNWWN | |

1 | WNNNW | |

2 | NWNNW | |

3 | WWNNN | |

4 | NNWNW | |

5 | WNWNN | |

6 | NWWNN | |

7 | NNNWW | |

8 | WNNWN | |

9 | NWNWN |

Note that the petterns for the above characters exactly match the black bars for the same characters in Code 39.

Example: The character pair 58 would be encoded by the pattern enclosed in the following box:

**Checksum Calculation:**

- Identify odd/even character positions. The right hand most character is always even.
- Sum all the characters in odd positions.
- Sum all the characters in even positions and multiply by 3.
- Add the values from steps 2 and 3
- Determine the smallest value, which when added to result of step 4, gives a multiple of 10. This is the cheksum character.

Example:

To calculate the checksum for the number 33589

Sum of odd characters = 3 + 8 = 11

Sum of even characters = 3 + 5 + 9 = 17 X 3 = 51

11 + 51 = 62

62 + 8 = 70 (which is divisible by 10), so the checksum character is 8.

Note that if the original number of digits is even then a leading zero should be added either before or after the checksum calculation.