Reference·HL7 v2·MSH
HL7 v2 Reference

HL7 v2 MSH Explained: Structure, Fields, and Common Mistakes

Jul 27, 2026 · 6 min read

MSH is the first segment of every single HL7 v2 message, no exceptions — it defines the delimiters, names the sender and receiver, timestamps the message, and tells the parser what kind of message is coming next. Get MSH wrong and nothing downstream even has a chance to run.

Quick answer

MSH (Message Header) is the mandatory first segment of every HL7 v2 message — it carries delimiter definitions, sending and receiving system identifiers, the message timestamp, message type, a unique control ID, and the HL7 version in use.

The fields that actually matter in practice

MSH-3 →
Sending Application — names the source system — routing rules on the receiving side often key off this
MSH-4 →
Sending Facility — distinguishes which site or department sent the message in multi-facility environments
MSH-7 →
Date/Time of Message — precision varies by source system — a common source of timestamp bugs
MSH-9 →
Message Type — ADT^A01, ORU^R01, etc. — the field a parser reads first to decide how to interpret everything after it
MSH-10 →
Message Control ID — must be unique per message — duplicate handling and ACK correlation both depend on it
MSH-11 →
Processing ID — P/T/D — the field that separates production data from test traffic
MSH-12 →
Version ID — tells the parser which HL7 v2 revision the rest of the message follows

Example

Synthetic example Generated by Synthibase
MSH|^~\&|ADTSYS|HOSP|BILLSYS|HOSP|20260727143000||ADT^A01|MSG00001458|P|2.5.1

A synthetic ADT admit message header — not a real transmission.

Where this trips people up

MSH-1 and MSH-2 define the delimiters the rest of the message uses, which means a mismatch here — a trading partner sending a different component separator, for instance — can make every subsequent segment parse incorrectly even though each individual field downstream looks perfectly well-formed. Teams that hardcode delimiter assumptions instead of reading them from MSH-1/MSH-2 on every message are the ones who get burned when a new interface partner comes online with nonstandard characters.

HL7 ADT Messages: A01 through A08 Explained
How to Write EDI Test Cases That Actually Catch Go-Live Failures
Generate synthetic MSH segments in seconds
Synthibase generates realistic HL7 v2 messages with fully populated MSH headers — every field, every message type, zero PHI.
Start free trial →
This page is written independently by Synthibase for testing and informational purposes. It is not an official publication of HL7 International or X12/Washington Publishing Company, and is not a substitute for reviewing the official standard or your trading partner's companion guide. See our Terms of Service for full legal terms.