QR Decode
Decode a QR

Local barcode tool

Code 128 Barcode Generator

Be the first to rate this page.

Encode printable text with automatic Code Set B or numeric Code Set C selection.

Generated and checked in this browser. Nothing entered here is uploaded.

Processed locally

Your input stays in this browser.

Ready to verify

Review the result before saving or printing.

No expiry

Static codes keep working without a subscription.

Identifier structure

Code 128 is a high-density linear barcode for operational data such as serial numbers, asset tags, work orders and shipment references. It is not a retail GTIN symbol. The format has code sets: Set B represents printable ASCII characters, while Set C stores pairs of decimal digits as one codeword. This generator switches to Set C for sufficiently long even digit runs and returns to Set B for ordinary text.

Worked numerical example

The encoded stream starts with a set-specific start value. In a label such as BOX-2026-0042, letters and punctuation use Set B; the digit runs may use Set C in pairs 20, 26, 00 and 42. Every following codeword is multiplied by its one-based position, added to the start value, and reduced modulo 103 to form the mandatory checksum. A stop pattern finishes the symbol.

How the symbol encodes data

Auto-selection reduces width, but it does not change the original data. An odd-length digit run cannot be entirely paired, so one digit is emitted through a text set. A scanner reads codewords and reconstructs the exact character stream; it does not infer a product number, date or lot structure unless the application layer imposes one.

Physical failure mode

Readability problems often come from compression: narrow modules printed below device tolerance, bar-height reduction, thermal transfer darkness, damaged labels or a quiet zone invaded by a border. Code 128 needs a clear margin at both ends and an aspect ratio appropriate to the scanner. Do not use a screenshot as production art; download vector output and verify a real label.

Operational boundary

Code 128 differs from Code 39 because it supports a larger ASCII repertoire and can compact numeric pairs. It differs from EAN and UPC because it has no retail prefix and no fixed digit count. This page chooses code sets; the Code 39 page instead limits characters and offers its optional modulo-43 check character.

A format-specific proof

For BOX-2026-0042, the important proof is the exact returned character stream, including both hyphens and leading zeroes in numeric runs. A scanner that returns BOX20260042 may be configured to strip punctuation, or the host parser may be normalizing it; either result changes an asset key even if every bar scans. Code Set C is a compression choice inside the symbol, not an instruction for the receiving system to reinterpret paired digits.

Worked check-digit example

The encoded stream starts with a set-specific start value. In a label such as BOX-2026-0042, letters and punctuation use Set B; the digit runs may use Set C in pairs 20, 26, 00 and 42. Every following codeword is multiplied by its one-based position, added to the start value, and reduced modulo 103 to form the mandatory checksum. A stop pattern finishes the symbol.

How the bars carry data

Auto-selection reduces width, but it does not change the original data. An odd-length digit run cannot be entirely paired, so one digit is emitted through a text set. A scanner reads codewords and reconstructs the exact character stream; it does not infer a product number, date or lot structure unless the application layer imposes one.

Printing and scanning limits

Readability problems often come from compression: narrow modules printed below device tolerance, bar-height reduction, thermal transfer darkness, damaged labels or a quiet zone invaded by a border. Code 128 needs a clear margin at both ends and an aspect ratio appropriate to the scanner. Do not use a screenshot as production art; download vector output and verify a real label.

When to use this format

Code 128 differs from Code 39 because it supports a larger ASCII repertoire and can compact numeric pairs. It differs from EAN and UPC because it has no retail prefix and no fixed digit count. This page chooses code sets; the Code 39 page instead limits characters and offers its optional modulo-43 check character.

A parcel label where Set C saves width

Consider the internal reference BOX-2026-0042. The letters, hyphen and punctuation require Code Set B, while the four even-length numeric runs can use Set C as pairs: 20, 26, 00 and 42. Pairing does not turn the value into a number: the `00` remains two characters and must survive a scan into the warehouse field. The checksum is calculated from the actual start, data and switching codewords modulo 103, then followed by the stop pattern. ISO/IEC 15417 is the Code 128 symbology specification; GS1 notes that GS1-128 is a constrained subset distinguished by FNC1, not a synonym for arbitrary Code 128: https://ref.gs1.org/standards/genspecs/gscn/2020/GSCN_20-044_CodeSetC.pdf . This tool creates an ordinary Code 128 string, so it must not be used to fabricate a GS1-128 label merely by placing parentheses around a GTIN.

Test the receiving field as well as the bars

A useful trial prints BOX-2026-0042 at the final label width, scans it through the real handheld, and compares the received value byte for byte with the source. Repeat with BOX-2026-0043 and with BOX-2026-0002. The second catches a stale label; the third shows whether a leading pair of zeroes is retained. If the reader beeps but the host removes hyphens, changes case or interprets 0042 as a number, change the keyboard-wedge or parser rule rather than changing the barcode. Code 128 is appropriate for an internal token only when its data owner defines that token. It does not assign a retail number, define a lot or expiry grammar, or prove that a delivery partner will interpret its characters in the same field order. Preserve the source string, SVG revision, printer setting and scan result together; those four items separate an encoding fault from a thermal-print fault and an integration fault.

Keep business structure outside ordinary Code 128

If BOX-2026-0042 later needs a lot, date or serial rule, define those fields in the warehouse contract instead of relying on a scanner to infer them from punctuation. A plain Code 128 scan returns characters. It neither marks FNC1 nor supplies GS1 application-identifier semantics. Document field length, permitted characters and leading-zero treatment with the label specification, then reject any incoming value that violates that contract.

A controlled test string catches normalisation

Keep one test value with punctuation and a zero pair, such as BOX-2026-0042, in the commissioning procedure. It detects the three silent transformations that a simple all-digit label misses: punctuation stripping, conversion to a number, and loss of leading zeroes. A reader configuration is acceptable only if the host receives that exact reference string. Repeat the test after firmware updates, because parser defaults can change without changing the printed bars.

Enter your values, review the result, then use it with confidence.

Rate this page

Be the first to rate this page.