17

I need to create a Code 128 barcode with a maximum of 44 characters. What is the maximum number of characters supported by the Code 128 barcode format?

I came to know that Code 128 can encode all 128 characters of ASCII, but I cannot determine the maximum number of characters it supports.

3
  • duplicate: stackoverflow.com/a/2660568/1726419
    – yossico
    Jun 17, 2014 at 12:02
  • But i need a clear answer
    – Divya
    Jun 17, 2014 at 12:11
  • Code 128 with this length becomes very unpractical because it gets very long (harder to scan, print). Maybe think of different more compact barcode types eg. 2d qr
    – Patrick
    Jun 17, 2014 at 12:14

1 Answer 1

32

The specification for Code 128 (ISO/IEC 15417) leaves the maximum length undefined and states that this is something that should be defined by any derivative application[*] standard:

4.7.1 Symbology and data characteristics

Application specifications should consider the following parameters.

b) The number of data characters in the symbol, which may be fixed, variable or variable up to a defined maximum.

For example the GS1 General Specification define that GS1-128 (the formal application of Code 128 to the supply chain industry) has a limits of 48 characters per symbol:

5.4.1 GS1-128 Bar Code Symbol size characteristics:

The characteristics of the GS1-128 Symbology are:

  • GS1-128 Bar Code Symbol size characteristics:

    • The maximum number of data characters in a single symbol is 48.

Practically one should restrict the number of characters to whatever fits comfortably in a scanner's field of view. This will vary depending on the type and model of the device, e.g. handheld vs fixed, laser vs CCD, high-end vs budget, etc. In uncontrolled or open environments a high degree of tolerance should be budgeted for.

It is especially worth noting that Code 128 supports double-density compression of numeric data ("mode C") which makes encoding long strings of digits much more efficient.

Here is a 44-digit Code 128 containing 12345678901234567890123456789012345678901234:

44-digit Code 128

This is appropriately sized for most practical applications.

However, here is the same Code 128 this time containing 44 alpha characters ABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCD:

44-alpha character Code 128

A barcode of this size will not be useful in as many applications since reading this reliably would require a scanner with a high resolution and wide field-of-view.

So ultimately the maximum length of a Code 128 is dependant not only on the practical constraints of the application but also the type of data to be encoded.

[*] Application is the industry term referring to the environment and processes in which the barcode system is to be used, rather than any specific software application.

2
  • can you please tell me how to generate type c code128 barcode. I need bytecodes for type c. May 11, 2017 at 7:08
  • 1
    @ShreenivasChikati Using what library? If you mean generically then it seems like this deserves a question of its own. May 15, 2017 at 10:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.