Skip to content
Healthcare SoftwareEngineering

Standards comparison

HL7 vs FHIR: Comparing HL7 v2 and FHIR for Healthcare Integration

"HL7 vs FHIR" is a slightly misleading question: both come from HL7 International. The real comparison is between HL7 Version 2 messaging and FHIR, and most real systems use both.

11 min read Updated

Clearing up the naming

HL7 International is the standards organization. It publishes several families of standards, including HL7 Version 2 (v2) messaging, HL7 Version 3 and the Clinical Document Architecture (CDA), and Fast Healthcare Interoperability Resources (FHIR). When people say "HL7" in integration conversations, they almost always mean v2 messaging, which has run inside hospitals since the late 1980s and remains the backbone of internal clinical data flow.

FHIR is the newer standard, first published as a draft in 2014 and normatively stable in parts since R4 (2019). It is the basis of patient access APIs, EHR app ecosystems, and US regulatory API requirements. FHIR R4 is the version most US implementations use, with US Core profiles defining the expected content.

HL7 v2 vs FHIR at a glance

HL7 Version 2 compared with FHIR
DimensionHL7 v2FHIR
ParadigmEvent-driven messaging: a trigger event (admit, order, result) produces a messageResource-oriented: discrete resources accessed via RESTful APIs, plus messaging, documents, and subscriptions
FormatPipe-delimited text: segments (MSH, PID, PV1, OBR, OBX) separated by carriage returns, fields by |, components by ^JSON (most common), XML, and RDF representations of resources such as Patient, Encounter, Observation
TransportTypically MLLP over TCP inside the network; sometimes files or web servicesHTTPS with standard REST verbs: GET, POST, PUT, PATCH, DELETE
AcknowledgmentACK/NAK messages with MSA segmentHTTP status codes and OperationOutcome resources
SecurityNot defined by the standard; relies on network controls, VPNs, or TLS wrappersUses web security: TLS, OAuth 2.0, and SMART on FHIR scopes for authorization
Data access patternPush: the source sends as events occurPull (query), plus push through Subscriptions
ExtensibilityZ-segments and local conventions; high site-to-site varianceFormal extensions and profiles published in implementation guides
ToolingInterface engines, HL7 parsers, message validatorsGeneral web tooling, FHIR servers, validators, client SDKs
Typical useADT feeds, orders, results, scheduling between systems inside a health systemPatient and provider apps, EHR app launches, payer APIs, bulk population export
MaturityUbiquitous, deeply embedded in hospital infrastructureRapidly adopted; required for certified health IT APIs in the US

How HL7 v2 works in practice

A v2 message is a sequence of segments. The MSH header identifies sender, receiver, message type, and control ID. An ADT^A01 admit message carries PID for patient demographics and PV1 for visit details. An ORU^R01 results message carries OBR for the order and one or more OBX segments for observation values. The receiving system replies with an ACK, and senders typically wait for that acknowledgment before sending the next message.

MLLP wraps each message with a start byte (0x0B) and end bytes (0x1C 0x0D) over a persistent TCP connection. It is simple and fast, but it carries no encryption or authentication of its own, which is why v2 feeds usually live inside private networks or are wrapped in TLS or VPN tunnels.

The weakness of v2 is variability. The standard leaves many fields optional and allows local Z-segments, so every interface needs a specification and mapping work. Two hospitals on the same EHR can place the same concept in different fields.

How FHIR works in practice

FHIR models healthcare data as resources with defined elements and references between them. A client retrieves a patient with GET /Patient/{id} and searches observations with GET /Observation?patient={id}&category=laboratory. Responses are JSON or XML. Searches return Bundles with paging links.

Beyond REST, FHIR defines Bulk Data export ($export) for population-level extracts in NDJSON, Subscriptions for event notification, operations for complex actions, and document and messaging paradigms. SMART on FHIR adds OAuth 2.0-based authorization and an app launch framework so third-party apps can run inside EHRs with patient and user context.

Where CDA fits

The Clinical Document Architecture is an XML standard for clinical documents — whole, signed, human-readable records such as a discharge summary or continuity of care document. Consolidated CDA (C-CDA) defines US templates for common document types and remains widely used in health information exchange and national networks for transitions of care.

CDA answers a different question than either v2 or FHIR REST: "give me the document that describes this encounter" rather than "tell me when something happens" or "let me query this specific data element". FHIR has its own document paradigm, and HL7 publishes guidance for mapping C-CDA to FHIR, but C-CDA documents will remain in circulation for years.

When to use each

Choose HL7 v2 when

  • You need real-time event feeds from hospital systems, such as ADT, orders, and results.
  • The counterparty system only offers v2 interfaces, which remains common for labs, radiology, and older departmental systems.
  • You are integrating inside a hospital network through an existing interface engine.
  • Throughput is high and payloads are small, such as device or result feeds.

Choose FHIR when

  • You are building patient-facing or clinician-facing apps that query data on demand.
  • You need to launch inside an EHR using SMART on FHIR.
  • You are exposing data to external partners over the internet with OAuth-based authorization.
  • You need population-level exports for analytics or quality programs via Bulk Data.
  • Regulatory requirements call for standardized API access.

Choose C-CDA when

  • Exchanging transition-of-care documents through health information exchanges or national networks.
  • A receiving organization expects complete, human-readable clinical documents.

Coexistence through interface engines

Most production architectures run v2 and FHIR side by side. An interface engine such as Mirth Connect, Rhapsody, Cloverleaf, or a cloud integration service receives v2 messages over MLLP, transforms them into FHIR resources, and writes them to a FHIR server or publishes them as events. The reverse also happens: a FHIR-based app creates an order that the engine translates into an ORM or OMG message for a legacy system.

HL7 publishes a v2-to-FHIR implementation guide with mapping recommendations, which is a useful starting point. Real mappings still need site-specific decisions: which PID identifier becomes the primary Patient.identifier, how to handle A40 merges in a resource model, and how to represent a corrected OBX result as an updated Observation with status amended or corrected.

Checklist

  • Keep transformation logic in one versioned layer with sample-message tests.
  • Map v2 identifiers to FHIR identifiers with explicit system URIs.
  • Translate v2 merges and corrections into FHIR resource updates, not duplicates.
  • Preserve the original v2 message for traceability and replay.
  • Validate generated resources against US Core or relevant profiles.

Should you migrate from v2 to FHIR?

Rarely all at once. v2 feeds are reliable, well understood by hospital IT staff, and deeply embedded. Ripping them out for FHIR offers little value if the use case is a push of events between two internal systems. The better strategy is additive: keep v2 where it works, add FHIR where on-demand query, external access, app integration, or regulatory APIs demand it, and use the interface engine as the bridge.

FHIR Subscriptions may gradually take over some event-notification roles, especially for new external consumers, but expect v2 to remain part of hospital integration for the foreseeable future.

References

This guide is educational and is not legal or regulatory advice.

Frequently asked questions

What is the difference between HL7 and FHIR?

HL7 International publishes both. In everyday usage, HL7 means HL7 Version 2: pipe-delimited, event-driven messages usually sent over MLLP inside hospital networks. FHIR is a newer standard that exposes healthcare data as resources through RESTful APIs, typically in JSON over HTTPS, secured with OAuth 2.0 and SMART on FHIR.

Is FHIR replacing HL7 v2?

Not in the near term. FHIR is the standard for APIs, apps, and regulatory data access, but v2 remains embedded in hospital infrastructure for ADT, orders, and results. Most organizations run both, with interface engines translating between them. Expect gradual, use-case-driven adoption of FHIR rather than a wholesale replacement of v2 feeds.

Which is more secure, HL7 v2 or FHIR?

FHIR defines how to use standard web security, including TLS, OAuth 2.0, and SMART scopes. HL7 v2 does not define security; MLLP carries no encryption or authentication, so v2 relies on network controls, VPNs, or TLS wrapping. Either can be deployed securely or insecurely; the implementation determines the actual protection.

Where does CDA fit compared with HL7 v2 and FHIR?

CDA is an XML standard for complete clinical documents, such as discharge summaries and continuity of care documents. Consolidated CDA templates remain common for transitions of care and health information exchange. It complements v2 event messaging and FHIR APIs, and HL7 publishes guidance on mapping C-CDA content into FHIR resources.

Discuss your healthcare engineering project

Tell us about the system, the integrations it depends on, and the constraints you are working within. A senior engineer will review it and reply with questions, not a sales script.