EDI Syntax & Envelope Validator
Validate ISA/IEA, GS/GE, and ST/SE envelope pairing, control numbers, and segment counts.
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.
Envelope integrity is the first gate an EDI document must pass. In X12 the ISA control number must match the IEA, the GS control number must match the GE, and the ST control number must match the SE. The GE count must equal the number of ST/SE pairs inside the group, and the SE count must equal the number of segments from ST to SE inclusive. EDIFACT imposes analogous rules on UNB/UNZ and UNH/UNT.
The Syntax & Envelope Validator checks these pairings, counts, and basic delimiter consistency without uploading the document. It reports each mismatch with the expected and actual values so you can correct the file before it is sent to a trading partner.
X12 Envelope Pairing Rules
ISA13 must equal IEA02. GS06 must equal GE02. ST02 must equal SE02. GE01 must equal the number of transaction sets in the group. SE01 must equal the number of segments starting at ST and ending at SE. IEA01 must equal the number of GS/GE pairs in the interchange. The validator walks the document once, records each header, and verifies the matching trailer.
Delimiter consistency is also checked. The element separator, sub-element separator, and segment terminator declared in the ISA must be used uniformly. A change in terminator mid-document is reported as an error.
EDIFACT Envelope Rules
The interchange control reference in UNB must match the reference in UNZ. The message reference number in UNH must match the reference in UNT. UNT reports the segment count from UNH to UNT inclusive. When a functional group (UNG/UNE) is present, its reference and count are verified the same way.
The validator confirms that the syntax identifier and version in UNB are recognized and that the segment terminator (normally ') is consistent.
Error Reporting
Each violation is listed with the segment, the field, the expected value, and the actual value. Control-number mismatches, count mismatches, and missing trailers are reported separately. The tool does not attempt full semantic validation against an implementation guide; it focuses on the envelope and count rules that every receiver checks first.
A clean report indicates that the envelopes are well-formed. Business-level acceptance still depends on the partner's application rules and is typically confirmed by a 997 or CONTRL.
When to use this tool
- You are about to send a document and want to confirm envelope integrity.
- A trading partner rejected a file for control-number or count errors.
- You generated EDI from another system and need a quick structural check.
- You are testing a 997 or CONTRL generator and want to verify the input first.
- You need to confirm delimiter consistency across a large interchange.
How to use the EDI Syntax & Envelope Validator
- Paste the complete raw EDI document, including all trailers.
- Select X12 or EDIFACT, or allow auto-detection.
- Click Validate. The report lists each check and its result.
- Expand any error to see the expected versus actual values and the line or segment location.
- Correct the source document and re-validate until the report is clean.
- For multi-group interchanges, each GS/GE or UNG/UNE pair is checked independently.
- No data leaves the browser.
Worked examples
Valid Minimal X12 850
ISA*00* *00* *ZZ*SENDER *ZZ*RECEIVER *250101*1200*U*00401*000000001*0*P*>~GS*PO*SENDER*RECEIVER*20250101*1200*1*X*004010~ST*850*0001~BEG*00*SA*PO12345**20250101~SE*3*0001~GE*1*1~IEA*1*000000001~
All checks passed. ISA13=000000001 matches IEA02. GS06=1 matches GE02. ST02=0001 matches SE02. SE01=3 matches segment count. GE01=1 matches transaction-set count. IEA01=1 matches group count.
The document is envelope-valid. Business content is not evaluated.
Control Number Mismatch
ST*850*0001~BEG*00*SA*PO12345**20250101~SE*3*0002~
Error: ST02 (0001) does not match SE02 (0002). Segment count SE01=3 is correct for the three segments present.
Only the control-number pairing fails. The rest of the fragment is structurally countable.
Common mistakes and tips
- Always include the full interchange when validating; partial fragments can only check the segments that are present.
- SE01 counts every segment from ST through SE inclusive; forgetting to count the ST or SE itself is a frequent error.
- X12 control numbers are often zero-padded; the validator compares them as strings after trimming only insignificant leading spaces where the standard allows.
- A missing IEA or UNZ is reported as an unclosed interchange.
- Delimiter errors often cascade; fix the ISA or UNA declaration first, then re-validate.
Frequently asked questions
Does the validator check implementation-guide rules?
No. It checks envelope pairing, control numbers, and segment counts. Partner-specific mandatory elements and code restrictions require a separate guide-aware validator.
Can it validate both X12 and EDIFACT?
Yes. The appropriate envelope rules are applied based on the detected or selected format.
What is reported for a completely missing trailer?
An unclosed header error is raised, listing the header control number that has no matching trailer.
Are binary or AS2-wrapped files supported?
The tool expects plain-text EDI. Extract the EDI payload from any transport wrapper before validation.
Is any data sent to a server?
No. Validation runs locally in the browser.