Code 128 barcode generator
Type anything printable and get a scannable Code 128 symbol. This is the format to pick whenever the barcode is for your own system rather than a retail till.
Generate a Code 128 barcode
SVG shape mask (decorative)
Upload an SVG — the barcode is clipped to its shape. A horse SVG makes a horse-shaped barcode.
Code 128 is the general-purpose linear barcode. It covers the whole 128-character ASCII set — upper and lower case letters, digits, punctuation and the control characters — which is why almost every shipping label, warehouse bin card and asset tag you will ever print uses it. Unlike EAN or UPC, nobody allocates Code 128 numbers: you decide what the symbol says, and it means whatever your own system decides it means.
Its density comes from three interchangeable character sets. Code set A (Code 128A) carries upper case and control characters, code set B (Code 128B) upper and lower case and punctuation, and code set C (Code 128C) packs two digits into a single symbol character. A good encoder switches between them part-way through a symbol, so a long run of digits ends up about half the width it would need in any other linear format. bwip-js, which draws the preview above, chooses the code sets for you.
The variant you meet in logistics is GS1-128, once called UCC/EAN-128: the same symbology with an FNC1 character in front and GS1 Application Identifiers structuring the payload, so a scanner can tell a batch number from an expiry date. If a carrier has sent you an SSCC label specification, GS1-128 is what they are asking for.
What Code 128 encodes
| Character set | All 128 ASCII characters, via code sets A, B and C |
|---|---|
| Length | Variable — no limit in the standard, bounded in practice by label width |
| Check character | Modulo 103, computed automatically, not shown in the human-readable line |
| Dimensions | Linear (1D) |
| Quiet zone | 10 × the narrow-bar width on each side |
| Standard | ISO/IEC 15417 |
Code 128 character set: code sets A, B and C
Every Code 128 symbol character has a value from 0 to 106 and is drawn as three bars and three spaces, eleven modules wide in total; only the stop pattern has a fourth bar and is thirteen modules wide. What a value means depends on the code set in force. The start character — Start A, Start B or Start C — selects the first set, the Code A, Code B and Code C characters switch sets part-way through, and Shift changes between A and B for the next character only.
Code 128A covers upper-case letters, digits, punctuation and the ASCII control characters NUL to US. Code 128B covers the printable range from space to tilde, including lower case, and is where most text starts. Code 128C encodes the pairs 00 to 99 as single characters, which is why a long even-length number comes out at half the width. FNC1 directly after the start character marks a GS1-128 symbol; FNC2, FNC3 and FNC4 are for message appending, reader programming and extended ASCII, and are rarely needed.
The check character is the start value plus each data value multiplied by its position, taken modulo 103. You never have to work it out, or choose a code set: this generator does both. The table is for reading a symbol by hand, checking another encoder, or building a font.
| Value | Code A | Code B | Code C | Widths |
|---|---|---|---|---|
| 0 | SP | SP | 00 | 212222 |
| 1 | ! | ! | 01 | 222122 |
| 2 | " | " | 02 | 222221 |
| 3 | # | # | 03 | 121223 |
| 4 | $ | $ | 04 | 121322 |
| 5 | % | % | 05 | 131222 |
| 6 | & | & | 06 | 122213 |
| 7 | ' | ' | 07 | 122312 |
| 8 | ( | ( | 08 | 132212 |
| 9 | ) | ) | 09 | 221213 |
| 10 | * | * | 10 | 221312 |
| 11 | + | + | 11 | 231212 |
| 12 | , | , | 12 | 112232 |
| 13 | - | - | 13 | 122132 |
| 14 | . | . | 14 | 122231 |
| 15 | / | / | 15 | 113222 |
| 16 | 0 | 0 | 16 | 123122 |
| 17 | 1 | 1 | 17 | 123221 |
| 18 | 2 | 2 | 18 | 223211 |
| 19 | 3 | 3 | 19 | 221132 |
| 20 | 4 | 4 | 20 | 221231 |
| 21 | 5 | 5 | 21 | 213212 |
| 22 | 6 | 6 | 22 | 223112 |
| 23 | 7 | 7 | 23 | 312131 |
| 24 | 8 | 8 | 24 | 311222 |
| 25 | 9 | 9 | 25 | 321122 |
| 26 | : | : | 26 | 321221 |
| 27 | ; | ; | 27 | 312212 |
| 28 | < | < | 28 | 322112 |
| 29 | = | = | 29 | 322211 |
| 30 | > | > | 30 | 212123 |
| 31 | ? | ? | 31 | 212321 |
| 32 | @ | @ | 32 | 232121 |
| 33 | A | A | 33 | 111323 |
| 34 | B | B | 34 | 131123 |
| 35 | C | C | 35 | 131321 |
| 36 | D | D | 36 | 112313 |
| 37 | E | E | 37 | 132113 |
| 38 | F | F | 38 | 132311 |
| 39 | G | G | 39 | 211313 |
| 40 | H | H | 40 | 231113 |
| 41 | I | I | 41 | 231311 |
| 42 | J | J | 42 | 112133 |
| 43 | K | K | 43 | 112331 |
| 44 | L | L | 44 | 132131 |
| 45 | M | M | 45 | 113123 |
| 46 | N | N | 46 | 113321 |
| 47 | O | O | 47 | 133121 |
| 48 | P | P | 48 | 313121 |
| 49 | Q | Q | 49 | 211331 |
| 50 | R | R | 50 | 231131 |
| 51 | S | S | 51 | 213113 |
| 52 | T | T | 52 | 213311 |
| 53 | U | U | 53 | 213131 |
| 54 | V | V | 54 | 311123 |
| 55 | W | W | 55 | 311321 |
| 56 | X | X | 56 | 331121 |
| 57 | Y | Y | 57 | 312113 |
| 58 | Z | Z | 58 | 312311 |
| 59 | [ | [ | 59 | 332111 |
| 60 | \ | \ | 60 | 314111 |
| 61 | ] | ] | 61 | 221411 |
| 62 | ^ | ^ | 62 | 431111 |
| 63 | _ | _ | 63 | 111224 |
| 64 | NUL | ` | 64 | 111422 |
| 65 | SOH | a | 65 | 121124 |
| 66 | STX | b | 66 | 121421 |
| 67 | ETX | c | 67 | 141122 |
| 68 | EOT | d | 68 | 141221 |
| 69 | ENQ | e | 69 | 112214 |
| 70 | ACK | f | 70 | 112412 |
| 71 | BEL | g | 71 | 122114 |
| 72 | BS | h | 72 | 122411 |
| 73 | HT | i | 73 | 142112 |
| 74 | LF | j | 74 | 142211 |
| 75 | VT | k | 75 | 241211 |
| 76 | FF | l | 76 | 221114 |
| 77 | CR | m | 77 | 413111 |
| 78 | SO | n | 78 | 241112 |
| 79 | SI | o | 79 | 134111 |
| 80 | DLE | p | 80 | 111242 |
| 81 | DC1 | q | 81 | 121142 |
| 82 | DC2 | r | 82 | 121241 |
| 83 | DC3 | s | 83 | 114212 |
| 84 | DC4 | t | 84 | 124112 |
| 85 | NAK | u | 85 | 124211 |
| 86 | SYN | v | 86 | 411212 |
| 87 | ETB | w | 87 | 421112 |
| 88 | CAN | x | 88 | 421211 |
| 89 | EM | y | 89 | 212141 |
| 90 | SUB | z | 90 | 214121 |
| 91 | ESC | { | 91 | 412121 |
| 92 | FS | | | 92 | 111143 |
| 93 | GS | } | 93 | 111341 |
| 94 | RS | ~ | 94 | 131141 |
| 95 | US | DEL | 95 | 114113 |
| 96 | FNC3 | FNC3 | 96 | 114311 |
| 97 | FNC2 | FNC2 | 97 | 411113 |
| 98 | Shift B | Shift A | 98 | 411311 |
| 99 | Code C | Code C | 99 | 113141 |
| 100 | Code B | FNC4 | Code B | 114131 |
| 101 | FNC4 | Code A | Code A | 311141 |
| 102 | FNC1 | FNC1 | FNC1 | 411131 |
| 103 | Start A | Start A | Start A | 211412 |
| 104 | Start B | Start B | Start B | 211214 |
| 105 | Start C | Start C | Start C | 211232 |
| 106 | Stop | Stop | Stop | 2331112 |
Where Code 128 is actually used
Parcel and pallet labels
Carrier labels, SSCC serial shipping container codes and GS1-128 data blocks are all Code 128 underneath.
Warehouse and inventory
Bin locations, pick lists and stock movements — anywhere you own both the printer and the scanner.
Asset tags
IT hardware, tools and lab equipment, usually carrying an alphanumeric asset number.
Healthcare
Wristbands, specimen labels and medication trolleys, often as GS1-128 with an AI-structured payload.
Rules this Code 128 generator enforces
- Only printable ASCII survives a round trip through most scanners. Accented characters and anything outside ASCII will either be rejected or come back as mojibake.
- The check character is calculated for you — do not append one yourself.
- Spaces are legal but easy to lose when a value is retyped by hand; hyphens or underscores are safer separators.
- Long values make very wide symbols. Past roughly 20 characters, Data Matrix or PDF417 will fit the same data in far less space.
Printing a Code 128 symbol that scans
Code 128 is decoded by measuring the ratio between wide and narrow bars, so anything that thickens or thins the bars unevenly breaks it. Print black on white, export SVG when the label goes to a professional printer, and never stretch the symbol horizontally to make it fill a box in your layout.
Keep the quiet zone. Ten narrow-bar widths of blank space on each side is part of the symbology rather than decoration, and cropping it is the single most common reason a technically correct label refuses to read.
Code 128 questions
Do I need to register a Code 128 number with anyone?
No. Code 128 carries whatever text you put in it. Registration only applies to retail article numbers — EAN-13 and UPC-A — which are allocated by GS1.
What is the difference between Code 128 and GS1-128?
GS1-128 is Code 128 with rules on top: an FNC1 character at the start and GS1 Application Identifiers labelling each field. The bars are identical; only the agreed meaning of the data differs.
How long can a Code 128 barcode be?
The symbology sets no limit, but every character adds roughly 11 modules of width. A 30-character value on a standard thermal printer is already wider than a 100 mm label.
What is the difference between Code 128A, 128B and 128C?
They are the three code sets of the same symbology, not separate barcodes. A adds control characters to upper case, B covers printable ASCII including lower case, and C packs digit pairs 00–99 into one character. One symbol can switch between them, and the scanner returns the same text whichever was used.
Can I force Code 128B or Code 128C?
Not in this generator, and there is rarely a reason to. The encoder chooses the start set and any switches for you. Set C only encodes pairs of digits, so an odd-length number always has one digit encoded in set A or B.
Does this generator make GS1-128 (EAN-128) barcodes?
No. It draws plain Code 128 and does not insert the FNC1 character that marks a GS1-128 symbol, so typing Application Identifiers in brackets will not produce a valid GS1-128 label. Use GS1-aware labelling software for SSCC and batch or expiry labels.