Back to Projects

Health Informatics Guide

HL7 v2 in 10 Minutes

A Beginner's Guide to Reading Healthcare Messages

This quick-start guide helps beginners understand the basic structure of HL7 v2 messages, identify key sections, and know where to find important information - no programming experience required.

10 minutes No programming required Health informatics learners Created, reviewed & edited by: Lillian Dong Published: June 17, 2026

AI assistance disclosure:
Some explanations and sample messages were drafted with AI assistance. The final guide was reviewed, edited, and organized by the author. All examples are simulated for educational use.

01

What Is HL7 v2?

HL7 v2 is a healthcare messaging standard used to exchange information between healthcare systems.

HL7 v2 messages may be used when:

  • a patient is admitted to a hospital
  • a patient is transferred to another unit
  • a lab test is ordered
  • a lab result is sent back to the electronic health record
  • patient demographic information is updated

Think of HL7 v2 as a structured text message that one healthcare system sends to another.

System A registration, lab, or hospital system
HL7 v2 structured text sent between systems
System B EHR, clinic system, or downstream app

02

The Four Building Blocks

An HL7 v2 message has four main building blocks:

1. Message The complete HL7 v2 message sent between systems.
2. Segment One line of the message.
3. Field A piece of information within a segment.
4. Delimiter Symbols used to separate fields and components.
Annotated HL7 v2 message showing message, segment, field, and delimiter building blocks.

In this example, the whole board is the message, each row is a segment, highlighted values are fields, and symbols such as | separate the parts.

03

Segments

Each line in an HL7 v2 message is called a segment.

The first three letters of each line are the Segment ID.

Common Segments

Segment Stands For Meaning
MSH Message Header What type of message is this?
EVN Event Type What event triggered the message?
PID Patient Identification Who is the patient?
PV1 Patient Visit What visit or encounter is this?
ORC Common Order What order was placed?
OBR Observation Request What test or observation was requested?
OBX Observation Result What was the result?
AL1 Allergy Information Does the patient have allergies?
i

Important Note

Not every HL7 v2 message contains all of these segments. Required and optional segments depend on the message type.

Admission message

MSH, EVN, PID, PV1

Lab result message

MSH, PID, OBR, OBX

04

Fields

A field is one piece of information inside a segment.

Fields are separated by the pipe symbol:

|

Example: MSH Segment

MSH|^~\&|REG|HOSPITAL|EHR|CLINIC|202606151030||ADT^A01|MSG00001|P|2.5.1

MSH Field Breakdown

Field Value Meaning
MSH-1|Field separator
MSH-2^~\&Encoding characters
MSH-3REGSending application
MSH-4HOSPITALSending facility
MSH-5EHRReceiving application
MSH-6CLINICReceiving facility
MSH-7202606151030Message date/time
MSH-8blankSecurity
MSH-9ADT^A01Message type
MSH-10MSG00001Message control ID
MSH-11PProcessing ID
MSH-122.5.1HL7 version

This means:

The message was sent from REG at HOSPITAL.
The message was sent to EHR at CLINIC.
The message type is ADT^A01.
The message ID is MSG00001.
The HL7 version is 2.5.1.
!

Blank fields still count.

MSH has a total of 21 fields in HL7 v2.5.1, but not all fields are used in every message. In ...|202606151030||ADT^A01|..., the || means MSH-8 is blank.

05

Delimiters: Learn the Symbols

HL7 v2 uses symbols called delimiters to separate information.

The most important delimiter is:

| = field separator

Example

PID|1||123456^^^HOSPITAL^MR||DOE^JANE||19800115|F

Each | separates one field from the next.

Common HL7 v2 Delimiters

|Field separatorSeparates fields
^Component separatorSeparates smaller parts inside a field
~Repetition separatorShows repeated values
\Escape characterAllows special characters to be used as text
&Subcomponent separatorSeparates even smaller parts
||Blank fieldA field has no value
^^Blank componentA component has no value
i

Beginner Tip

Do not try to memorize every field. First, learn how to split the message into parts.

06

Step-by-Step Example: Read One HL7 v2 Message

Use this sample message:

MSHMSH|^~\&|REG|HOSPITAL|EHR|CLINIC|202606151030||ADT^A01|MSG00001|P|2.5.1
EVNEVN|A01|202606151030
PIDPID|1||123456^^^HOSPITAL^MR||DOE^JANE||19800115|F
PV1PV1|1|I|4N^402^1||||12345^SMITH^JOHN

This is a simulated message and does not contain real patient information.

Step 1: Identify the Segments

Each line starts with a three-letter segment ID.

MSHMessage information
EVNEvent information
PIDPatient information
PV1Visit information

Step 2: Read the Message Header

Look at the MSH segment:

MSH|^~\&|REG|HOSPITAL|EHR|CLINIC|202606151030||ADT^A01|MSG00001|P|2.5.1

MSH tells us...

  • This is an ADT^A01 message.
  • It was sent from REG at HOSPITAL to EHR at CLINIC.
  • The message ID is MSG00001.
  • The HL7 version is 2.5.1.

Step 3: Read the Patient Information

Look at the PID segment:

PID|1||123456^^^HOSPITAL^MR||DOE^JANE||19800115|F
PID-3123456
PID-5DOE^JANE
PID-719800115
PID-8F
i

Privacy note

The patient information shown here is simulated sample data only. Do not paste real patient information into public online tools.

This tells us:

The patient is Jane Doe.
The patient ID is 123456.
The date of birth is 1980-01-15.
The administrative sex is Female.

Step 4: Read the Visit Information

Look at the PV1 segment:

PV1|1|I|4N^402^1||||12345^SMITH^JOHN

Visit info

  • I = Inpatient
  • 4N / 402 / 1 = unit, room, bed
  • 12345^SMITH^JOHN = attending doctor

This tells us:

The patient is an inpatient.
The location is 4N, room 402, bed 1.
The attending doctor is John Smith.

Final Summary

  • This is an ADT^A01 admission message.
  • It was sent from REG at HOSPITAL to EHR at CLINIC.
  • The patient is Jane Doe, born on 1980-01-15.
  • The patient is an inpatient located at 4N, room 402, bed 1.
  • The attending doctor is John Smith.

07

Exercise: Decode a Sample HL7 v2 Message

Use the simulated HL7 v2 message below. You can paste this sample into an HL7 viewer and use an HL7 field definition reference to complete the blanks.

Suggested tools

Use these references to break the message into segments, fields, and components.

HL7 v2 message sample

MSHMSH|^~\&|FIC-REG|FIC-CLINIC|FIC-EMR|FIC-HOSP|20260619124500||ADT^A04|MSG002|P|2.5.1
EVNEVN|A04|20260619124400
PIDPID|1||MRN002^^^FIC-HOSP^MR||Jordan G||19850715|M|||22 Sample Road^^Fictiontown^ZZ^Z1Z 1Z1^ZZZ||(999)555-0202
PV1PV1|1|O|CLINIC1^ROOM5|||| Taylor H
AL1AL1|1|FA|ALG001^Peanut^L|MO|Rash

This is simulated educational data. Do not paste real patient information into public online tools.

Fill in the blanks

Date choices use MM/DD/YYYY. Time choices use HH:MM AM/PM. Phone choices use (XXX) XXX-XXXX. Long values such as address and assigned location are multiple choice to avoid format-only errors.

This is an HL7 v2 message. The message type is . It is an registration message.
The message was sent on at . The sending application is and the sending facility is . The receiving application is and the receiving facility is .
The message control ID is . The processing ID is , meaning . The event was recorded at .
The patient MRN is , assigned by . The patient's name is . The patient's birthday is .
The patient address is . The home phone number is .
The patient class is , meaning . The patient assigned location is . The attending doctor is .
The patient has a allergy. The allergen is , with severity and as the reaction.

08

Where to Learn More

This guide is only a starting point. To build deeper knowledge, use reliable references.

Course Textbook

A helpful textbook reference is Principles of Health Interoperability: FHIR, HL7 and SNOMED CT by Tim Benson and Grahame Grieve. (Chapter 7)

Chapter 7 provides context for understanding HL7 v2 within healthcare interoperability standards.

Caristix HL7 Definition

Caristix is an electronic dictionary for HL7 v2 message types, trigger events, segments, fields, data types, and tables.

Note: accessing Caristix HL7 Definition may require account registration.

Choose the HL7 version
-> Search the segment ID
-> Open the field list
-> Match the field number

Official HL7 Standard

The official HL7 standard is the most complete and authoritative reference.

Note: accessing some official HL7 materials may require account registration.

HL7 Viewer or Parser Tools

HL7 viewer tools can help you break a message into readable parts: segments, fields, components, repeated values, and blank fields.

Do not paste real patient information into public online tools.

Only use real patient data in tools approved by your organization.