# 128码

**128码**（Code 128）是一种高密度、可变长度的线性条码符号体系，能够编码全部128个ASCII字符，包括数字、大小写字母、标点符号和控制字符。它由计算机识别公司（Computer Identics Corporation）于1981年开发，凭借其高信息密度和可靠性，与EAN和UCC符号一起用于全球物流领域<sup>[1](https://assets.omron.eu/downloads/latest/manual/en/q284_code_reader_technical_manual_en.pdf?v=3)</sup>。其最广为人知的应用标准是GS1-128，这是贯穿供应链用于承载GS1标识键和属性数据的一个子集<sup>[2](https://www.gs1.org/standards/gs1-system-architecture-document/90)</sup>。

| 关键事实 | 详情 |
|---|---|
| 起源 | 由计算机识别公司于1981年开发<sup>[1](https://assets.omron.eu/downloads/latest/manual/en/q284_code_reader_technical_manual_en.pdf?v=3)</sup> |
| 字符集 | 全部128个ASCII字符，通过三个可在同一符号内混用的码集（A、B和C）实现<sup>[1](https://assets.omron.eu/downloads/latest/manual/en/q284_code_reader_technical_manual_en.pdf?v=3)</sup><sup> • </sup><sup>[3](https://ref.gs1.org/standards/genspecs/24.0.0/)</sup> |
| 字符结构 | 六个元素（三个条和三个空），每个宽1至4个模块，每个符号字符共11个模块；条所占模块数之和始终为偶数，从而实现自校验<sup>[4](https://standards.iteh.ai/catalog/standards/iso/a1e82dff-aac7-4291-9f42-5240550125b5/iso-iec-15417-2007)</sup> |
| 校验字符 | 强制性的；符号字符值的加权和除以103，余数即为校验值<sup>[3](https://ref.gs1.org/standards/genspecs/24.0.0/)</sup> |
| 开销 | 非数据开销为35个模块（起始、校验和终止字符）；终止字符为13个模块<sup>[4](https://standards.iteh.ai/catalog/standards/iso/a1e82dff-aac7-4291-9f42-5240550125b5/iso-iec-15417-2007)</sup> |
| 标准 | ISO/IEC 15417:2007（第2版），2021年复审确认，含一项修正案<sup>[5](https://www.iso.org/standard/43896.html)</sup> |
| GS1-128限制 | 最多48个数据字符，含静区总长度不超过165.10毫米；两侧静区至少各10X<sup>[3](https://ref.gs1.org/standards/genspecs/24.0.0/)</sup> |

## 符号结构

从左至右阅读，一个128码符号由前导静区、起始字符、一个或多个表示数据和特殊字符的字符、一个强制性符号校验字符、一个终止字符以及尾部静区组成<sup>[4](https://standards.iteh.ai/catalog/standards/iso/a1e82dff-aac7-4291-9f42-5240550125b5/iso-iec-15417-2007)</sup>。静区是条码左右两侧的空白区域；对于128码，其最小宽度为10X，其中X为模块宽度<sup>[4](https://standards.iteh.ai/catalog/standards/iso/a1e82dff-aac7-4291-9f42-5240550125b5/iso-iec-15417-2007)</sup>。

每个符号字符由六个元素组成——三个条和三个空交替排列，以条开头，每个宽1、2、3或4个模块，总宽度为11个模块<sup>[4](https://standards.iteh.ai/catalog/standards/iso/a1e82dff-aac7-4291-9f42-5240550125b5/iso-iec-15417-2007)</sup>。任何符号字符中条模块之和始终为偶数，因此空模块之和始终为奇数；这一奇偶特性实现了字符自校验<sup>[3](https://ref.gs1.org/standards/genspecs/24.0.0/)</sup>。终止字符在长度上是个例外：它包含一个额外的终止条，占据13个模块<sup>[3](https://ref.gs1.org/standards/genspecs/24.0.0/)</sup>。由于起始字符和校验字符各占11个模块，终止字符占13个模块，一个普通128码条码每编码一个字符占11个模块，另加35个模块，不含静区。<sup>[4](https://standards.iteh.ai/catalog/standards/iso/a1e82dff-aac7-4291-9f42-5240550125b5/iso-iec-15417-2007)</sup>

## 码集与校验字符

128码有三个字符集，称为码集A、B和C<sup>[3](https://ref.gs1.org/standards/genspecs/24.0.0/)</sup>。码集A包含大写字母数字和标点字符以及控制字符（ASCII值00至95）；码集B增加了小写字母（ASCII 32至127）；码集C包含从00到99的100个数字对以及三个特殊字符，因此数字数据以每个符号字符两位数字的方式编码<sup>[3](https://ref.gs1.org/standards/genspecs/24.0.0/)</sup>。起始字符选择初始码集，码A、码B、码C字符或移位字符可在符号内改变码集；移位字符仅对紧随其后的一个字符改变码集<sup>[3](https://ref.gs1.org/standards/genspecs/24.0.0/)</sup>。因此同一数据可由不同符号表示，应用规范并不规定使用哪些码集；GS1规范包含规则，以针对任何给定数据最小化符号长度<sup>[3](https://ref.gs1.org/standards/genspecs/24.0.0/)</sup>。

每个符号都携带一个校验字符，基于消息中字符值（包括起始字符）的加权和以模103校验和计算<sup>[6](https://www.crifan.com/files/doc/docbook/symbology_code128/release/webhelp/calc_check_digit.html)</sup>。起始字符权重为1，其后每个符号字符依次加权1、2、3，直至n，不包括校验字符本身；每个值乘以其权重，乘积求和，总和除以103，余数即为校验字符值<sup>[3](https://ref.gs1.org/standards/genspecs/24.0.0/)</sup>。在一个GS1示例中，编码批号2503X，乘积之和为1150，1150除以103余17，即为校验字符值<sup>[7](https://ref.gs1.org/standards/genspecs/23.0.0/)</sup>。校验字符不显示在人工可读解释中，也不由解码器传输<sup>[3](https://ref.gs1.org/standards/genspecs/24.0.0/)</sup>。

## 功能字符

128码保留了若干对阅读器有意义但无ASCII对应值的非数据字符：码集A和B的最后七个字符（值96至102）以及码集C的最后三个字符（值100至102）<sup>[3](https://ref.gs1.org/standards/genspecs/24.0.0/)</sup>。功能字符（FNC）向读取设备提供特殊操作和指令。FNC2（消息附加）指示阅读器存储该符号的数据并在传输下一个符号的数据时将其作为前缀一并传输，从而允许多个符号串联；FNC3指示阅读器将数据解释为初始化或重新编程指令而非传输；FNC4表示扩展ASCII字符集（字节值128至255），在后续数据字符的ASCII值上加128<sup>[3](https://ref.gs1.org/standards/genspecs/24.0.0/)</sup>。

## GS1-128

GS1-128是128码的一个子集，在起始字符之后的第一个符号字符位置使用功能1符号字符（FNC1），保留该模式专用于编码GS1应用标识符数据<sup>[2](https://www.gs1.org/standards/gs1-system-architecture-document/90)</sup>。它由GS1（当时的EAN.UCC）于1988年开发，以满足随着销售点、电子订购和电子数据交换等配送系统的发展而对更先进的产品、物流和业务管理的需求<sup>[1](https://assets.omron.eu/downloads/latest/manual/en/q284_code_reader_technical_manual_en.pdf?v=3)</sup>。以GS1-128双字符起始模式之一开头的128码符号始终是GS1-128条码；不以该模式开头的则绝不是GS1-128条码<sup>[8](https://ref.gs1.org/standards/genspecs/)</sup>。

一个GS1-128符号由前导静区、起始字符A、B或C、FNC1字符、数据（应用标识符加数据字段）、符号校验字符、终止字符和尾部静区组成<sup>[9](https://support.gs1.org/support/solutions/articles/43000734455/)</sup>。每个数据字段前都有一个GS1应用标识符（AI），即一个两、三或四位的数字前缀，用于标识后续数据的含义和格式；AI超过100个，例如（00）代表[系列货运包装箱代码](https://www.edgepedia.org/zh/serial-shipping-container-code)，（01）代表全球贸易项目编号<sup>[10](https://www.gs1.org/gs1-application-identifiers)</sup>。多个元素串可串联在一个符号中，固定长度串放在前面，可变长度串之间用FNC1或控制字符<GS>分隔<sup>[10](https://www.gs1.org/gs1-application-identifiers)</sup><sup> • </sup><sup>[3](https://ref.gs1.org/standards/genspecs/24.0.0/)</sup>。

GS1-128符号限制为48个数据字符，包括应用[标识符](https://www.edgepedia.org/zh/identifier)和用作分隔符的任何FNC1，其含静区的总长度不得超过165.10毫米（6.500英寸）<sup>[3](https://ref.gs1.org/standards/genspecs/24.0.0/)</sup>。对于含N个符号字符的符号，含两个10模块静区的总长度为（11N + 66）个模块<sup>[11](https://ref.gs1.org/standards/genspecs/21.0.1/)</sup>。解码数据前会加上符号体系标识符]C1（如使用），起始、终止、功能、码集、移位和校验字符不包含在传输数据中；位于第三位或更后位置的FNC1作为控制字符<GS>（ASCII值十进制29，十六进制1D）传输<sup>[3](https://ref.gs1.org/standards/genspecs/24.0.0/)</sup>。

## 标准化与印刷质量

该符号体系由ISO/IEC 15417规定，涵盖符号体系特性、数据字符编码、尺寸、解码算法、应用定义参数以及符号体系标识符前缀串<sup>[5](https://www.iso.org/standard/43896.html)</sup>。现行版本ISO/IEC 15417:2007（第2版，2007年6月）于2021年最后一次复审确认，含一项修正案<sup>[5](https://www.iso.org/standard/43896.html)</sup>。

印刷质量依据[ISO/IEC 15416](https://www.edgepedia.org/zh/iso-iec-15416)分级，该标准允许符号体系规范增加合格/不合格判据；对于GS1-128，静区至少为10Z（Z为平均测量模块宽度）评为4级（A），静区较小时评为0级（F）<sup>[11](https://ref.gs1.org/standards/genspecs/21.0.1/)</sup>。对于GS1物流标签，允许的X尺寸范围为0.495毫米至0.94毫米，目标值为0.495毫米，标签上所有GS1-128符号的条高最低为31.75毫米<sup>[12](https://www.gs1.org/standards/gs1-logistic-label-guideline/1-3)</sup>。GS1关于避免扫描问题的指南列出了应执行的检查项，包括正确的校验位计算、足够的静区、充分的条与背景对比度、适当的符号尺寸以及无损坏的印刷<sup>[13](https://support.gs1.org/support/solutions/articles/43000734141-what-should-i-check-to-ensure-good-quality-barcodes-)</sup>。

## References

1. [Code Reader Technical Guide, Omron (Code 128 and GS1-128 section)](https://assets.omron.eu/downloads/latest/manual/en/q284_code_reader_technical_manual_en.pdf?v=3)
2. [GS1 System Architecture Document, Annex A.2.1.3 GS1-128](https://www.gs1.org/standards/gs1-system-architecture-document/90)
3. [GS1 General Specifications Standard, Release 24.0 (2024)](https://ref.gs1.org/standards/genspecs/24.0.0/)
4. [ISO/IEC 15417:2007 preview, iTeh Standards](https://standards.iteh.ai/catalog/standards/iso/a1e82dff-aac7-4291-9f42-5240550125b5/iso-iec-15417-2007)
5. [ISO/IEC 15417:2007, ISO.org standard page](https://www.iso.org/standard/43896.html)
6. [Code 128 Symbology Introduction: Calculate the Check/Checksum Digit](https://www.crifan.com/files/doc/docbook/symbology_code128/release/webhelp/calc_check_digit.html)
7. [GS1 General Specifications Standard, Release 23.0 (2023), check character example](https://ref.gs1.org/standards/genspecs/23.0.0/)
8. [GS1 General Specifications Standard, current release (26.0, 2026)](https://ref.gs1.org/standards/genspecs/)
9. [What is the format of GS1-128?, GS1 GO Customer Service Portal](https://support.gs1.org/support/solutions/articles/43000734455/)
10. [GS1 Application Identifiers, GS1](https://www.gs1.org/gs1-application-identifiers)
11. [GS1 General Specifications, Release 21.0.1 (2021)](https://ref.gs1.org/standards/genspecs/21.0.1/)
12. [GS1 Logistic Label Guideline, version 1.3](https://www.gs1.org/standards/gs1-logistic-label-guideline/1-3)
13. [What should I check to ensure good quality barcodes?, GS1 GO Customer Service Portal](https://support.gs1.org/support/solutions/articles/43000734141-what-should-i-check-to-ensure-good-quality-barcodes-)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 30, 2026; Oct 15, 2026 · Edited: Sep 30, 2026; Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 软件与编程 › Data formats and serialization › Text, encodings, and archives

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/code-128

English original: https://www.edgepedia.org/code-128
