MSH — Message Header
Required in every HL7 message. Always the first segment.
The MSH segment defines the intent, source, destination, and syntax rules of the message. Every HL7 v2.x message begins with MSH. It controls how the receiving system parses the rest of the message.
Real-World Context
When an interface fails to parse incoming messages, MSH is the first place to check. Encoding character mismatches between sending and receiving systems are the #1 cause of parsing failures in production. Verify MSH.9 (message type) matches your channel filter exactly, including the trigger event code.
Field Reference
Click any row to see the full description, common values, and troubleshooting tip.
| # | Field Name | Type | Req | Max Len | |
|---|---|---|---|---|---|
| 1 | Field Separator | ST | R | 1 | ▶ |
| 2 | Encoding Characters | ST | R | 4 | ▶ |
| 3 | Sending Application | HD | O | 227 | ▶ |
| 4 | Sending Facility | HD | O | 227 | ▶ |
| 5 | Receiving Application | HD | O | 227 | ▶ |
| 6 | Receiving Facility | HD | O | 227 | ▶ |
| 7 | Date/Time Of Message | TS | O | 26 | ▶ |
| 8 | Security | ST | O | 40 | ▶ |
| 9 | Message Type | MSG | R | 15 | ▶ |
| 10 | Message Control ID | ST | R | 199 | ▶ |
| 11 | Processing ID | PT | R | 3 | ▶ |
| 12 | Version ID | VID | O | 60 | ▶ |
| 13 | Sequence Number | NM | O | 15 | ▶ |
| 14 | Continuation Pointer | ST | O | 180 | ▶ |
| 15 | Accept Acknowledgment Type | ID | O | 2 | ▶ |
| 16 | Application Acknowledgment Type | ID | O | 2 | ▶ |
| 17 | Country Code | ID | O | 3 | ▶ |
| 18 | Character Set | ID | O | 16 | ▶ |
| 19 | Principal Language Of Message | CE | O | 250 | ▶ |
| 20 | Alternate Character Set Handling Scheme | ID | O | 13 | ▶ |
| 21 | Message Profile Identifier | EI | O | 427 | ▶ |
Example Segment
1MSH||^~\&|EPIC|HOSPITAL_A|MIRTH|LAB_MAIN|20260310143205||ADT^A01^ADT_A01|MSG00001|P|2.5.1
Related Segments
Used In Message Types
Parse messages with MSH in real time
Paste any HL7 message into our free viewer. Decodes every segment and field instantly, client-side.
Open HL7 Message Viewer →Need HL7 mapping templates?
The HL7 Integration Toolkit includes field mapping worksheets, interface spec templates, and a go-live checklist for every major HL7 message type.
View HL7 Integration Toolkit →