Insights

MSH Segment Fields Explained: A Field-by-Field HL7 v2 Guide

Every HL7 v2 message starts with the same segment: MSH, the Message Header. Before a receiving system looks at a single patient detail, it reads MSH to work out who sent the message, who it is for, what type of message it is, which version of the standard it follows and how it should be acknowledged. If MSH is wrong, nothing after it matters. The message is rejected, routed to the wrong place or silently ignored.

This guide walks through the MSH segment fields one by one, shows a worked example and lists the fields that cause the most interface problems in practice.

A sample MSH segment

MSH|^~\&|LABSYS|MAINLAB|EHRAPP|GENHOSP|20261020143005||ORU^R01^ORU_R01|MSG000123|P|2.5.1|||AL|NE||UNICODE UTF-8

Paste this into the free AckHarbor™ HL7 Message Viewer and each field will be labelled for you. Below is what every position means.

MSH-1 and MSH-2: the delimiters

MSH is unusual because its first two fields define the syntax for the rest of the message.

A receiver that hard-codes these characters instead of reading them from MSH-2 will break the day a sender uses a different set.

MSH-3 to MSH-6: routing

Interface engines often route on these four values. A typo in MSH-4 after a site go-live is a classic reason messages end up in an error queue.

MSH-7: Date/Time of Message

The time the sending system created the message, in the format YYYYMMDDHHMMSS, optionally followed by fractional seconds and a time-zone offset (for example 20261020143005-0400). This is the creation time of the message, not the time of the clinical event. Event times belong in segments such as EVN or OBR.

MSH-8: Security

Rarely used. Most interfaces leave it empty.

MSH-9: Message Type

The most important field for processing. It has three components:

  1. Message code, such as ADT, ORM, ORU or ACK.
  2. Trigger event, such as A01 (admit) or R01 (unsolicited observation result).
  3. Message structure, such as ORU_R01, which tells the parser what segment grammar to expect (from v2.3.1 onwards).

For a deeper look, see our article on MSH-9 message types.

MSH-10: Message Control ID

A unique identifier assigned by the sender. The receiver echoes it back in MSA-2 of the acknowledgement, which is how the sender matches each ACK to the original message. Duplicate control IDs can cause messages to be treated as resends and dropped.

MSH-11: Processing ID

Tells the receiver how to treat the message: P for production, T for training and D for debugging. Sending T messages into a production system, or P messages into a test system, is a common go-live mistake.

MSH-12: Version ID

The HL7 v2 version the message follows, such as 2.3, 2.5.1 or 2.8. Receivers use it to choose the right parsing rules. A mismatch here is a frequent reason for an AR (application reject) acknowledgement.

MSH-13 and MSH-14: sequencing

Most interfaces leave both empty.

MSH-15 and MSH-16: acknowledgement rules

These two fields control the enhanced acknowledgement mode:

The allowed values are AL (always), NE (never), ER (error/reject only) and SU (successful completion only). If both fields are empty, original acknowledgement mode applies and the receiver returns one ACK with AA, AE or AR in MSA-1. Our article What an HL7 ACK really tells you covers those codes in detail.

MSH-17 to MSH-21: country, character set and profiles

Later versions add more fields, such as MSH-22 to MSH-25 for sending and receiving organisations and networks, but most real-world interfaces stop well before those.

The MSH fields that break interfaces most often

When an interface fails, check these first:

  1. MSH-9: wrong trigger event or missing message structure.
  2. MSH-10: duplicate or empty control IDs.
  3. MSH-11: T versus P mismatches between environments.
  4. MSH-12: version not supported by the receiver.
  5. MSH-3 to MSH-6: routing values that do not match the engine's configuration.
  6. MSH-18: character set declared incorrectly.

Our list of the top 5 interface errors shows how several of these appear in real error queues.

Get the free Quick Reference

Want every key segment on one page? Download the free AckHarbor™ HL7 Quick Reference at ackharbor.com/quick-reference/. It covers MSH, PID, PV1, OBR, OBX and the acknowledgement codes in one printable sheet.

FAQ

What does MSH stand for in HL7?

MSH stands for Message Header. It is the first segment of every HL7 v2 message.

Why is MSH-1 the field separator?

The character immediately after "MSH" defines the field separator, and the standard counts it as field 1. That is why the encoding characters are MSH-2 and the sending application is MSH-3.

Which MSH field identifies the message type?

MSH-9. It contains the message code, the trigger event and (from v2.3.1) the message structure, for example ADT^A01^ADT_A01.

How does an ACK link back to the original message?

The receiver copies the original MSH-10 Message Control ID into MSA-2 of the acknowledgement.

What is the difference between MSH-15 and MSH-16?

MSH-15 asks for a transport-level accept acknowledgement. MSH-16 asks for an application-level acknowledgement. Each uses the values AL, NE, ER or SU.

---

*HL7® and FHIR® are registered trademarks of Health Level Seven International.*

Keep practicing — free HL7 viewer and FHIR viewer with Insights, or the Sandbox.
Academy previewFree Sandbox

Related: HL7 viewer · FHIR JSON viewer · segment reference · free Quick Reference PDF