Data Matrix ECC 200 Generator for Part Marking: MIL-STD-130 UII Constructs, ISO/IEC 15434 Formats 06 and 12, and GS1 Data Matrix
Make Data Matrix ECC 200 codes for marking parts: MIL-STD-130 unique item identifiers, ISO/IEC 15434 messages with data identifiers or text element identifiers, and GS1 Data Matrix. Every code is checked by a scanner as you type, and exports at true size as DXF, SVG, PDF or EPS for laser, dot peen and CAD. For phone-friendly codes, use the QR Code Generator.
Extra fields after the UII (only if your drawing calls for them)
| Identifier | Value |
|---|
| Identifier | Value | Varies |
|---|
| AI | Value | Varies |
|---|
Tags <RS> <GS> <EOT> <FS> <US> <CR> <LF> become control characters.
<RS> = ASCII 30, <GS> = 29, <EOT> = 4. GS1 codes show the AIs in brackets; the code itself holds FNC1 instead.ECC 200 error correction is built into every size. ISO/IEC 16022 needs at least 1 cell of quiet zone; 2 or more reads better on metal.
"Shrink" makes each square or dot smaller, for beam width or dot size. It applies to one-square-per-cell and circle geometry.
Read a Data Matrix from a picture
Check what an existing mark holds, control characters included. Pick a photo or paste one (Ctrl+V). It's read on your device.
The formats at a glance
Example data for a part with CAGE code 1A2B3, part number ABC-100 and serial number 0042.
| Format | Encoded text | Use for |
|---|---|---|
| MIL-STD-130 construct #2, format 12 | [)><RS>12<GS>MFR 1A2B3<GS>PNO ABC-100<GS>SEQ 0042<RS><EOT> | DoD parts serialized within the part number |
| MIL-STD-130 construct #2, format 06 | [)><RS>06<GS>17V1A2B3<GS>1PABC-100<GS>S0042<RS><EOT> | Same, with ANSI MH10.8.2 data identifiers |
| MIL-STD-130 construct #1, format 12 | [)><RS>12<GS>MFR 1A2B3<GS>SER 0042<RS><EOT> | DoD parts with serial numbers unique across the company |
| MIL-STD-130 construct #1, format 06 | [)><RS>06<GS>18S1A2B30042<RS><EOT> | Same, CAGE and serial in one element |
| GS1 Data Matrix | (01)09501101530003(10)LOT-7(21)0042 | Commercial, medical (UDI) and supply-chain marking |
Which Format Do I Need?
- Your drawing or purchase order names it? Use exactly that. It wins over everything below.
- Part goes to the U.S. DoD with a unique item identifier (IUID)? A MIL-STD-130 construct. Construct #2 if your serial numbers restart for each part number; construct #1 if every serial number is unique across the company.
- Format 06 or 12? Both are allowed. Format 12 (MFR, PNO, SEQ) is common in aerospace (ATA Spec 2000); format 06 (17V, 1P, S) is shorter. Pick the one your customer's readers expect.
- Retail, medical device (UDI) or supply chain? GS1 Data Matrix with a GTIN.
- Internal tracking only? Format 06 or 12 without the UII rules, or plain text.
| Need | Format |
|---|---|
| DoD, serial unique per part number | Construct #2 |
| DoD, serial unique across the company | Construct #1 |
| Aerospace customer, text identifiers | ISO/IEC 15434 format 12 |
| Industry data identifiers | ISO/IEC 15434 format 06 |
| GTIN, lot, expiry, serial | GS1 Data Matrix |
MIL-STD-130 Unique Item Identifier (UII)
The UII is one long ID that is never repeated for any DoD item. It's built from the mark, not stored in it:
| Construct | UII is |
|---|---|
| #1 | IAC + CAGE + serial number |
| #2 | IAC + CAGE + original part number + serial number |
The issuing agency code (IAC) for a CAGE code is D. It's not marked: the reader adds it from the identifier
(17V, MFR, 18S). So CAGE 1A2B3, part ABC-100, serial 0042 gives the construct #2 UII D1A2B3ABC-1000042.
- Construct #1: format 06 uses
18S, the CAGE code and serial number as one element. Format 12 usesMFR+SER. - Construct #2: format 06 uses
17V+1P+S. Format 12 usesMFR+PNO+SEQ. - The table also allows other enterprise identifiers (such as DUNS) and lot-based variants. This page writes the CAGE-based ones.
The part number is the original part number the item was made to. It doesn't change when the part is modified or re-identified later.
Read the whole rule set in MIL-STD-130, free from the DLA ASSIST site.
ISO/IEC 15434 Syntax
| Piece | Meaning |
|---|---|
[)> + <RS> | Message header |
06 / 12 | Format: data identifiers / text element identifiers |
<GS> | Separates fields (ASCII 29) |
<RS> | Ends the format (ASCII 30) |
<EOT> | Ends the message (ASCII 4) |
Format 12 puts one space between the identifier and its data (MFR 1A2B3). Format 06 has no space
(17V1A2B3). Spaces are data: a reader treats MFR 1A2B3 and MFR1A2B3 as different marks.
RS, GS and EOT can't be typed or printed, so drawings show them as <RS>, <GS>,
<EOT> or as the symbols ␞ ␝ ␄. Marking software usually takes them as ^030-style codes or tags. The "Exact text" box above shows what's really in the code.
GS1 Data Matrix
A GS1 Data Matrix starts with a special FNC1 character that tells the reader "GS1 data follows". Each field starts with
a numeric application identifier (AI). Fields that can vary in length end with another FNC1 (sent to the computer as GS)
unless they're last. The brackets in (01)…(10)… are only for people; they're not in the code.
The scan check reports a GS1 code as ]d2, the symbology identifier for GS1 Data Matrix. A plain Data Matrix is ]d1.
| AI | Field | Format |
|---|---|---|
| (01) | GTIN | 14 digits, last is a check digit |
| (10) | Batch or lot | up to 20 characters |
| (11) | Production date | YYMMDD |
| (17) | Expiration date | YYMMDD |
| (21) | Serial number | up to 20 characters |
| (8004) | Individual asset (GIAI) | up to 30 characters |
A GTIN needs a GS1 company prefix, which you license from GS1. The page checks GTIN check digits and field lengths, and the encoder refuses data that breaks the GS1 rules.
Symbol Sizes and Cell Size
ECC 200 has 24 square sizes from 10 × 10 to 144 × 144 cells, and 6 rectangles from 8 × 18 to 16 × 48 (ISO/IEC 16022). The largest holds up to 3,116 digits, 2,335 letters and digits, or 1,556 bytes. Error correction is fixed for each size.
"Smallest that fits" picks the size for you. Choose a fixed size when the drawing calls for one, or to keep every serial number the same size on a production run.
Rectangles fit narrow parts such as shafts and edges.
Mark size = cells × cell size, plus the quiet zone. Typical laser and dot peen marks use cells of about 0.010–0.030 in (0.25–0.75 mm); the marking spec and your reader set the real limits.
Short data makes small marks: uppercase letters and digits pack tighter than lowercase, and long serial numbers push the code up a size.
Calling Out a Data Matrix on a Drawing
LASER ENGRAVE DATA MATRIX ECC 200 IN AREA SHOWN PER MIL-STD-130. CELL SIZE .020 IN [0.51 MM] MIN. QUIET ZONE 2 CELLS MIN. UII CONSTRUCT #2, ISO/IEC 15434 FORMAT 12. ENCODE: [)><RS>12<GS>MFR 1A2B3<GS>PNO ABC-100<GS>SEQ XXXX<RS><EOT> 1 SPACE BETWEEN EACH TEXT ELEMENT IDENTIFIER AND ITS DATA. XXXX = SERIAL NUMBER, UNIQUE FOR EACH PART.
- Symbol (Data Matrix ECC 200, or GS1 Data Matrix), method and marking spec.
- Cell size minimum, quiet zone, and a fixed symbol size if you need one.
- The construct and syntax, and the exact data with every separator and space.
- Which fields change per part, and where their values come from.
- Quality: the verification standard and minimum grade if required (for example AS9132 or ISO/IEC 29158).
Step 4 above writes this note from your settings. See also calling out a QR code.
Laser, Dot Peen and CAD
- Laser on bare metal usually darkens: engrave dark cells. On anodize or paint it usually lightens: engrave the light cells and quiet zone.
- Dot peen makes round dents. Use round dots and one circle per cell; set "shrink" so the dots come out the size your stylus makes.
- Test on scrap of the same material and finish, after any coating.
The DXF is AutoCAD R12, which every CAD and marking program opens. Layers: QR_ENGRAVE (or QR_ENGRAVE_LIGHT)
for the cells, QR_SYMBOL_EDGE and QR_QUIET_ZONE as reference boxes. Units are the ones you chose; the
file name says which. More on CAD import and DWG in the QR Code Generator guide.
Everything runs in your browser; nothing you type is sent anywhere.
Sources and Software
MIL-STD-130N with Change 1, Identification Marking of U.S. Military Property (Table VII and Figures 2–4 for the constructs); ISO/IEC 16022 (Data Matrix); ISO/IEC 15434 (syntax); ISO/IEC 15418 and ANSI MH10.8.2 (data identifiers); ATA Spec 2000 (text element identifiers); GS1 General Specifications (application identifiers, check digits); SAE AS9132 and ISO/IEC 29158 (mark quality).
Codes are made by bwip-js 4.11.4 (MIT), the
JavaScript build of Terry Burton's Barcode Writer in Pure PostScript. The scan check and reader use
zxing-wasm (MIT) on
zxing-cpp (Apache-2.0), loaded the first time
it's needed. Licenses are next to each file in js/vendor/. Data formats, DXF, SVG, PDF and EPS are KasperCalc's own code.