Code 128 Barcode Generator for Text, Free
Make a Code 128 barcode from any ASCII text in your browser. The best of sets A, B and C is chosen for you, with the check symbol added. Download SVG or PNG. Nothing is uploaded.
Any ASCII text. The check symbol is added for you.
308 by 122 px.
About the Code 128 Barcode Generator
The Code 128 Barcode Generator draws a compact barcode for text and numbers, the kind used on shipping labels, parcels, asset tags and warehouse shelves. This page opens the same tool as the Barcode Generator, pre-set to Code 128. The value you type and the barcode you download stay in your browser. They never leave your device, and nothing is uploaded or stored.
How to make a Code 128 barcode
Steps
- Type the text or number into Value. Any ASCII character from 0 to 127 is accepted.
- Use Bar width to set the thickness of the narrowest bar and Height for the bar length.
- Keep the Margin so the scanner can find the start of the barcode, and choose whether to Show the text under the bars.
- Press Download SVG for print, Download PNG for a document, or Copy SVG to paste the markup.
Character sets A, B and C
Code 128 has three character sets. Set A covers uppercase letters, digits and control characters, set B covers uppercase and lowercase letters, digits and punctuation, and set C packs two digits into one symbol. The encoder chooses the shortest combination for your text and switches sets where it saves space. Set C is used for runs of 4 or more digits at the start or end of the value, or 6 or more in the middle, which is why long numbers such as order IDs make a narrower barcode than the same text would. You do not pick a set yourself.
The check symbol
Every Code 128 barcode ends with a check symbol, calculated modulo 103 from the symbols before it. A scanner recomputes it and rejects the read if it does not match, which stops most misreads. The check symbol is part of the bars but it is not printed in the text under them, so the line beneath the barcode shows only your value. Do not try to type it yourself.
Width
Each symbol is 11 modules wide, and the stop pattern is 13. The barcode gets longer as the value does, and the note under the preview shows the pixel size. For a long value, a smaller Bar width makes a shorter barcode, but keep it at 2 px or more on screen and check that your printer and scanner can still handle it.
Characters that are rejected
Code 128 here covers ASCII only. Accented letters, symbols from other alphabets and emoji are rejected, and the message names the first offending character so you can remove or replace it. Strip accents from product names, or use the QR Code Generator if you need full Unicode text in a code.
Printing tips
Print dark bars on a light background at 100% scale, keep the blank margin clear and do not stretch the image sideways. Test the printed label with the scanner that will read it before you print a batch. The SVG suits print, and the PNG suits documents; use the Image Converter to change its format. For retail numbers, see the EAN-13 Barcode Generator.
Frequently asked questions
Is the text I enter uploaded anywhere?
No. The Code 128 barcode is drawn in your browser, so the value and the image are never sent, logged or stored.
Which characters can Code 128 encode?
Any ASCII character from 0 to 127, so uppercase and lowercase letters, digits, punctuation and control characters. The encoder picks the shortest mix of sets A, B and C automatically.
Why is the check symbol not shown under the bars?
The mod 103 check symbol is added to the bars for the scanner to verify, but it is not part of your data, so it is not printed in the text. The line under the barcode shows only the value you entered.
Why is my accented letter or emoji rejected?
Code 128 here is limited to ASCII, so characters such as an e with an accent or an emoji cannot be encoded. The error names the character; remove it or replace it with a plain letter.
Why does a number make a shorter barcode than the same letters?
Code set C packs two digits into one symbol. The encoder uses it for runs of 4 or more digits at the start or end, or 6 or more in the middle, which halves the width of those digits.
What file should I use on a shipping label?
Download the SVG if your label software accepts it, as it stays sharp at any size. Otherwise use the PNG and print at 100 percent scale with the margin kept clear, then scan a sample before printing a batch.