HL7 v2 utility

HL7 Message Formatter & Viewer

Paste an HL7 v2 message and inspect its segments, field numbers, components, and basic metadata in a readable browser-based view.

Privacy reminder. Do not paste real patient data, credentials, secrets, production identifiers, or confidential messages. Use synthetic/test HL7 only.

Formatter

Paste HL7 and inspect the structure

This is a practical viewer for development, testing, demos, and troubleshooting. It is not a certified HL7 conformance validator.

Messages stay in your browser.

No message loadedPaste an HL7 message and click Format HL7.

Message summary

No message has been formatted yet.

Formatted HL7 output will appear here.

FAQ

HL7 formatter questions

Is this a certified HL7 validator?

No. It is a practical formatter and viewer.

Can I paste real patient data?

No. Use synthetic, anonymised, or test data only.

Which versions does it support?

It is designed for common pipe-delimited HL7 v2 messages and reads delimiters from MSH where possible.

Practical guide

Turn a pipe-delimited message into an inspectable field map

The formatter is useful when an HL7 message is technically one line, contains unfamiliar repetitions or components, or needs to be discussed with someone who does not have an integration engine open. It preserves the original message while presenting segment, field, repetition, component, and subcomponent boundaries more clearly.

Recommended workflow

  1. Paste one complete HL7 v2 message beginning with MSH.
  2. Confirm the detected message type, trigger event, version, and control ID.
  3. Open the segment associated with the failing mapping or receiving-system error.
  4. Inspect repetitions, components, and subcomponents rather than counting separators manually.
  5. Copy the exact field location, such as PID-3[2].1 or PV1-3.4, into the defect or mapping specification.

Delimiter rules

The field separator is the fourth character of MSH and is conventionally |. MSH-2 declares the component, repetition, escape, and subcomponent characters, commonly ^~\&. A message can use different delimiters, so parsing should follow MSH rather than assume the defaults.

MSH is special: MSH-1 is the field separator itself, while the following visible token is MSH-2. This is why manual field counting in MSH is a frequent source of off-by-one mistakes.

Worked example

Read a repeating identifier correctly

PID|1||12345^^^HOSPITAL^MR~998877^^^NATIONAL^NI||TEST^ALEX

PID-3 contains two repetitions separated by ~. The first identifier has value 12345, assigning authority HOSPITAL, and type MR. The second has value 998877, authority NATIONAL, and type NI. Selecting “the first PID-3 value” without checking the assigning authority or identifier type can map the wrong identifier.

Troubleshooting

Common message-format problems

Line endings and escaping

  • HL7 segments normally end with carriage return, although copied messages may contain line feeds or CRLF.
  • Literal separator characters inside data must be represented using the escape character and an HL7 escape sequence.
  • Blank trailing fields may be omitted, but blank fields in the middle still affect field position.
  • Unexpected MLLP control bytes should be removed or inspected with the MLLP tool before formatting the payload.

Limitations

The formatter does not validate a message against a conformance profile, local interface specification, code table, or receiving system. Common labels are provided for convenience, while custom Z-segments and vendor-specific fields may remain generic.

A readable structure is the start of troubleshooting, not proof that the message is semantically valid.

Authorship and review

Practical guidance backed by integration experience

Maintained and technically reviewed by Health Data Tools, drawing on more than 15 years of healthcare integration experience across HL7, FHIR, CDA, APIs, PKI, and clinical integration systems.

Technically reviewed: