Barcode Generator
Generate Code 128 and EAN-13 barcodes — download as PNG or SVG.
Written by Anil Gautam · Updated
What can you encode with Code 128?
Code 128 mode encodes text with Code Set B, which covers printable ASCII: capital and small letters, digits, the space and standard punctuation. Each character becomes a pattern 11 modules wide (a module is the narrowest bar or gap), and the tool adds a start symbol, a check symbol from a modulo-103 sum and a stop symbol. The check symbol lives only in the bars, so the caption shows exactly what you typed.
Width grows with the text: 11 modules per character plus 35 for the start, check and stop symbols, at 2 pixels per module. The default value, OneClickUse123, has 14 characters and comes out at 189 modules, an image 378 pixels wide and 110 tall at the default bar height of 80 (the extra 30 pixels hold the caption). Characters outside ASCII, such as the euro sign or accented letters, are encoded as a space: €100 gives exactly the same bars as a space followed by 100, while the caption still shows the euro sign.
How does the EAN-13 option work?
In EAN-13 mode the tool ignores everything except digits, keeps the first 12 and adds a 13th check digit. The rule weights the digits 1, 3, 1, 3 and so on from the left, adds them up and picks the digit that brings the total up to a multiple of 10. For 123456789012 the weighted sum is 92, so the check digit is 8 and the caption reads 1234567890128. Paste a full 13-digit number and its last digit is replaced by the computed one, a quick way to confirm a printed check digit.
Bars in this mode follow the EAN-13 standard used on retail packaging: a symbol 95 modules wide with start, centre and end guard bars, where the first digit is not drawn as bars but sets the pattern of the left six digits. Checkout scanners that accept EAN and UPC read it. Products sold in shops also need a number assigned through GS1, the organization that issues retail product numbers.
Does the download include a white margin?
Yes. Scanners need a clear quiet zone on both sides, so the PNG and SVG files include one: 10 modules on each side for Code 128, which is 20 pixels at the file's native size, and 11 modules on the left and 7 on the right for EAN-13. Keep that white space when you place the barcode on a label, and do not crop it away.
The PNG is rendered at 2 pixels per module, so enlarging it for print softens the bar edges. Vector SVG files scale cleanly in a label or layout program; resize the width as a whole and change the height freely, since only the bar widths carry data. For a web address or a long block of text, the QR Code Generator gives a more compact code that phone camera apps open directly.