Complete Guide to EDIFACT Format

EDIFACT (Electronic Data Interchange for Administration, Commerce, and Transport) is the international standard format for electronic business document exchange. This comprehensive guide covers everything you need to know about EDIFACT format structure, syntax, and specifications.

Need to format an EDIFACT file? Use our free EDIFACT Formatter to instantly beautify and view your EDIFACT messages.

What is EDIFACT Format?

EDIFACT format is a standardized electronic data interchange format developed by the United Nations. It provides a universal syntax for structuring business documents that can be exchanged between trading partners worldwide, regardless of their internal systems or software.

The format uses a hierarchical structure with specific character separators to organize data into segments, data elements, and composite data elements. This standardization ensures that documents like invoices, purchase orders, and shipping notices can be automatically processed without human intervention.

EDIFACT Format Structure

An EDIFACT message follows a strict hierarchical structure with four main levels:

1. Interchange (UNB/UNZ)

The outermost envelope containing one or more messages. UNB marks the start, UNZ marks the end, and includes sender/receiver identification and interchange reference numbers.

2. Message (UNH/UNT)

Each message represents a complete business document (e.g., ORDERS, INVOIC, DESADV). UNH identifies the message type and version, UNT provides the segment count.

3. Segments

Building blocks of the message, each identified by a 3-character tag (e.g., BGM, DTM, NAD). Segments contain related data elements and are terminated by an apostrophe (').

4. Data Elements

The smallest units of data within segments, separated by plus signs (+). Composite elements use colons (:) to separate component data elements.

EDIFACT Syntax Rules

Understanding EDIFACT syntax is crucial for properly formatting and parsing messages:

CharacterPurposeExample
'Segment terminatorUNH+1+ORDERS:D:96A:UN'
+Data element separatorBGM+220+ABC123+9'
:Component data element separatorDTM+137:20240101:102'
?Release character (escape)FTX+AAA+++Text with ?+ plus'

EDIFACT Format Example

Here's a complete example of an EDIFACT purchase order (ORDERS) message:

UNB+UNOA:2+SENDER+RECEIVER+240101:1200+1'
UNH+1+ORDERS:D:96A:UN'
BGM+220+PO12345+9'
DTM+137:20240101:102'
NAD+BY+123456789::92'
NAD+SU+987654321::92'
LIN+1++1234567890123:EN'
QTY+21:100'
PRI+AAA:25.50'
LIN+2++9876543210987:EN'
QTY+21:50'
PRI+AAA:49.99'
UNS+S'
CNT+2:2'
UNT+14+1'
UNZ+1+1'

UNB: Interchange header with sender, receiver, and timestamp

UNH: Message header identifying this as an ORDERS message

BGM: Document type and reference number

DTM: Date/time information

NAD: Name and address (buyer and supplier)

LIN: Line item details

QTY/PRI: Quantity and price information

Common EDIFACT Message Types

ORDERS

Purchase Order

INVOIC

Invoice

DESADV

Despatch Advice

ORDRSP

Order Response

RECADV

Receiving Advice

PRICAT

Price/Sales Catalogue

EDIFACT File Format Tips

  • Character Encoding: EDIFACT typically uses ASCII or UTF-8 encoding. The UNA segment can define alternative character sets.
  • Line Breaks: While not required, line breaks after each segment improve readability. Use our formatter to automatically add proper line breaks.
  • Validation: Always validate your EDIFACT files against the appropriate message directory (e.g., D96A, D01B) before sending.
  • Compression: Remove unnecessary spaces and empty elements to reduce file size for transmission.

Related Resources

Ready to Format Your EDIFACT Files?

Use our free online EDIFACT formatter to instantly beautify and analyze your EDI messages.

Try EDIFACT Formatter →