Skip to content
Contact Us

HL7 v2 Data Types Reference

HL7 data types define how values are structured within segment fields. A single field like PID-3 (Patient Identifier List) contains multiple components — ID number, assigning authority, identifier type — packed into one composite data type (CX). Understanding these data types is essential for parsing and building HL7 messages.

CX — Extended Composite ID with Check Digit

Section titled “CX — Extended Composite ID with Check Digit”

Used for patient identifiers, account numbers, and visit numbers.

Found in: PID-3, PID-18, PV1-19, IN1-3

MRN12345^^^MAIN_HOSP^MR
ComponentNameExamplePurpose
CX.1ID NumberMRN12345The actual identifier value
CX.2Check Digit(empty)Optional validation digit
CX.3Check Digit Scheme(empty)M10, M11, etc.
CX.4Assigning AuthorityMAIN_HOSPOrganization that issued the ID
CX.5Identifier TypeMRType code: MR, AN, VN, SS, PI

Common CX.5 type codes:

CodeTypeDescription
MRMedical Record NumberPrimary patient identifier
ANAccount NumberBilling/financial account
VNVisit NumberEncounter identifier
SSSocial Security NumberSSN (use cautiously — HIPAA sensitivity)
PIPatient InternalInternal system identifier
PTPatient ExternalExternal/cross-system identifier
DLDriver’s LicenseState-issued ID
NPINational Provider IDProvider NPI number

Used for order numbers, document IDs, and equipment identifiers.

Found in: ORC-2, ORC-3, OBR-2, OBR-3, TXA-12

ORD5678^EPIC
ComponentNameExamplePurpose
EI.1Entity IdentifierORD5678The identifier value
EI.2Namespace IDEPICAssigning application
EI.3Universal ID(empty)OID or UUID (optional)
EI.4Universal ID Type(empty)ISO, UUID, DNS (optional)

Used for patient, contact, and guarantor names.

Found in: PID-5, NK1-2, GT1-3, IN1-16

DOE^JOHN^ALEXANDER^^JR^MD
ComponentNameExamplePurpose
XPN.1Family NameDOELast name
XPN.2Given NameJOHNFirst name
XPN.3Second NameALEXANDERMiddle name
XPN.4Suffix(empty)Jr., Sr., III
XPN.5PrefixJRTitle prefix
XPN.6DegreeMDAcademic/professional degree
XPN.7Name TypeLL (Legal), D (Display), M (Maiden), A (Alias)

XCN — Extended Composite ID Number and Name

Section titled “XCN — Extended Composite ID Number and Name”

Used for provider identification — combines an ID with a name.

Found in: PV1-7, PV1-8, ORC-12, OBR-16, EVN-5

ATT1234^SMITH^JANE^^^MD
ComponentNameExamplePurpose
XCN.1Person IdentifierATT1234Provider ID (NPI or local)
XCN.2Family NameSMITHLast name
XCN.3Given NameJANEFirst name
XCN.4Second Name(empty)Middle name
XCN.5Suffix(empty)Jr., Sr.
XCN.6Prefix/DegreeMDCredential
XCN.9Assigning Authority(empty)Organization that assigned the ID
XCN.13Identifier Type Code(empty)NPI, UPIN, local

Used for patient, contact, and facility addresses.

Found in: PID-11, NK1-4, IN1-5, IN1-19

123 MAIN ST^^ANYTOWN^OH^44101^USA
ComponentNameExamplePurpose
XAD.1Street Address123 MAIN STStreet line 1
XAD.2Other Designation(empty)Apt, Suite, Floor
XAD.3CityANYTOWNCity name
XAD.4StateOHState/province
XAD.5Zip Code44101Postal code
XAD.6CountryUSAISO 3166 country code
XAD.7Address TypeHH (Home), B (Business), M (Mailing)

Used for phone numbers, fax, email, and other contact methods.

Found in: PID-13, PID-14, NK1-5, NK1-6

^PRN^PH^^^^^555-867-5309
ComponentNameExamplePurpose
XTN.1Telephone Number(deprecated)Legacy format — use XTN.12
XTN.2Use CodePRNPRN (Primary Residence), WPN (Work), EMR (Emergency)
XTN.3Equipment TypePHPH (Phone), FX (Fax), CP (Cell), Internet (Email)
XTN.4Communication Address(empty)Email address (when XTN.3 = Internet)
XTN.7Local Number555-867-5309Phone number (or XTN.12 in newer versions)
XTN.12Unformatted Number5558675309Full number without formatting

The most widely used coded data type in HL7 v2. Carries a code, description, and coding system identifier.

Found in: PID-10, OBR-4, OBX-3, DG1-3, AL1-3

R50.9^Fever, unspecified^I10
ComponentNameExamplePurpose
CE.1IdentifierR50.9Code value
CE.2TextFever, unspecifiedHuman-readable description
CE.3Coding SystemI10Which coding system (ICD-10, LOINC, SNOMED, etc.)
CE.4Alternate Identifier(empty)Alternate code
CE.5Alternate Text(empty)Alternate description
CE.6Alternate Coding System(empty)Alternate coding system

Introduced in v2.5 as a replacement for CE. Identical structure but supports “text only” entries when no code is available.

Found in: OBX-3 (v2.5+), ORC-16, many v2.5+ fields

The key difference: CWE allows CE.1 to be empty when CE.2 contains free text — useful when a coded value doesn’t exist in the coding system.

TypeSourceDescription
ISUser-defined tableFacility-specific codes (e.g., PV1-2 patient class values)
IDHL7-defined tableStandard HL7 codes (e.g., MSH-11 processing ID: P, T, D)

IS values vary between implementations; ID values are standardized across all HL7 systems.

The standard date/time format in HL7 v2.

Found in: MSH-7, PID-7, EVN-2, OBR-7, OBR-22

20260301143000-0500
PrecisionFormatExampleMeaning
YearYYYY2026Year only
MonthYYYYMM202603March 2026
DayYYYYMMDD20260301March 1, 2026
HourYYYYMMDDHH20260301142:00 PM
MinuteYYYYMMDDHHMI2026030114302:30 PM
SecondYYYYMMDDHHMMSS202603011430002:30:00 PM
Timezone+/-HHMM suffix-0500EST (UTC-5)

Common pitfall: Some systems send timestamps without timezone offsets. Receiving systems should default to the sending facility’s timezone when no offset is present.

A pair of TS values representing a range.

Found in: FT1-4, IN1-12/13 (as separate DT fields)

20260301140000^20260301150000

Component 1 is the range start; component 2 is the range end.

Structures the patient’s physical location in a facility.

Found in: PV1-3, PV1-6, PV1-11, PV1-42

ICU^0101^01^MAIN_HOSP^^^^NURS
ComponentNameExamplePurpose
PL.1Point of CareICUUnit/department/ward
PL.2Room0101Room number
PL.3Bed01Bed number
PL.4FacilityMAIN_HOSPFacility identifier
PL.5Location Status(empty)Active, inactive
PL.6Person Location Type(empty)C (Clinic), D (Department), N (Nursing)
PL.7Building(empty)Building code
PL.8FloorNURSFloor/nursing station

Identifies an application, facility, or other entity in a hierarchy.

Found in: MSH-3, MSH-4, MSH-5, MSH-6

EPIC^1.2.3.4.5^ISO
ComponentNameExamplePurpose
HD.1Namespace IDEPICApplication/facility name
HD.2Universal ID1.2.3.4.5OID for the application
HD.3Universal ID TypeISOOID type (ISO, UUID, DNS)
TypeNameDescriptionExample
STStringFree text, no formattingPatient reported nausea
NMNumericNumeric value98
SISequence IDInteger sequence number1, 2, 3
FTFormatted TextText with HL7 escape sequencesLine 1\.br\Line 2
TXText DataLong free textClinical note content
TQTiming/QuantitySchedule timing (deprecated in v2.5+ — use TQ1)^^30^202603011400^202603011430
CPComposite PriceAmount with currency350.00^USD

HL7 v2 uses three levels of separation within fields:

LevelCharacterPurposeExample
Field| (pipe)Separates segment fieldsPID|1|...|DOE^JOHN
Component^ (caret)Separates components within a fieldDOE^JOHN^ALEXANDER
Sub-component& (ampersand)Separates sub-components within a componentMAIN_HOSP&1.2.3&ISO
Repetition~ (tilde)Separates repeated valuesMRN12345~SSN98765

These characters are defined in MSH-2 and should be read dynamically, not hardcoded.

HL7 v2 distinguishes between empty fields and explicitly null fields:

RepresentationMeaningAction
||Empty/not valuedDo not update the stored value
|""|Explicitly nullClear/delete the stored value

This distinction is critical for ADT^A08 (Update Patient) messages — an empty field means “no change” while "" means “remove the previous value.”

Many data types were expanded or replaced across HL7 versions:

v2.3v2.5+Change
CECWEAdded “exceptions” support
TQTQ1 segmentMoved from field to segment
XTN.1XTN.12Phone number field relocated
CMVariousGeneric CM replaced with specific types

When integrating systems on different HL7 versions, the integration engine should map between data type versions as part of message transformation.