Talk:Code 128

Latest comment: 5 months ago by Traut in topic Shift A, Shift B

Information Density edit

what sort of information density can you get with code 128? Could I print 'War and Peace' on a single page? Funkyj 21:38, 15 December 2005 (UTC)Reply

Not by a long way. If you wanted to do something like that, you'd go to a 2 dimensional barcode, and even then a reasonable target would be to get the text on a form onto a 2D barcode that occupied 1/3 of the form. For dense print like a novel (leaving aside whether W&P is denser than most) I think you'd get a less favourable ratio. Midgley 11:15, 26 April 2006 (UTC)Reply

128b vs128c edit

What is the difference between 128b and 128c?

128B can print 0-9, A-Z, a-z and special characters. 128C can encode only numeric data. This restriction allows that two numbers can be encoded with one barcode symbol and reduce the barcode size. For instance, the barcode length of the number "1234" coded with 128B is twice the length of "1234" coded with 128C. One restriction of 128C is that it requires pairs of digits. (For example you could not encode "123". You would need to encode "0123" (or use some other padding mechanism). Another option to this problem is to encode "12" in 128C and then change to 128B for the "3". This increases the barcode size, but allows for higher density barcodes for numbers with an odd digit count.)

External links edit

I've added two links that are very useful for people that want to create their own codes, namely C routines for checksum calculation and the actual bit pattern (which in this format can't be found elsewhere on the net). Unfortunately someone keeps deleting those links. I'm reverting the page again. 17:28 BST 24. Oct. 2006

Please refer to the Talk:European Article Number page for the relevant discussion. --Millbrooky 16:52, 24 October 2006 (UTC)Reply

Clarify a sentence. edit

This sentence needs clarifying: "One error in 2-5 million reads with a checksum using 6.6 wide (2 dots wide) using the 300 dpi printer on the thinnest line of the barcode" —Preceding unsigned comment added by 209.183.18.156 (talk) 00:48, 18 April 2008 (UTC)Reply

"Code 128 includes 101 symbols: 103 data symbols, 3 start codes, and 1 stop code." This sentence cannot be correct (the math simply doesnt add up, for positive integers a sum cannot be smaller than the biggest summand). I am not a barcode expert, but for the math to be valid it should be "Code 128 includes 107 symbols [...]". — Preceding unsigned comment added by 129.187.174.161 (talk) 08:59, 4 August 2011 (UTC)Reply

ISO/IEC 15417:2007 edit

[1] Does ISO/IEC 15417:2007 further replace GS1-128? —Preceding unsigned comment added by Crammer101 (talkcontribs) 15:52, 2 June 2008 (UTC)Reply


Per the GS1 General Specification[2], GS1-128 is a specific implementation of ISO/IEC 15417:2007. A GS1-128 is a Code 128 (as defined in ISO/IEC 15417:2007) with a FNC1 in the first data position.

The GS1-128 symbology is a subset of the more general Code 128 symbology. By agreement

between AIM and GS1, use of the Function 1 Symbol Character (FNC1) in Code 128 symbols in the first symbol character position following the start character has been reserved exclusively for the

GS1 system. Code 128 is fully described in ISO/IEC 15417

96.81.112.196 (talk) 18:52, 21 November 2017 (UTC)Reply

Optimal encoding edit

Finding the optimal Code 128 encoding of an input is not trivial. Perhaps a link to Dynamic programming would be in order?--89.132.129.111 (talk) 19:44, 6 April 2009 (UTC)Reply

Is there a specific example of optimized input? 96.81.112.196 (talk) 18:53, 21 November 2017 (UTC)Reply

Character set encoding edit

Looking for info about barcode readers able to understand the FNC4 special code, that allows the inclusion of character that are not included is ascii set, I haven't found anything That would need a citation reference of source.--Sucoplus (talk) 13:39, 23 May 2009 (UTC)Reply

Uses edit

The article mentions Code 128 may be used for pallet and shipping labeling, but I am interested in how widespread, and what other uses this coding is used for. Is it exclusively for shipping, or is it more broadly used? —Preceding unsigned comment added by 99.255.88.155 (talk) 21:14, 30 January 2011 (UTC)Reply

Check digit edit

The article indicates, "if the check digit's value is lesser than 95 then the ASCII value is obtained by adding 32 to the check digit's value; else the ASCII value is obtained adding 105."

However, based on what I see in my documentation, the rule is: "if the check digit's value is lesser than 96 then the ASCII value is obtained by adding 32 to the check digit's value; else the ASCII value is obtained adding 65." — Preceding unsigned comment added by 13.13.137.1 (talk) 15:27, 25 July 2011 (UTC) --- All of which is quite irrelevant as it has nothing to do with code128, merely how a given application would like to display the checkdigit (if at all). index values >96 would yield ANSI values 128 and beyond. I fail to see what relevance it is mentioning it in the main article. It might just as well discuss 'displaying' FNC_1 or start codes — Preceding unsigned comment added by 203.17.241.8 (talk) 09:45, 7 March 2012 (UTC)Reply


It looks to me as if the checksum in your US zip code example is wrong. The example lists [80] but my calculations yield [92] — Preceding unsigned comment added by 196.209.224.173 (talk) 07:09, 20 December 2011 (UTC)Reply

I've Also Calculated 92 For the check digit in the us zip coed Example. Here is my work

Value Weight Weight x Value
Start C 105 1 105
FNC1 102 1 102
42 42 2 84
18 18 3 54
40 40 4 160
20 20 5 100
50 50 6 300
Code A 101 7 707
0 16 8 128
Sum = 1740
1740 Mod 103 = 92

Illustrations different edit

The two illustrations on this page are both meant to show an encoded Wikipedia word, however the second image (the one with indicators showing the various parts) has the sequence "Start-B FNC1 Wikipedia", while the one at the top is "Start-B Wikipedia". This is slightly confusing if anyone tries to use the image to understand the encoding table, as the article text further down says the FNC1 will be followed by a numeric AI, which the example does not obey. Both barcodes scan fine though. Not sure if this is important, or what to do, but it wasnt clear for readers beyond a cursory review. — Preceding unsigned comment added by 203.167.218.250 (talk) 01:55, 28 September 2011 (UTC)Reply

The second example with the start sequence "Start-B FNC1 Wikipedia" is not a valid barcode. GS1-128 is a subset of Code 128 - agreed between GS1 and ISO/IEC-15417 where the start character is followed by FNC1, a numeric identifier and the data specified by the identifier. — Preceding unsigned comment added by 81.145.133.16 (talk) 13:00, 26 May 2015 (UTC)Reply

The image discussing the parts of the barcode seems to replace (5) and (6) in the list of what the parts are with a (2) and (1) in the actual image. — Preceding unsigned comment added by 70.89.161.242 (talk) 19:20, 23 December 2016 (UTC)Reply

Code128 Auto edit

Besides A, B, C there is Code128 Auto. The explaination is "Automatically switch between the different code sets and performs characters optimization ". But how to do characters optimization? — Preceding unsigned comment added by 220.255.2.133 (talk) 02:42, 22 November 2011 (UTC)Reply

There's no such thing as 'Auto' as a definition for code128. It's probably just a gui dialog box's definition of automatically switching between sets (which for lower case is mandatory), versus that same dialog box 'accepting' a string of data as being already pre-encoded in 128.

'Character optimisation' is simply the detection of 4 or more digits being able to be compressed into bcd bytes. The switch in and out of codeC makes any less than that, pointless. — Preceding unsigned comment added by 203.17.241.8 (talk) 09:36, 7 March 2012 (UTC)Reply

If I encode "2012Wiki" using code 128B and code 128 Auto, the barcodes will have different shapes. Moreover, the 2 "Wikipedia" barcodes in this article also look different. Why?

Code 128 Auto allows for switching between different encodings for greater efficiency - in this case, by starting in Code C, the "2012" can be encoded with just two characters, whereas "2012" takes four in Code B. As for the differing Wikipedia barcodes, one of them appears to include an FNC 1 code before the W. — Preceding unsigned comment added by 212.9.31.12 (talk) 15:22, 17 February 2014 (UTC)Reply

Where to find the Font True Type? edit

Is there somewhere the original Font True Type (.ttf File) of Code 128 to download? — Preceding unsigned comment added by 194.45.150.17 (talk) 15:57, 11 July 2012 (UTC)Reply

Using fonts to create Code 128 barcodes edit

The "characters" column in the encoding table is IMHO a bit misleading, since the mapping of special codes 95-106 and 0 to characters is completely dependent on the font designer.
I know at least two fonts which use other mappings, and none which uses the mapping described here.

If I find the time I'll try a new paragraph on creating codes with fonts...

212.14.81.92 (talk) 08:29, 29 November 2012 (UTC)Reply

128 characters in ASCII? edit

"It can encode all 128 characters of ASCII"

Can it? The table only shows 107 code128 characters, from ASCII 32 (space) upwards. Before that it's all control codes, rather than actual "characters." 212.9.31.12 (talk) 15:16, 17 February 2014 (UTC)Reply

Never mind! The control codes are available in code 128A. — Preceding unsigned comment added by 212.9.31.12 (talk) 15:18, 17 February 2014 (UTC)Reply

In fact, it can encode an character in the Latin-1 charset using the FNC4 character. The value directly succeeding the FNC4 character will be added to 128 to get the Latin-1 value. If there are two FNC4s in a row, encoding will stay in Latin-1 mode until another FNC4 is decoded. 96.81.112.196 (talk) 18:59, 21 November 2017 (UTC)Reply

Dubious edit

The purported Wikipedia barcode (File:Barcode diagram.svg) is incorrect. Code 128 is the symbology. A Code 128 symbol that starts with FNC1 is an EAN-128 that must use application identifiers. The Wikipedia barcode does not use application identifiers. It should delete the FNC1 (preferred) or it should wrap "Wikipedia" with a suitable application identifier (there isn't one except for the 9x series (private information)). Glrx (talk) 18:25, 31 May 2016 (UTC)Reply

Why only 108 codes instead of 216 possible codes? edit

With 3 bars and 3 "spaces" of width 1...4 pixels and total symbol width of 11 pixels I found 216 different codes. But only one half of them is used, e.g. 10101111000 (widths 111143) is used, but 10101110000 (widthds 111134) is not used. Why? The answer is not found in the article. :-/ --RokerHRO (talk) 09:23, 1 October 2018 (UTC)Reply

@RokerHRO: The article states, "Each symbol in the barcode is composed of three bars and three spaces. Each bar or space is 1, 2, 3 or 4 units wide, the sum of the widths of bars must be even (4, 6 or 8 units), the sum of the widths of the spaces must be odd (3, 5 or 7 units), and total 11 units per symbol." The unused code you offer does not follow that rule. Glrx (talk) 17:02, 29 October 2018 (UTC)Reply

ascii code mapping edit

what is listed as "common" mapping isn't common at all. in fact i did not find any font that uses this mapping. as per discussion with guys from the google fonts team as well as the librefont guys (see https://github.com/graphicore/librebarcode/issues/9 ) , we should change the common codes to the ones most commonly found. i will go ahead and do so while preserving the old codes as "uncommon". — Preceding unsigned comment added by Holger Wil (talkcontribs) 09:55, 23 November 2018 (UTC)Reply

Πως δημιουργω μπαρες για e-συνταγες edit

Πως φτιαχνονται οι δυαδικες μπαρες 62.74.11.217 (talk) 17:48, 12 January 2022 (UTC)Reply

۱۲فت غب ر edit

نبننینبنیو 204.18.167.220 (talk) 12:38, 17 May 2023 (UTC)Reply

تثرترل edit

Thanks so much 204.18.167.220 (talk) 12:39, 17 May 2023 (UTC)Reply

How do you encode an FNC4 symbol? edit

The FNC1 through FNC3 are shown in the table Code 128#Bar code widths but FNC4 is notably not anywhere to be found in that table, despite it being mentioned several times elsewhere in this article. Can somebody who has knowledge of how to encode FNC4 in code 128 please add this code to the table? Benhut1 (talk) 18:57, 29 June 2023 (UTC)Reply

Oops. I just realized it is shown in the table, but is referred to differently there. In the table it's shown as "FNC 4" with a space between the C and the 4. Elsewhere in the article it's referred to as "FNC4" without that space. That's why when I did ctrl+f in my browser to search text on the page, it was unable to find it in the table, because I was typing "FNC4" in the browser's text search function, rather than "FNC 4". Benhut1 (talk) 19:04, 29 June 2023 (UTC)Reply

Bar code widths table, Code A/B/C edit

Does anyone understand the table below section bar code widths? I'm afraid that it merges just too much information, without actually explaining its contents. It does offer a very analytic description, but it fails to visualize that properly. Wouldn't it be better to split the contents of that table for what they aim at, but instead provide some actual visual display - such as Pattern "11000111010" as "██___███_█_". It fails to explain the columns "128B" and "128C", it has a merged column "Font position" with subcolumns for "Common/Uncommon/Barcodesoft", it merges values and codes and more, without explanation. I feel this info should be split to at least two separate tables. --Traut (talk) 09:41, 22 November 2023 (UTC)Reply

Shift A, Shift B edit

Please help me to understand the special functions. How does Shift work?

  • From 128A you may call FNC4+Shift B to call the lower case diacritics, from à (Latin-1 hex E0) to þ (hex FE)?
  • From 128A can you call "Shift B" only, or is that for "Shift" too, creating a-z?
  • From 128B, what does Shift A do? Does this require FNC4+Shift A? Which are the valid codes for the ±hex 80 operation by FNC4? The opposite way around FNC4 seems to be valid for 161-223 (hex A0-DF) only. So what does FNC4 do from 128B?
  • The Latin-1 symbols ÷ (F7) and ÿ (FF) are not available?
  • Extended Latin-1 control (hex 80 to 9F) is both undefined and not available?

I guess the answers are hidden deep within ISO/IEC 15417:2007... --Traut (talk) 14:43, 22 November 2023 (UTC)Reply