Tool for decoding/encoding 128 barcodes, a barcode standard for encoding numbers and letters, used internationally by EAN-128 (or GS1-128).
Barcode 128 - dCode
Tag(s) : Character Encoding, Image Processing
dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!
Code 128 is a type of barcode that encodes alphanumeric data as black bars and white spaces of varying widths.
It is widely used in logistics, transportation, and inventory management due to its compact size and robustness.
A widespread industrial application is the GS1-128 standard (formerly EAN-128), which uses Code 128 symbology to structure standardized logistics data (product identifiers, batch numbers, etc.).
A 128 barcode consists of a series of alternating groups of three black bars and three white spaces of varying widths (between 1 and 4 units wide).
The standard describes three encoding tables: Code 128A, Code 128B, and Code 128C. These three sets of codes allow for the representation of all ASCII characters from 0 to 127, as well as special functions (FNC1 to FNC4).
The 128 barcode begins with a series of dashes indicating Start and ends with End. Between these dashes are the characters of the message to be encrypted, each represented by six bars (three black and three white) of length 11 units.
To encode a string of characters:
1 - Start with the Start symbol corresponding to the encoding table being used.
2 - Convert each character according to the lookup table and insert the corresponding strokes
3 - Calculate the check digit (see below) and insert it afterward
4 - End with the Stop symbol
Example: To encode DCODE in 128b, encode `Start B, D, C, O, D, E, Check Digit, End' that is, the values 104,36,35,47,36,37,62,106 or as alternating bars of width 211214,112313,131321,133121,112313,132113,431111,2331112
Decoding involves reading the widths of the bars and spaces. This process is broken down into several steps.
1 - Identify the starting symbol (Start A, B, or C)
2 - Divide the sequence into blocks of 6 bars (11 units wide)
3 - Convert each pattern into a numerical value (0 to 106)
4 - Verify the check digit.
5 - Translate the values according to the active code set.
Example: A barcode has the raw message 2112141412211313211341111412211122141214212331112
211214 corresponds to the Start code of the 128B standard. 141221 corresponds to the character d, then 131321 for C, etc. The message contained in the barcode is dCode.
The check digit is calculated by summing the value of the starting symbol with each value encoded in the barcode, multiplied by its position, all modulo 103.
Example: With DCODE and the 128-B encoding set, Start B = 10⁴, D = 36, C = 35, O = 47, D = 36, E = 37
The check digit calculation is 10⁴ + 1 × 36 + 2 × 35 + 3 × 47 + 4 × 36 + 5 × 37 = 680 and 680 mod 10³ = 62. The value 62 corresponds to the ^ symbol in encoding set B.
When reading a barcode, if the equality is not verified, the code is invalid. The dCode generator can, however, disregard this if necessary.
The barcode may have a conventional graphical form (black and white lines similar to zebra's stripes) or a binary equivalent (of 0 to vacuum and 1 white bars) or a base 4 code (1,2,3 and 4 for the size of the bar, alternating black and white).
The bar code may have a variable length. It begins (usually) by Start and ends with the character End or Stop (see table).
To encode a message of N characters, the number of units needed (between the first and last black bar) is 11 × (N + 2) + 13 units
The concepts of optical readers (laser), scanners, or barcode software/mobile applications are clues.
Coding table 128A has ASCII characters from 00 to 95.
Coding table 128B has ASCII characters from 32 to 127.
Coding table 128C has all numeric values from 00 to 99.
| id | bands | binary | 128A | 128B | 128C |
|---|---|---|---|---|---|
| 0 | 212222 | 11011001100 | Space | Space | 00 |
| 1 | 222122 | 11001101100 | ! | ! | 01 |
| 2 | 222221 | 11001100110 | " | " | 02 |
| 3 | 121223 | 10010011000 | # | # | 03 |
| 4 | 121322 | 10010001100 | $ | $ | 04 |
| 5 | 131222 | 10001001100 | % | % | 05 |
| 6 | 122213 | 10011001000 | & | & | 06 |
| 7 | 122312 | 10011000100 | 07 | ||
| 8 | 132212 | 10001100100 | ( | ( | 08 |
| 9 | 221213 | 11001001000 | ) | ) | 09 |
| 10 | 221312 | 11001000100 | * | * | 10 |
| 11 | 231212 | 11000100100 | + | + | 11 |
| 12 | 112232 | 10110011100 | , | , | 12 |
| 13 | 122132 | 10011011100 | - | - | 13 |
| 14 | 122231 | 10011001110 | . | . | 14 |
| 15 | 113222 | 10111001100 | / | / | 15 |
| 16 | 123122 | 10011101100 | 0 | 0 | 16 |
| 17 | 123221 | 10011100110 | 1 | 1 | 17 |
| 18 | 223211 | 11001110010 | 2 | 2 | 18 |
| 19 | 221132 | 11001011100 | 3 | 3 | 19 |
| 20 | 221231 | 11001001110 | 4 | 4 | 20 |
| 21 | 213212 | 11011100100 | 5 | 5 | 21 |
| 22 | 223112 | 11001110100 | 6 | 6 | 22 |
| 23 | 312131 | 11101101110 | 7 | 7 | 23 |
| 24 | 311222 | 11101001100 | 8 | 8 | 24 |
| 25 | 321122 | 11100101100 | 9 | 9 | 25 |
| 26 | 321221 | 11100100110 | : | : | 26 |
| 27 | 312212 | 11101100100 | ; | ; | 27 |
| 28 | 322112 | 11100110100 | < | < | 28 |
| 29 | 322211 | 11100110010 | = | = | 29 |
| 30 | 212123 | 11011011000 | > | > | 30 |
| 31 | 212321 | 11011000110 | ? | ? | 31 |
| 32 | 232121 | 11000110110 | @ | @ | 32 |
| 33 | 111323 | 10100011000 | A | A | 33 |
| 34 | 131123 | 10001011000 | B | B | 34 |
| 35 | 131321 | 10001000110 | C | C | 35 |
| 36 | 112313 | 10110001000 | D | D | 36 |
| 37 | 132113 | 10001101000 | E | E | 37 |
| 38 | 132311 | 10001100010 | F | F | 38 |
| 39 | 211313 | 11010001000 | G | G | 39 |
| 40 | 231113 | 11000101000 | H | H | 40 |
| 41 | 231311 | 11000100010 | I | I | 41 |
| 42 | 112133 | 10110111000 | J | J | 42 |
| 43 | 112331 | 10110001110 | K | K | 43 |
| 44 | 132131 | 10001101110 | L | L | 44 |
| 45 | 113123 | 10111011000 | M | M | 45 |
| 46 | 113321 | 10111000110 | N | N | 46 |
| 47 | 133121 | 10001110110 | O | O | 47 |
| 48 | 313121 | 11101110110 | P | P | 48 |
| 49 | 211331 | 11010001110 | Q | Q | 49 |
| 50 | 231131 | 11000101110 | R | R | 50 |
| 51 | 213113 | 11011101000 | S | S | 51 |
| 52 | 213311 | 11011100010 | T | T | 52 |
| 53 | 213131 | 11011101110 | U | U | 53 |
| 54 | 311123 | 11101011000 | V | V | 54 |
| 55 | 311321 | 11101000110 | W | W | 55 |
| 56 | 331121 | 11100010110 | X | X | 56 |
| 57 | 312113 | 11101101000 | Y | Y | 57 |
| 58 | 312311 | 11101100010 | Z | Z | 58 |
| 59 | 332111 | 11100011010 | [ | [ | 59 |
| 60 | 314111 | 11101111010 | \ | \ | 60 |
| 61 | 221411 | 11001000010 | ] | ] | 61 |
| 62 | 431111 | 11110001010 | ^ | ^ | 62 |
| 63 | 111224 | 10100110000 | _ | _ | 63 |
| 64 | 111422 | 10100001100 | NUL | ` | 64 |
| 65 | 121124 | 10010110000 | SOH | a | 65 |
| 66 | 121421 | 10010000110 | STX | b | 66 |
| 67 | 141122 | 10000101100 | ETX | c | 67 |
| 68 | 141221 | 10000100110 | EOT | d | 68 |
| 69 | 112214 | 10110010000 | ENQ | e | 69 |
| 70 | 112412 | 10110000100 | ACK | f | 70 |
| 71 | 122114 | 10011010000 | BEL | g | 71 |
| 72 | 122411 | 10011000010 | BS | h | 72 |
| 73 | 142112 | 10000110100 | HT | i | 73 |
| 74 | 142211 | 10000110010 | LF | j | 74 |
| 75 | 241211 | 11000010010 | VT | k | 75 |
| 76 | 221114 | 11001010000 | FF | l | 76 |
| 77 | 413111 | 11110111010 | CR | m | 77 |
| 78 | 241112 | 11000010100 | SO | n | 78 |
| 79 | 134111 | 10001111010 | SI | o | 79 |
| 80 | 111242 | 10100111100 | DLE | p | 80 |
| 81 | 121142 | 10010111100 | DC1 | q | 81 |
| 82 | 121241 | 10010011110 | DC2 | r | 82 |
| 83 | 114212 | 10111100100 | DC3 | s | 83 |
| 84 | 124112 | 10011110100 | DC4 | t | 84 |
| 85 | 124211 | 10011110010 | NAK | u | 85 |
| 86 | 411212 | 11110100100 | SYN | v | 86 |
| 87 | 421112 | 11110010100 | ETB | w | 87 |
| 88 | 421211 | 11110010010 | CAN | x | 88 |
| 89 | 212141 | 11011011110 | EM | y | 89 |
| 90 | 214121 | 11011110110 | SUB | z | 90 |
| 91 | 412121 | 11110110110 | ESC | { | 91 |
| 92 | 111143 | 10101111000 | FS | | | 92 |
| 93 | 111341 | 10100011110 | GS | } | 93 |
| 94 | 131141 | 10001011110 | RS | ~ | 94 |
| 95 | 114113 | 10111101000 | US | DEL | 95 |
| 96 | 114311 | 10111100010 | FNC3 | FNC3 | 96 |
| 97 | 411113 | 11110101000 | FNC2 | FNC2 | 97 |
| 98 | 411311 | 11110100010 | ShiftB | ShiftA | 98 |
| 99 | 113141 | 10111011110 | Code C | Code C | 99 |
| 100 | 114131 | 10111101110 | Code B | FNC4 | Code B |
| 101 | 311141 | 11101011110 | FNC4 | Code A | Code A |
| 102 | 411131 | 11110101110 | FNC1 | FNC1 | FNC1 |
| 103 | 211412 | 11010000100 | Start A | Start A | Start A |
| 104 | 211214 | 11010010000 | Start B | Start B | Start B |
| 105 | 211232 | 11010011100 | Start C | Start C | Start C |
| 106 | 2331112 | 1100011101011 | Stop | Stop | Stop |
The Stop symbol has 13 modules to create an asymmetric signature facilitating end-of-read detection and optical synchronization.
Code 128 structurally has three variants: 128A, 128B, and 128C, which are internal coding sets.
Code 128 serves as a standard for GS1-128 codes (formerly EAN-128) for logistics or HIBC for the medical sector.
Other barcode standards exist: EAN-13, EAN-8, Code 39, and Code 93, each with its own structure.
Code 128 encodes a sequence of characters or a number without imposing any intrinsic meaning. Its meaning depends entirely on the system interpreting it; it can mean anything: the decoded number or text could be a product identifier, a tracking number, an internal reference, etc. Without access to the corresponding database, it remains a simple sequence of characters/numbers.
The standard does not set a strict length limit. However, the practical limit depends on the print resolution and the minimum read width, which is determined by the optical reader's capacity. A barcode printed or displayed too small or too large will be unusable by most scanners.
dCode shares a character font file (ttf font) here (unknown source, unknown licence)
The fonts do not automatically calculate the modulo 103 key, nor do they add the Start and Stop characters; compliance with ISO/IEC 15417 is not guaranteed.
dCode retains ownership of the "Barcode 128" source code. Any algorithm for the "Barcode 128" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "Barcode 128" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) or any database download or API access for "Barcode 128" or any other element are not public (except explicit open source licence). Same with the download for offline use on PC, mobile, tablet, iPhone or Android app.
Reminder: dCode is an educational and teaching resource, accessible online for free and for everyone.
The content of the page "Barcode 128" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source (Creative Commons CC-BY free distribution license).
Exporting the results is free and can be done simply by clicking on the export icons ⤓ (.csv or .txt format) or ⧉ (copy and paste).
To cite dCode.fr on another website, use the link:
In a scientific article or book, the recommended bibliographic citation is: Barcode 128 on dCode.fr [online website], retrieved on 2026-03-20,