JTBarton.com

Skip Navigation Links
Home
Barcode overview
SQL playground
Web Cameras
Personal information
Developer links
About Web Host
Contact Me
Sign In

Free Barcode Font - Code 128

Code 128 is variable length format that can be read in either direction and incorporates a checksum for built in validation. Code 128 was designed to reduce the amount of space required by the Code 39 format which it does by about 30%, and to include the full ASCII character set, with both upper and lower case alphabetical characters, and punctuation.
There are three different sets of characters that are represent by 106 different barcodes, these are shown in the table  at the bottom of this page.
  • Set A - Capital letters, numeric values, control codes, punctuation
  • Set B - Capital letters, numeric values, lowercase letters, punctuation
  • Set C - Double density numeric values from 00 through to 99
All set can be started, switch to another set and provide a stop mark.

Checksum calculation

The checksum for code 128 is mandatory and is calculated by adding the weighting value of the character position to the character number and then applying a a modulus of 103, this is probably best explained with a example:

Lets encode the word “BarCode
Character Value Weighted value Total
Start Set B 104 104 104
B 34 34 * 1 34
a 65 65 * 2 130
r 82 82 * 3 246
C 35 35 * 4 140
o 79 79 * 5 395
d 68 68 * 6 408
e 69 69 * 7 483
Total 1940

This results in a modulus of 86, i.e. 1940 / 103 = 18 remainder 86, so the checksum value is 86 represented by the 'v' character.
So the fully encoded barcode becomes: 104(start set B)+34(B)+65(a)+82(r)+35(C)+79(o)+68(d)+69(e)+86(v)+106(stop)

As you can see from the above example this can become quite complicated to calculate, especially when you need to start swapping between sets to produce the optimal barcode, fortunately the code to calculate this optimization including the checksum algorithm with the start hand stop characters built into the barcode has been done by myself and others.

Free Barcode Font (code 128) and String Builder

Font

The code 128 font is freely available for download, no catches, no costs, just free.
 Click to download Code 128 Font
To install the font, click on the barcode above and then select 'Save' placing the file into the %WinDir%\Fonts folder.
For most users this folder will be: C:\Windows\Fonts

This font does not include any leading or trailing spaces within the start and stop characters, for the original version of this font which includes white spacing see below.

String Builder

A small static class written in C# is also available to generate the required output characters is available free from here. This is provided as a .net assembly for use in any .net language, the source code is also available along with coding examples.


Original Font and older code

The font was originally created by
grandzebu.net  where you can download the original font and see other coding examples in other older languages such as FoxPro, Delphi, VB6 and others (look towards the bottom of the page for this information)
Be aware, this site is in French, but there is an English version for most of the information which is where the above link will redirect you.


Code 128 definition table

Value Set
A
Set
B
Set
C
ASCII
Code
Character Pattern Value Set
A
Set
B
Set
C
ASCII
Code
Character Pattern
0 Space Space 00 0032
or
0207
Space
or
Ï
11011001100 54 V V 54 0086 V 11101011000
1 ! ! 01 0033 ! 11001101100 55 W W 55 0087 W 11101000110
2 " " 02 0034 " 11001100110 56 X X 56 0088 X 11100010110
3 # # 03 0035 # 10010011000 57 Y Y 57 0089 Y 11101101000
4 $ $ 04 0036 $ 10010001100 58 Z Z 58 0090 Z 11101100010
5 % % 05 0037 % 10001001100 59 [ [ 59 0091 [ 11100011010
6 & & 06 0038 & 10011001000 60 \ \ 60 0092 \ 11101111010
7 ' ' 07 0039 ' 10011000100 61 ] ] 61 0093 ] 11001000010
8 ( ( 08 0040 ( 10001100100 62 ^ ^ 62 0094 ^ 11110001010
9 ) ) 09 0041 ) 11001001000 63 _ _ 63 0095 _ 10100110000
10 * * 10 0042 * 11001000100 64 nul ` 64 0096 ` 10100001100
11 + + 11 0043 + 11000100100 65 soh a 65 0097 a 10010110000
12 , , 12 0044 , 10110011100 66 stx b 66 0098 b 10010000110
13 - - 13 0045 - 10011011100 67 etx c 67 0099 c 10000101100
14 . . 14 0046 . 10011001110 68 eot d 68 0100 d 10000100110
15 / / 15 0047 / 10111001100 69 eno e 69 0101 e 10110010000
16 0 0 16 0048 0 10011101100 70 ack f 70 0102 f 10110000100
17 1 1 17 0049 1 10011100110 71 bel g 71 0103 g 10011010000
18 2 2 18 0050 2 11001110010 72 bs h 72 0104 h 10011000010
19 3 3 19 0051 3 11001011100 73 ht i 73 0105 i 10000110100
20 4 4 20 0052 4 11001001110 74 lf j 74 0106 j 10000110010
21 5 5 21 0053 5 11011100100 75 vt k 75 0107 k 11000010010
22 6 6 22 0054 6 11001110100 76 ff l 76 0108 l 11001010000
23 7 7 23 0055 7 11101101110 77 cr m 77 0109 m 11110111010
24 8 8 24 0056 8 11101001100 78 s0 n 78 0110 n 11000010100
25 9 9 25 0057 9 11100101100 79 s1 o 79 0111 o 10001111010
26 : : 26 0058 : 11100100110 80 dle p 80 0112 p 10100111100
27 ; ; 27 0059 ; 11101100100 81 dc1 q 81 0113 q 10010111100
28 < < 28 0060 < 11100110100 82 dc2 r 82 0114 r 10010011110
29 = = 29 0061 = 11100110010 83 dc3 s 83 0115 s 10111100100
30 > > 30 0062 > 11011011000 84 dc4 t 84 0116 t 10011110100
31 ? ? 31 0063 ? 11011000110 85 nak u 85 0117 u 10011110010
32 @ @ 32 0064 @ 11000110110 86 syn v 86 0118 v 11110100100
33 A A 33 0065 A 10100011000 87 etb w 87 0119 w 11110010100
34 B B 34 0066 B 10001011000 88 can x 88 0120 x 11110010010
35 C C 35 0067 C 10001000110 89 em y 89 0121 y 11011011110
36 D D 36 0068 D 10110001000 90 sub z 90 0122 z 11011110110
37 E E 37 0069 E 10001101000 91 esc { 91 0123 { 11110110110
38 F F 38 0070 F 10001100010 92 fs | 92 0124 | 10101111000
39 G G 39 0071 G 11010001000 93 gs } 93 0125 } 10100011110
40 H H 40 0072 H 11000101000 94 rs ~ 94 0126 ~ 10001011110
41 I I 41 0073 I 11000100010 95 us del 95 0195 Ã 10111101000
42 J J 42 0074 J 10110111000 96 Fnc 3 Fnc 3 96 0196 Ä 10111100010
43 K K 43 0075 K 10110001110 97 Fnc 2 Fnc2 97 0197 Å 11110101000
44 L L 44 0076 L 10001101110 98 Shift Shift 98 0198 Æ 11110100010
45 M M 45 0077 M 10111011000 99 Code C Code C 99 0199 Ç 10111011110
46 N N 46 0078 N 10111000110 100 Code B Fnc 4 Code B 0200 È 10111101110
47 O O 47 0079 O 10001110110 101 Fnc 4 Code A Code A 0201 É 11101011110
48 P P 48 0080 P 11101110110 102 Fnc 1 Fnc 1 Fnc 1 0202 Ê 11110101110
49 Q Q 49 0081 Q 11010001110 103 Start A Start A Start A 0203 Ë 11010000100
50 R R 50 0082 R 11000101110 104 Start B Start B Start B 0204 Ì 11010010000
51 S S 51 0083 S 11011101000 105 Start C Start C Start C 0205 Í 11010011100
52 T T 52 0084 T 11011100010 106 Stop Stop Stop 0206 Î 1100011101011
53 U U 53 0085 U 11011101110