xBarcodexBarcode
ISO ISO/IEC 15417:2007

Code 128 Barcode Standard & Generator

A high-density alphanumeric barcode. Our engine uses dynamic lookup algorithms to automatically switch between Subsets A, B, and C for the shortest possible symbol width.

Live Generator
22/500

Completes check digits when their position is clear. Use parenthesized AIs for GS1. Existing check digits are validated. Other formats keep their usual behavior.

FG
BG
🛡️Zero Data Retention: Encoded in edge memory. Never logged or stored.

Technical Specifications

Structure Start Pattern + Data Codewords (auto-switched) + Checksum (Modulo 103) + Stop Pattern + Quiet Zone
Capacity Variable length (theoretically unlimited, practical limit ~48 chars per standard width)
Character Set Full ASCII 128 characters (using Subsets A, B, C)
Quiet Zone Requirement ≥ 10x module width (Standard quiet zone)

Common Applications

This standard is widely used in the following industries:

Logistics, Shipping Labels (GS1-128), Inventory Tracking, Product Labels
Input Constraints & Parity: This format computes a weighted Modulo-103 checksum across all codewords (including start characters, subset switches, and data). Internal symbols and check digits are generated automatically.
Developer Quickstart

Automate Code 128 via API

Full API Reference →
curl -X POST https://api.xbarcode.ai/v1/render \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -d '{
  "format": "code_128",
  "content": "CODE-128-DEMO"
}' > barcode.svg
API outputs: SVG, PDF, EPS and matrix JSON. PNG is exported in the browser. < 20ms Edge latency

⚡ The Science Inside

How our Rust engine optimizes this specific format:

Dynamic-programming encoder guarantees the minimum Code 128 codeword sequence across Sets A/B/C.

  • Pre-tokenization understands {FNC1}…{FNC4} and ~1…~4 syntax (~~ escapes a literal ~) and validates encodability.
  • Mode C pairs digits to pack 00-99 into one codeword; SHIFT and CODE transitions are costed in DP.
  • GS1 mode injects FNC1 immediately after the START code and treats lone ~ separators as FNC1.
  • Extended ASCII (128-255) is supported via FNC4 with set-specific mappings.
  • Checksum and STOP code generation follow the Code 128 spec exactly.
Related Standards

Alternative Symbologies related to Code 128

Need an Industry-Grade Solution?

Explore how xBarcode powers retail GTIN, shipping labels, and GS1 Digital Link migration.