How to use it
- Choose Code 128 or EAN-13.
- Type the content. Both formats show an example you can replace.
- Pick colours if you need something other than black on white, then press Download PNG or Download SVG.
Use SVG for print, because it stays sharp at any size. PNG is handy for documents and web pages.
How the encoders work
Code 128. Every character is a symbol of 11 modules (three bars and three spaces). A message is a start symbol, the character values, a check symbol and a stop symbol. The check symbol is the start value plus each character value multiplied by its position, taken modulo 103. A string of digits with an even length uses the compact subset C, which packs two digits into one symbol; anything else uses subset B, which covers ASCII 32 to 126.
EAN-13. 13 digits become 95 modules: a start guard, six digits on the left, a centre guard, six digits on the right and an end guard. The first digit is not drawn directly; it selects which of two patterns (L or G) is used for each digit on the left.
Example
The text A in Code 128 has start value 104, character value 33 and check value (104 + 33) mod 103 = 34, so the symbols are 104, 33, 34 followed by the stop.
Tips
- Keep the empty margin around the bars; scanners need it.
- Do not stretch the image in one direction. Scale it evenly.
- Very long Code 128 text makes a wide barcode that is hard to scan on small labels.