EDI X12 Formatter & Beautifier
Format, beautify, and indent raw ANSI ASC X12 and EDIFACT EDI transactions with automatic segment terminator and element delimiter detection.
Client-Side Execution & Privacy Guarantee
This utility executes 100% locally in your web browser. Your inputs, tokens, queries, and data payloads are never transmitted to any external server or backend.
Raw EDI often arrives as a single long line or with inconsistent line breaks, making visual inspection difficult. The EDI X12 Formatter detects the segment terminator and element delimiter, then rewrites the document with one segment per line and optional indentation that reflects loop nesting.
The formatter operates entirely in the browser and preserves every character of business data; only whitespace and line breaks are adjusted. Both ANSI X12 and UN/EDIFACT are supported.
Automatic Delimiter Detection
For X12 the formatter reads the ISA segment. The element delimiter is the character in position 4, the sub-element delimiter is ISA16, and the segment terminator is the character that follows the fixed-length ISA. For EDIFACT it reads the UNA service-string advice when present, or falls back to the conventional + : ' set.
Once the delimiters are known, the entire interchange is tokenized into segments. Any pre-existing line breaks or spaces that are not part of element data are discarded so the output is canonical.
Pretty-Printing and Indentation
Each segment is emitted on its own line. When indentation is enabled, the formatter tracks loop entry and exit (for example the start of an N1 loop or a PO1 line-item loop) and indents subordinate segments. The result resembles a structured outline rather than a flat stream.
Users may choose a compact mode (one segment per line, no indent) or a fully indented mode. Trailing segment terminators are retained so the formatted file remains a valid EDI document.
Preservation of Content
Element values, including those that contain spaces or special characters, are copied verbatim. Control numbers, counts, and partner identifiers are never altered. The only modifications are the insertion of newlines and optional leading whitespace for readability.
After formatting, the document can be copied back into a validator or a diff tool; the semantic content is identical to the input.
When to use this tool
- Make a minified EDI file readable before manual review or debugging.
- Prepare a sample transaction for documentation or a partner implementation guide.
- Normalize line endings before storing EDI in a version-control system.
- Quickly confirm delimiter characters when a file fails to parse in another tool.
- Indent a complex claim or order so that loop structure is visually apparent.
How to use the EDI X12 Formatter & Beautifier
- Paste or drop a raw X12 or EDIFACT file.
- The formatter auto-detects delimiters and displays them.
- Choose compact or indented output.
- Optionally force a specific terminator or delimiter if auto-detection fails.
- Click Format; the beautified document appears immediately.
- Copy or download the result.
Worked examples
Minified 850 to indented form
ISA*00* *00* *ZZ*A*ZZ*B*240101*0000*U*00401*1*0*P*>~GS*PO*A*B*20240101*0000*1*X*004010~ST*850*0001~BEG*00*SA*PO1**20240101~PO1*1*10*EA*5**VP*W~SE*4*0001~GE*1*1~IEA*1*1~
ISA*00* *00* *ZZ*A*ZZ*B*240101*0000*U*00401*1*0*P*>~ GS*PO*A*B*20240101*0000*1*X*004010~ ST*850*0001~ BEG*00*SA*PO1**20240101~ PO1*1*10*EA*5**VP*W~ SE*4*0001~ GE*1*1~ IEA*1*1~
One segment per line; the PO1 line-item loop is indented.
EDIFACT with UNA
UNA:+.? 'UNB+UNOA:2+SENDER+RECEIVER+240101:1200+1'UNH+1+ORDERS:D:96A:UN'BGM+220+PO1+9'UNT+3+1'UNZ+1+1'
UNA:+.? ' UNB+UNOA:2+SENDER+RECEIVER+240101:1200+1' UNH+1+ORDERS:D:96A:UN' BGM+220+PO1+9' UNT+3+1' UNZ+1+1'
UNA is preserved; each segment starts on a new line.
Common mistakes and tips
- If auto-detection fails, inspect the first 106 characters of an X12 file; the ISA is fixed-length and reveals the delimiters.
- Indented output is for human reading; some legacy systems reject leading whitespace, so use compact mode for retransmission.
- The formatter does not validate content; pair it with the EDI validator when structural correctness must be confirmed.
- Very long element values are left intact; horizontal scrolling may be required in the output pane.
- Copying the formatted result into a text editor that converts line endings is safe; EDI parsers ignore the newlines.
Frequently asked questions
Does formatting change any business data?
No. Only newlines and optional indentation whitespace are added. Every element value remains byte-for-byte identical.
What if the file uses non-standard delimiters?
Auto-detection handles any printable delimiter. You can also override the detected characters manually.
Can I format only part of an interchange?
Yes. Paste any well-formed fragment that begins with a recognizable header; the formatter will process the supplied text.
Is the indented form still valid EDI?
Most modern parsers ignore whitespace between segments. For strict legacy systems, choose the compact (non-indented) option.
Does it support both X12 and EDIFACT in one session?
Yes. The formatter examines the first segment and applies the appropriate rules.