HL7 v2 Message Parser

Paste a pipe-delimited HL7 v2.x message and get a clean, structured breakdown — every segment, field, component and subcomponent, with human-readable names for MSH, PID, OBX and more. Export as nested JSON or a flat CSV table. Everything runs in your browser; no message ever leaves your device.

Try:
Parsed message

About this tool

Paste an HL7 v2.x message and get a structured breakdown of its segments, fields, components, subcomponents, and repetitions. The parser reads the field separator and encoding characters from the MSH segment, handles the special MSH-1 / MSH-2 offset, and can attach human-readable names for common segments and fields such as MSH, PID, PV1, OBR, and OBX.

Use JSON when you want the full hierarchy, including repetitions and nested components. Use CSV when you want a flat table of non-empty leaf values with locations like PID.5.1 or OBX.5. The tool runs locally in your browser, so the message text is not uploaded.

Worked example

Input:

MSH|^~\&|SENDINGAPP|SENDINGFAC|RECVAPP|RECVFAC|20240101120000||ADT^A01|MSG00001|P|2.5
EVN|A01|20240101120000
PID|1||123456^^^HOSPITAL^MR||DOE^JOHN^Q||19800101|M

With output json, descriptions enabled, and HL7 unescaping enabled, the output is a JSON array whose first object is the MSH segment. MSH.9 is split into components ADT and A01, and PID.5 is labeled Patient Name with components DOE, JOHN, and Q.

With output csv, the same message becomes rows like:

Segment,Location,Value,Description
MSH,MSH.9.1,ADT,Message Type
MSH,MSH.9.2,A01,Message Type
PID,PID.5.1,DOE,Patient Name
PID,PID.5.2,JOHN,Patient Name

Limits and edge cases

Does this upload protected health information?

No. The parser runs as WebAssembly in your browser tab. It has no network step and it does not send the pasted message to a server. You should still avoid pasting real patient data into shared machines or screen recordings.

Why is MSH field numbering different from other segments?

HL7 v2 defines MSH-1 as the field separator itself and MSH-2 as the encoding characters. That means the text after MSH|^~\&|... starts at MSH-3. This tool models that offset explicitly, so locations match HL7 field numbering.

What is the difference between JSON and CSV output?

JSON preserves the whole tree: segment → field → repetition → component → subcomponent. CSV flattens only non-empty leaf values into rows with a Location column, which is easier to paste into a spreadsheet or filter for a quick audit.

Can it validate every HL7 version and field name?

No. HL7 v2 dictionaries are large and version/profile-specific. This tool includes common segment and field names for readability, but it does not enforce a full conformance profile or guarantee that every field code is legal for a given version.

Developer & Automation Access

Run it from the terminal

Same engine as this page, headless — via the gizza CLI:

gizza tool hl7-v2-parse 'MSH|^~\&|SENDINGAPP|SENDINGFAC|RECVAPP|RECVFAC|20240101120000||ADT^A01|MSG00001|P|2.5
EVN|A01|20240101120000
PID|1||123456^^^HOSPITAL^MR||DOE^JOHN^Q||19800101|M|||123 MAIN ST^^ANYTOWN^CA^90210
PV1|1|I|ICU^101^1'

New to the CLI? Get gizza →

Open it by URL

Pre-fill and auto-run this tool with query parameters — the names match the API/CLI:

https://gizza.ai/tools/hl7-v2-parse/?data=MSH%7C%5E~%5C%26%7CSENDINGAPP%7CSENDINGFAC%7CRECVAPP%7CRECVFAC%7C20240101120000%7C%7CADT%5EA01%7CMSG00001%7CP%7C2.5%0AEVN%7CA01%7C20240101120000%0APID%7C1%7C%7C123456%5E%5E%5EHOSPITAL%5EMR%7C%7CDOE%5EJOHN%5EQ%7C%7C19800101%7CM%7C%7C%7C123%20MAIN%20ST%5E%5EANYTOWN%5ECA%5E90210%0APV1%7C1%7CI%7CICU%5E101%5E1&output=json&include_descriptions=true&unescape=true

Machine-readable descriptor: tool.json — title + parameters JSON Schema for agents.