Code 128 barcode generator
Paste a list of SKUs, bin codes or order numbers and get one Code 128 barcode per line, ready to download as SVG or PNG files or to print as a sheet. The generator below is already set to Code 128 and runs entirely in your browser.
What Code 128 can encode
Code 128 is defined in the standard ISO/IEC 15417. It can carry all 128 ASCII characters, and it does so with three character sets that one barcode can switch between. Every symbol character is 11 modules wide, whichever set it comes from, and the stop pattern is 13 modules.
| Set | What it holds | Start value | When it is used |
|---|---|---|---|
| Set A | Capital letters, digits, punctuation and the ASCII control characters, such as Tab and carriage return | 103 | Values that must carry a control character |
| Set B | Capital and lower-case letters, digits, punctuation and the space | 104 | Ordinary text: SKUs, names, mixed codes |
| Set C | Pairs of digits from 00 to 99, one pair per symbol character | 105 | Long numbers |
A scanner returns plain text and never says which set was used, so a value always scans the same way.
What this generator does with your text
The generator uses Set B and Set C and chooses between them for you. It starts in Set C when the value is two or more digits and nothing else, or when it begins with four or more digits. Otherwise it starts in Set B. Inside a value it switches to Set C at every run of four or more digits and back to Set B afterwards. When a run has an odd number of digits, the last digit is drawn in Set B.
It does not use Set A, so it accepts printable ASCII only: letters, digits, the space and the symbols on a US keyboard. A Tab, a line break, or a character such as é or £ is rejected with a red note that names the character. If your process needs a Tab inside the barcode, for example to jump to the next field of a form, you need label software that can encode control characters.
The check symbol
Every Code 128 barcode ends with a check symbol. The generator takes the start value, adds each character's value multiplied by its position, divides by 103 and keeps the remainder. For AB12, drawn in Set B, the values are A = 33, B = 34, 1 = 17 and 2 = 18:
104 + 33×1 + 34×2 + 17×3 + 18×4 = 328, and 328 divided by 103 leaves 19.
So the symbol with value 19 goes before the stop pattern. The scanner repeats the sum and throws the read away if it does not match. You never type this character and it never appears in the scanned text.
Why digits print at about half the width
In Set B each character needs its own 11-module symbol character. In Set C two digits share one. A 14-digit number therefore needs 7 symbol characters instead of 14, so the data part of the barcode halves. The start, check and stop characters stay the same size, so the whole barcode shrinks by a little less than half.
These widths come from the generator itself. Printed width is at the default bar width of 2 px, printed at 100%, and includes the white margin on both sides.
| Value | How it is encoded | Width in modules | Printed width |
|---|---|---|---|
12345678901234 | Set C, 7 digit pairs | 112 | about 70 mm |
| 14 characters in Set B, for comparison | 14 single characters | 189 | about 111 mm |
SKU-1001 | Set B for SKU-, Set C for 1001 | 112 | about 70 mm |
SKU-10001 | Set B, Set C for 1000, Set B for the last 1 | 134 | about 81 mm |
SKU-100001 | Set B for SKU-, Set C for 100001 | 123 | about 76 mm |
X001ABC123 | Set B only, no run of four digits | 145 | about 87 mm |
The middle rows show a practical rule: the number part of a code is cheaper with an even count of digits. SKU-100001 is one character longer than SKU-10001 but prints about 6 mm narrower. In SKU-10001 the fifth digit needs a switch back to Set B and a character of its own, while in SKU-100001 the last two digits share one Set C character. Keep this in mind when you plan a numbering run with the sequential barcode generator.
GS1-128 and FNC1: a related format this tool does not make
GS1-128 is Code 128 with an extra rule. The first character after the start code is a special character called FNC1. It tells the scanner that the data is a chain of GS1 application identifiers, such as (00) for the 18-digit SSCC on a pallet label or (01) for a product's GTIN, and the receiving software splits the chain into fields. FNC1 also marks the end of a field of variable length when another field follows it.
The brackets you see in the text under a GS1-128 barcode are not in the bars. If you type (01)05012345678900 into this generator, you get a plain Code 128 barcode that contains the brackets as ordinary characters and no FNC1. It scans, but a warehouse system that expects GS1-128 will not read it as a GTIN. For pallet labels and shipping labels that a customer or carrier specifies, use label software that supports GS1-128 or the label the carrier supplies. The barcode types guide lists the other formats this site does not make.
Common uses, including Amazon FNSKU labels
Code 128 is the usual choice when a code only has to work inside one business or one supply chain.
- Amazon FNSKU labels. If you sell through Fulfilment by Amazon, the FNSKU that Amazon assigns to a listing, which usually begins with X00, is printed as a Code 128 barcode. Most sellers print these labels from Seller Central, because Amazon's label also carries text that this tool does not add. The generator helps when you need the bare barcode, for example to test a scanner or to place FNSKUs in your own label layout. Check Amazon's current label rules before you send stock.
- Stock and bin labels that mix letters and digits, such as
A-03-2for aisle A, bay 3, shelf 2. See inventory barcode labels for a full set-up. - Order, job and return numbers printed on paperwork, so a clerk scans the number instead of typing it.
- Serial numbers and asset tags with lower-case letters, which standard Code 39 cannot hold.
Making a batch
- Paste one value per line, up to 500 lines. Copying a column from a spreadsheet works; the guide to making barcodes from Excel covers lost zeros and other traps.
- Read the status line: it counts the barcodes ready and the lines skipped. Each skipped line is shown in red with the character that caused it.
- Set the bar width. Each extra character adds 11 modules, which is about 5.8 mm at 2 px and 2.9 mm at 1 px, so long values on small labels need a narrow bar width or a shorter value.
- Download the SVG or PNG ZIP, or use Print sheet. Test one printed label with your own scanner before printing the rest. If it fails, go through the barcode troubleshooting checklist.
Frequently asked questions
Which Code 128 set should I choose?
You do not need to choose. The generator picks Set B or Set C for each part of the value, and the scanner returns the same text whichever set was used.
Can I force Code 128A or Code 128C?
Not directly. A value made only of digits, with an even number of them, is drawn entirely in Set C. Set A is never used, so control characters such as Tab cannot be encoded here.
Is Code 128 the same as GS1-128?
GS1-128 is a use of Code 128 with an FNC1 character after the start code and GS1 application identifiers in the data. This generator makes plain Code 128 only.
How long can a Code 128 value be?
The standard sets no fixed number of characters, but every character adds width. At the default bar width each letter adds about 5.8 mm and each pair of digits about the same, so keep values as short as your system allows.
Why do my lower-case letters scan as capitals?
Code 128 stores lower case correctly, so the cause is usually the computer. If Caps Lock is on, many scanners that type like a keyboard come out with upper and lower case swapped. Turn Caps Lock off and scan again.