X12 vs EDIFACT: A Detailed Comparison
There is no single global EDI standard. Two dominate the world, and which one you encounter depends mostly on geography. ANSI X12 rules North America. UN/EDIFACT rules Europe and most of the rest of the world. They do the same job - moving orders, invoices, shipping notices, and payments between companies - but they look quite different on the wire, and understanding both is valuable for anyone working in global trade.
The quick comparison
| ANSI X12 | UN/EDIFACT | |
|---|---|---|
| Region | North America | International (Europe, Asia, global) |
| Naming | Numbers (850, 810, 856) | Names (ORDERS, INVOIC, DESADV) |
| Governing body | ASC X12 | UN/CEFACT |
| Element separator | * | + |
| Segment terminator | ~ | ' |
| Component separator | : | : |
| Envelope | ISA / GS / ST | UNB / UNG / UNH |
Syntax differences
The most immediately visible difference is the delimiters - the characters that separate the pieces of the file.
X12 syntax
ST*850*0001~ BEG*00*SA*PO-99831**20240115~
Segments end with a tilde ~, elements are separated by an asterisk *, and sub-elements (components) by a colon :. The delimiters are declared implicitly by their position in the opening ISA segment, which is fixed-width.
EDIFACT syntax
UNH+1+ORDERS:D:96A:UN' BGM+220+PO-55012+9'
Segments end with an apostrophe ', elements with a plus +, and components with a colon :. EDIFACT can also use an optional UNA service string at the very start of the interchange to explicitly declare its delimiters, and it supports a release (escape) character - by default ? - so that a delimiter character can appear literally inside a data value.
That release character is a subtle but important difference. In EDIFACT, ?+ means a literal plus sign rather than an element separator. X12 has no equivalent escape mechanism, which is one reason X12 data tends to avoid the delimiter characters entirely.
Structure and envelope differences
Both standards wrap their content in nested envelopes, but the envelope segments are named and built differently.
X12 uses a three-level envelope: ISA/IEA for the interchange, GS/GE for the functional group, and ST/SE for each transaction set. The ISA is a fixed-length, 106-character segment, which makes it unusually rigid compared to the rest of X12.
EDIFACT uses UNB/UNZ for the interchange, an optional UNG/UNE for the functional group, and UNH/UNT for each message. EDIFACT envelopes are variable length and rely on delimiters rather than fixed positions.
In both standards, the innermost header - ST in X12, UNH in EDIFACT - is what tells you which document type you are looking at. In EDIFACT the UNH also carries the message version, like D:96A:UN, which identifies the directory, release, and controlling agency so the receiver knows which dictionary of segments to apply.
How transactions map between the two
The same business document exists in both standards under different labels. If you know one, you can usually find its counterpart:
| X12 | EDIFACT | Document |
|---|---|---|
| 850 | ORDERS | Purchase order |
| 855 | ORDRSP | Order response / acknowledgment |
| 860 | ORDCHG | Purchase order change |
| 856 | DESADV | Advance ship notice / despatch advice |
| 810 | INVOIC | Invoice |
| 820 | REMADV | Payment / remittance advice |
| 846 | INVRPT | Inventory report |
| 832 | PRICAT | Price / sales catalogue |
| 997 | CONTRL | Functional acknowledgment |
The mapping is rarely perfect - the standards model some details differently - but at the document level the correspondence is reliable.
Which one will you deal with?
If you trade primarily with United States or Canadian partners, you will mostly see X12. If you trade with European, Middle Eastern, or Asian partners, expect EDIFACT. Many companies that operate internationally have to support both, and EDI translation software often converts between them so internal systems only deal with one format.
There are also industry-specific subsets. Automotive uses EDIFACT subsets like ODETTE and VDA in Europe. Retail uses both. Healthcare in the United States is almost entirely X12, mandated by HIPAA. Knowing the industry usually tells you the standard.
Practical tips for reading either one
- Find the header first. Look for
ST(X12) orUNH(EDIFACT) to identify the document type before anything else. - Identify the delimiters. In X12, read them from the ISA. In EDIFACT, check for a UNA string, or assume the defaults (
+,:,'). - Watch the parties. X12 uses N1 loops; EDIFACT uses NAD segments. Both tell you who is buying, selling, and shipping.
EdiPeek reads both standards. Paste an X12 or an EDIFACT message and get a plain-English breakdown, in your browser, with nothing uploaded.
X12 viewer EDIFACT viewer