Every HL7 sample message below is a complete, annotated example you can use as a starting point for development and testing. Each sample HL7 message uses realistic clinical data with segment-by-segment explanations. Click any segment to explore its fields. Copy these into HL7 Workbench to parse and validate interactively.
An inpatient admission to the ICU:
PID Patient Identification PID|1||MRN12345^^^MAIN_HOSP^MR||DOE^JOHN^ALEXANDER||19800115|M||2106-3^White^HL70005|123 MAIN ST^^ANYTOWN^OH^44101^USA||^PRN^PH^^^^^555-867-5309||ENG^English^HL70296|S^Single^HL70002||ACCT98765^^^MAIN_HOSP^AN Field Name Value Note PID-3 Patient Identifier List MRN12345^^^MAIN_HOSP^MR Medical Record Number — primary matching key PID-5 Patient Name DOE^JOHN^ALEXANDER Family^Given^Middle PID-7 Date of Birth 19800115 YYYYMMDD format PID-8 Administrative Sex M PID-11 Patient Address 123 MAIN ST^^ANYTOWN^OH^44101^USA PID-13 Phone (Home) 555-867-5309 PID-18 Patient Account Number ACCT98765^^^MAIN_HOSP^AN Visit/encounter account
PV1 Patient Visit PV1|1|I|ICU^0101^01^MAIN_HOSP^^^^NURS|E^Emergency^HL70007|||ATT1234^SMITH^JANE^^^MD|REF5678^JONES^BOB^^^MD||MED^Medical^HL70069||||7|||ATT1234^SMITH^JANE^^^MD|IP^Inpatient^HL70004||||||||||||||||||MAIN_HOSP||A|||202603011415 Field Name Value Note PV1-2 Patient Class I I=Inpatient, O=Outpatient, E=Emergency PV1-3 Assigned Patient Location ICU^0101^01^MAIN_HOSP Unit^Room^Bed^Facility PV1-4 Admission Type E^Emergency HL7 Table 0007 PV1-7 Attending Doctor ATT1234^SMITH^JANE^^^MD PV1-8 Referring Doctor REF5678^JONES^BOB^^^MD
NK1 Next of Kin NK1|1|DOE^JANE^M|SPO^Spouse^HL70063|123 MAIN ST^^ANYTOWN^OH^44101|^PRN^PH^^^^^555-867-5310 Field Name Value Note NK1-2 Name DOE^JANE^M NK1-3 Relationship SPO^Spouse HL7 Table 0063 NK1-4 Address 123 MAIN ST^^ANYTOWN^OH^44101
IN1 Insurance IN1|1|BCBS001^BLUE CROSS BLUE SHIELD|BCBS|PO BOX 12345^^COLUMBUS^OH^43216|^WPN^PH^^^^^555-444-3333||GRP54321|||||||20230101|20261231||SELF^Self^HL70063|DOE^JOHN^ALEXANDER|SELF|19800115 Field Name Value Note IN1-2 Insurance Plan ID BCBS001^BLUE CROSS BLUE SHIELD IN1-3 Insurance Company ID BCBS IN1-12 Plan Effective Date 20230101 IN1-13 Plan Expiration Date 20261231 IN1-15 Plan Type SELF^Self Relationship to insured
AL1 Patient Allergy AL1|1|DA^Drug Allergy^HL70127|PCN^Penicillin^HL70127|SV^Severe^HL70128|Anaphylaxis Field Name Value Note AL1-2 Allergen Type DA^Drug Allergy DA=Drug, FA=Food, EA=Environmental AL1-3 Allergen Code PCN^Penicillin AL1-4 Allergy Severity SV^Severe AL1-5 Allergy Reaction Anaphylaxis
Key segments : MSH (header) → EVN (event) → PID (patient) → PV1 (visit) → NK1 (next of kin) → IN1 (insurance) → AL1 (allergy). See our ADT message reference for event type details.
A Comprehensive Metabolic Panel result:
PID Patient Identification PID|1||MRN12345^^^MAIN_HOSP^MR||DOE^JOHN^ALEXANDER||19800115|M
PV1 Patient Visit PV1|1|I|ICU^0101^01^MAIN_HOSP
ORC Common Order ORC|RE|ORD5678^EPIC|FIL9012^LAB_SYS||CM Field Name Value Note ORC-1 Order Control RE RE=Observations/Performed (results) ORC-2 Placer Order Number ORD5678^EPIC Ordering system reference ORC-3 Filler Order Number FIL9012^LAB_SYS Lab system reference ORC-5 Order Status CM CM=Completed
OBR Observation Request OBR|1|ORD5678^EPIC|FIL9012^LAB_SYS|24323-8^CMP^LN|||202603011445|||||||ATT1234^SMITH^JANE^^^MD||||||202603011615||LAB|F Field Name Value Note OBR-4 Universal Service ID 24323-8^CMP^LN LOINC code for Comprehensive Metabolic Panel OBR-7 Observation Date/Time 202603011445 When specimen was collected OBR-22 Results Report Date 202603011615 OBR-25 Result Status F F=Final result
OBX Observation Result OBX|1|NM|2345-7^Glucose^LN||98|mg/dL|70-100|N|||F Field Name Value Note OBX-2 Value Type NM NM=Numeric OBX-3 Observation ID 2345-7^Glucose^LN LOINC code OBX-5 Observation Value 98 OBX-6 Units mg/dL OBX-7 Reference Range 70-100 OBX-8 Abnormal Flags N N=Normal, H=High, L=Low, A=Abnormal OBX-11 Observation Result Status F F=Final
OBX Creatinine Result OBX|2|NM|2160-0^Creatinine^LN||1.1|mg/dL|0.6-1.2|N|||F
OBX BUN Result OBX|3|NM|3094-0^BUN^LN||18|mg/dL|7-20|N|||F
OBX Sodium Result OBX|4|NM|2951-2^Sodium^LN||140|mEq/L|136-145|N|||F
OBX Potassium Result OBX|5|NM|2823-3^Potassium^LN||4.2|mEq/L|3.5-5.0|N|||F
OBX Calcium Result OBX|6|NM|17861-6^Calcium^LN||9.4|mg/dL|8.5-10.5|N|||F
OBX ALT Result OBX|7|NM|1742-6^ALT^LN||28|U/L|7-56|N|||F
Key segments : ORC (order common) → OBR (observation request) → OBX (individual results, repeating). All results are final (F) and normal (N). See our ORU message reference for result status codes.
A STAT Complete Blood Count order:
PID Patient Identification PID|1||MRN12345^^^MAIN_HOSP^MR||DOE^JOHN^ALEXANDER||19800115|M
PV1 Patient Visit PV1|1|I|ICU^0101^01^MAIN_HOSP||||ATT1234^SMITH^JANE^^^MD
ORC Common Order ORC|NW|ORD5678^EPIC||GRP001^EPIC|||||202603011400|||ATT1234^SMITH^JANE^^^MD Field Name Value Note ORC-1 Order Control NW NW=New Order ORC-2 Placer Order Number ORD5678^EPIC ORC-9 Date/Time of Transaction 202603011400 ORC-12 Ordering Provider ATT1234^SMITH^JANE^^^MD
OBR Observation Request OBR|1|ORD5678^EPIC||58410-2^CBC with Diff^LN|||202603011400|||||||||ATT1234^SMITH^JANE^^^MD|||||||||||^STAT Field Name Value Note OBR-4 Universal Service ID 58410-2^CBC with Diff^LN LOINC code for CBC with Differential OBR-7 Observation Date/Time 202603011400 OBR-27 Priority STAT Urgent/immediate processing
DG1 Diagnosis DG1|1||R50.9^Fever, unspecified^I10 Field Name Value Note DG1-3 Diagnosis Code R50.9^Fever, unspecified^I10 ICD-10-CM code
NTE Notes and Comments NTE|1||Patient febrile x 24hrs, rule out infection. Field Name Value Note NTE-3 Comment Patient febrile x 24hrs, rule out infection. Free-text clinical note for the lab
Key segments : ORC (new order NW) → OBR (CBC, STAT priority) → DG1 (diagnosis) → NTE (clinical note). See our ORM message reference for order lifecycle details.
A routine office visit appointment:
SCH Scheduling Activity SCH|APT78901^SCHED_SYS|APT78901^EPIC|||||ROUTINE^Routine^HL70277|OFFICE^Office Visit^LOCAL|30|MIN|^^30^202603101400^202603101430|||||ATT1234^SMITH^JANE^^^MD|^WPN^PH^^^^^555-222-3333|MAIN_CLINIC^MAIN_HOSP||Booked Field Name Value Note SCH-1 Placer Appointment ID APT78901^SCHED_SYS SCH-2 Filler Appointment ID APT78901^EPIC SCH-8 Appointment Reason ROUTINE^Routine HL7 Table 0277 SCH-9 Appointment Type OFFICE^Office Visit SCH-11 Appointment Timing ^^30^202603101400^202603101430 Duration 30min, start/end times SCH-25 Filler Status Code Booked
PID Patient Identification PID|1||MRN12345^^^MAIN_HOSP^MR||DOE^JOHN^ALEXANDER||19800115|M
PV1 Patient Visit PV1|1|O|MAIN_CLINIC^EXAM3^01^MAIN_HOSP||||ATT1234^SMITH^JANE^^^MD
RGS Resource Group RGS|1|A Field Name Value Note RGS-2 Segment Action Code A A=Add
AIS Appointment Information — Service AIS|1|A|OFFICE_VISIT^Office Visit^LOCAL|||202603101400|0|MIN|30|MIN Field Name Value Note AIS-3 Universal Service ID OFFICE_VISIT^Office Visit AIS-7 Start Date/Time Offset 202603101400 AIS-10 Duration 30 MIN
AIP Appointment Information — Personnel AIP|1|A|ATT1234^SMITH^JANE^^^MD|ATT^Attending^HL70443 Field Name Value Note AIP-3 Personnel Resource ID ATT1234^SMITH^JANE^^^MD AIP-4 Resource Type ATT^Attending
AIL Appointment Information — Location AIL|1|A|MAIN_CLINIC^EXAM3^01^MAIN_HOSP||202603101400|0|MIN|30|MIN Field Name Value Note AIL-3 Location Resource ID MAIN_CLINIC^EXAM3^01^MAIN_HOSP Clinic^Room^Bed^Facility
Key segments : SCH (scheduling activity) → RGS/AIS/AIP/AIL (resource group with service, personnel, and location). See our SIU message reference for event types.
A transcribed operative note:
PID Patient Identification PID|1||MRN12345^^^MAIN_HOSP^MR||DOE^JOHN^ALEXANDER||19800115|M
PV1 Patient Visit PV1|1|I|SURG^OR3^01^MAIN_HOSP||||SUR5678^WILLIAMS^MARK^^^MD
TXA Transcription Document Header TXA|1|OP^Operative Note^HL70270|TX^Text^HL70191||202603011600|||||SUR5678^WILLIAMS^MARK^^^MD||||DOC54321||AU^Authenticated^HL70271||202603021000 Field Name Value Note TXA-2 Document Type OP^Operative Note HL7 Table 0270 TXA-3 Document Content Presentation TX^Text TX=Text, FT=Formatted Text TXA-5 Activity Date/Time 202603011600 When the procedure occurred TXA-10 Assigned Document Author SUR5678^WILLIAMS^MARK^^^MD TXA-17 Document Completion Status AU^Authenticated Physician has signed the document
OBX Document Content OBX|1|TX|OP_NOTE^Operative Note^LOCAL||Procedure: Laparoscopic cholecystectomy\.br\Patient tolerated procedure well\.br\No complications\.br\EBL: 50mL\.br\Specimens sent to pathology.||||||F Field Name Value Note OBX-2 Value Type TX TX=Text data OBX-3 Observation ID OP_NOTE^Operative Note OBX-5 Observation Value Procedure: Laparoscopic cholecystectomy... \.br\ = line break escape sequences OBX-11 Observation Result Status F F=Final
Key segments : TXA (transcription information — document type, author, authentication status) → OBX (document content as formatted text). MDM^T02 signals an original document; T04 signals an addendum, T08 an update, and T11 a cancellation. See our MDM message reference for complete event type details.
The MSH-2 field (^~\&) defines the delimiter characters used throughout the message:
Character Name Purpose ^Component separator Separates components within a field ~Repetition separator Separates repeated values in a field \Escape character Escapes special characters in text &Sub-component separator Separates sub-components
Sequence Meaning \.br\Line break \F\Field separator (literal |) \S\Component separator (literal ^) \T\Sub-component separator (literal &) \R\Repetition separator (literal ~) \E\Escape character (literal \)
HL7 Workbench Paste any HL7 message to parse segments, look up fields, and validate structure.