Difference Between HL7 and FHIR: A Developer Guide
Founder & CEO
15+ years building healthcare technology. Founder & CEO of Nirmitee.io, whose teams deliver EHR integrations, FHIR and HL7 platforms, ABDM and NHCX connectivity, and clinical AI for health systems and healthtech companies.

Part of our healthcare interoperability guides.
Watch: FHIR DSTU2 vs STU3 vs R4 vs R5 vs R6: What Changed, Which to Use, and 5 Myths (Live Test) (5:11).
What is the difference between HL7 and FHIR?
The difference between HL7 and FHIR is that HL7 v2 sends pipe-delimited event messages between systems inside a hospital, while FHIR exposes clinical data as small, reusable resources (Patient, Observation) that apps read and write over REST APIs in JSON or XML. Both come from the same standards body, HL7 International, so FHIR is the newest HL7 standard rather than a rival to it.
HL7 International describes FHIR as a next generation standards framework that combines the best features of its earlier product lines, HL7 v2, HL7 v3 and CDA, with current web standards such as HTTP, JSON, XML and OAuth. In practice most U.S. hospitals run both: HL7 v2 for existing internal feeds, and FHIR for app access, patient access and payer APIs.
If you're building healthcare software, you'll encounter at least four interoperability standards (FHIR, HL7 v2, X12 and DICOM), and each one exists because it solves a different problem. This guide explains what each standard does, when to use which, how they interact, and what a developer actually needs to implement each one. This is a technical guide for developers and architects, not a regulatory compliance guide.
For each standard, we cover what it does, when to use it, a sample message, and which systems rely on it.
HL7 v2 vs FHIR in one table
| HL7 v2 | FHIR R4 | |
|---|---|---|
| Data model | Pipe-delimited segments (MSH, PID, OBX) | Resources (Patient, Observation) in JSON or XML |
| Transport | MLLP over TCP inside the hospital network | HTTPS REST APIs |
| Trigger | Event push (admit, order, result) | Request and response, plus subscriptions |
| Typical use | Internal hospital feeds between EHR, lab and radiology | App access, patient access and payer APIs |
| Regulation | No federal mandate for internal feeds | ONC requires certified FHIR R4 APIs; CMS requires payer FHIR APIs |
| Security | Network controls and VPNs | OAuth 2.0 with SMART on FHIR |
Most organizations run both: HL7 v2 for existing internal feeds and FHIR for new APIs. Our HL7 integration services and FHIR integration services cover each side.
FHIR vs HL7: What the FHIR Interoperability Standard Adds
In the FHIR vs HL7 choice, use FHIR when an app, patient or payer needs data on request over a web API, and keep HL7 v2 when a working feed pushes events between systems inside the hospital. FHIR adds three things that v2 feeds do not give you on their own.
- A published data profile: implementation guides such as US Core define how US systems should represent common data, so developers can build against one published profile.
- Federal backing: ONC's API standards at 45 CFR 170.215 name FHIR Release 4.0.1, and CMS-0057-F requires FHIR-based APIs from impacted payers, primarily by January 1, 2027.
- A route from v2: HL7 publishes a V2-to-FHIR implementation guide that maps v2 messages to FHIR resources, so you can add FHIR without retiring a working feed.
HL7 Version 2 (HL7v2): The Workhorse
HL7v2 was first released in 1987 and still carries most internal feeds between EHR, lab, radiology and pharmacy systems in the hospitals we work with. New applications use FHIR, while existing v2 interfaces keep running because replacing a working feed rarely pays for itself.
What It Does
HL7v2 handles event-driven messaging between clinical systems. When a patient is admitted, a lab result is finalized, or a medication is ordered, an HL7v2 message is generated and sent to downstream systems. In FHIR, the lab results carried by ORU messages arrive as Observation resources; see our FHIR Observation resource guide for vitals, labs and LOINC coding.
Key Message Types
| Message Type | Trigger | Content | Common Use |
|---|---|---|---|
| ADT (Admit/Discharge/Transfer) | A01, A02, A03, A04, A08 | Patient demographics, visit info, bed assignment | Patient registration, census management |
| ORM (Order Message) | O01 | Lab/radiology orders, order details | Order entry to ancillary systems |
| ORU (Observation Result) | R01 | Lab results, vital signs, pathology reports | Result delivery to EHR |
| RDE (Pharmacy Order) | O11 | Medication orders, dosage, route | E-prescribing within hospital |
| MDM (Document Management) | T02 | Clinical document notifications | Transcription, document routing |
| SIU (Scheduling) | S12, S14, S15 | Appointment creation/modification | Scheduling system integration |
Sample HL7v2 ADT Message
MSH|^~\&|ADT|HOSPITAL|INTEGRATION|ENGINE|20260317103000||ADT^A01|MSG00001|P|2.5.1
EVN|A01|20260317103000
PID|1||MRN12345^^^HOSPITAL^MR||DOE^JOHN^A||19800315|M|||123 MAIN ST^^ANYTOWN^CA^90210||555-555-1234
PV1|1|I|ICU^101^A|E|||1234^SMITH^JANE^M^MD|||MED||||1|||1234^SMITH^JANE^M^MD|IP||||||||||||||||||HOSPITAL|||20260317103000
NK1|1|DOE^MARY|SPOUSE|555-555-5678
IN1|1|1|BCBS123|BLUE CROSS|PO BOX 1234^^CHICAGO^IL^60601||555-555-9999|GROUP001FHIR R4 and R5: The Modern Standard
FHIR (Fast Healthcare Interoperability Resources) is the modern standard for healthcare data exchange. FHIR R4 (v4.0.1) is published as a mixed standard: its core parts, such as the base resources Patient and Observation, are normative, while other parts remain Trial Use. ONC requires certified health IT in the U.S. to offer FHIR R4 APIs.
What It Does
FHIR provides a RESTful API framework for accessing and exchanging healthcare data. Unlike HL7v2's message-based approach, FHIR treats clinical data as resources that can be created, read, updated, and searched through standard HTTP methods. Search results come back wrapped in a searchset Bundle, and multi-resource writes use transaction or batch Bundles, all covered in our FHIR Bundle resource guide.
Key FHIR Resources
| Resource | Description | HL7v2 Equivalent | Common Operations |
|---|---|---|---|
| Patient | Demographics, identifiers, contacts | PID segment | GET, POST, PUT, SEARCH |
| Encounter | Visit/admission details | PV1 segment | GET, SEARCH, _include |
| Observation | Lab results, vital signs, assessments | OBX segment | GET, SEARCH by category/code |
| Condition | Diagnoses, problem list | DG1 segment | GET, POST, SEARCH |
| MedicationRequest | Prescriptions, medication orders | RXE segment | GET, POST, SEARCH |
| DiagnosticReport | Lab/radiology report packages | ORC/OBR segments | GET, SEARCH, _include Observation |
| DocumentReference | Clinical documents (CDA, PDF) | MDM messages | GET, POST, SEARCH |
| AllergyIntolerance | Patient allergies | AL1 segment | GET, POST, SEARCH |
Sample FHIR Patient Resource
{
"resourceType": "Patient",
"id": "patient-john-doe",
"identifier": [{
"system": "http://hospital.example.org/mrn",
"value": "MRN12345"
}],
"name": [{
"family": "Doe",
"given": ["John", "A"]
}],
"gender": "male",
"birthDate": "1980-03-15",
"address": [{
"line": ["123 Main St"],
"city": "Anytown",
"state": "CA",
"postalCode": "90210"
}],
"telecom": [{
"system": "phone",
"value": "555-555-1234",
"use": "home"
}]
}FHIR R4 vs R5
| Feature | FHIR R4 | FHIR R5 |
|---|---|---|
| Status | Mixed: normative core, rest Trial Use (in production) | Standard for Trial Use |
| Adoption | Required for certified EHR APIs under ONC rules | Early adopters only |
| Subscriptions | Criteria-based push (rest-hook, websocket, email); topic-based available in R4 through the Subscriptions R5 Backport guide | Topic-based (WebSocket/webhook) |
| New resources | , | SubscriptionTopic, NutritionIntake, Permission |
| Recommendation | Use for all production apps | Wait for broader adoption |
X12 EDI: Claims and Administrative Transactions
X12 EDI (Electronic Data Interchange) is the mandated standard for healthcare administrative transactions in the U.S. under HIPAA. HIPAA names X12 transactions as the standards for covered electronic transactions such as claims, eligibility checks and remittance. Paper claims and some non-covered payers still exist, and CMS-0057-F adds FHIR APIs for prior authorization. For a side-by-side view, see X12 vs HL7.
Key Transaction Sets
| Transaction | Code | Direction | Use Case |
|---|---|---|---|
| Professional Claim | 837P | Provider -> Payer | Physician office visit claims |
| Institutional Claim | 837I | Provider -> Payer | Hospital inpatient/outpatient claims |
| Eligibility Inquiry | 270 | Provider -> Payer | Check patient insurance eligibility |
| Eligibility Response | 271 | Payer -> Provider | Return eligibility and benefit details |
| Claim Status Inquiry | 276 | Provider -> Payer | Check claim processing status |
| Claim Status Response | 277 | Payer -> Provider | Return claim status |
| Payment/Remittance | 835 | Payer -> Provider | Electronic payment advice |
| Prior Authorization | 278 | Provider -> Payer | Request service authorization |
NCPDP SCRIPT: Prescription Messaging
NCPDP SCRIPT is the standard for electronic prescribing between prescribers, pharmacies, and pharmacy benefit managers. CMS requires it for Medicare Part D electronic prescribing.
Key Message Types
- NewRx, New prescription from prescriber to pharmacy
- RxRenewalRequest, Pharmacy requests refill authorization
- CancelRx, Prescriber cancels a prescription
- RxChangeRequest, Pharmacy requests a formulary alternative
- RxFill, Pharmacy notifies prescriber that prescription was dispensed
- PDMP Request/Response, Query the Prescription Drug Monitoring Program for controlled substance history
DICOM: Medical Imaging
DICOM (Digital Imaging and Communications in Medicine) is the universal standard for medical imaging. CT, MRI, X-ray, ultrasound and PET images are stored and moved between modalities and PACS as DICOM objects.
DICOM Architecture
- DICOM objects, Images with embedded metadata (patient info, study details, series information, acquisition parameters)
- PACS (Picture Archiving and Communication System), Stores and serves DICOM images
- DICOM services, C-STORE (send image), C-FIND (search), C-MOVE (retrieve), C-GET (fetch), WADO-RS (web access)
- DICOMweb, RESTful API for DICOM operations, increasingly used alongside FHIR ImagingStudy resources
IHE Profiles: Integration Blueprints
IHE (Integrating the Healthcare Enterprise) does not create new standards. Instead, it defines integration profiles, blueprints that specify how to use existing standards (HL7v2, FHIR, DICOM) together to solve specific healthcare integration problems. Patient-centric profiles such as PDQm sit on the FHIR Patient resource, so it helps to understand FHIR Patient identifiers and patient search before implementing them.
Key IHE Profiles
| Profile | Standards Used | Problem Solved |
|---|---|---|
| PIX/PDQ (Patient Identity) | HL7v2 or FHIR | Patient identity matching across systems |
| XDS.b (Cross-Enterprise Document Sharing) | HL7v2, CDA, SOAP | Document sharing across organizations |
| MHD (Mobile Access to Health Documents) | FHIR | Lightweight document sharing for mobile apps |
| PDQm (Patient Demographics Query for Mobile) | FHIR | Patient search from mobile applications |
| IUA (Internet User Authorization) | OAuth 2.0, SMART on FHIR | Secure authorization for health IT |
Direct Protocol: Secure Health Information Exchange
Direct is a secure email-like protocol for point-to-point health information exchange. It uses S/MIME encryption over SMTP to send clinical documents (typically CDA or PDF) between healthcare organizations.
For a deeper look at clinical documents, read our guide to C-CDA (Consolidated Clinical Document Architecture).
- Use case, Referral letters, discharge summaries, transition of care documents sent between providers who are not on the same EHR
- Addressing, Direct addresses look like email (provider@direct.hospital.org) but route through Health Information Service Providers (HISPs)
- Trust model, Trust anchors and certificate chains ensure both sender and receiver are verified healthcare entities
- Status: Direct remains in wide use for transitions of care, and certified health IT still includes Direct-based criteria. CMS renamed the Meaningful Use program Promoting Interoperability in 2018.
Which Standard to Use: A Decision Framework
| Scenario | Recommended Standard | Why |
|---|---|---|
| New patient-facing app | FHIR R4 | RESTful API, JSON format, SMART on FHIR auth, mandated by ONC |
| Connecting to legacy hospital systems | HL7v2 (with FHIR bridge) | Most hospitals already run HL7v2 interfaces. Build a bridge rather than replacing them. |
| Submitting insurance claims | X12 837 | Mandated by HIPAA. No alternative for payer transactions. |
| E-prescribing | NCPDP SCRIPT | CMS mandate. Required for pharmacy system integration. |
| Medical imaging | DICOM + DICOMweb | Universal imaging standard. Use DICOMweb for modern access. |
| Cross-organization document exchange | FHIR (via TEFCA/Carequality) | Moving toward FHIR in stages. Direct and IHE document exchange still carry most of this traffic today, so plan to support both. |
| Real-time clinical events | HL7v2 (existing) or FHIR Subscriptions (new) | HL7v2 for existing interfaces; topic-based FHIR Subscriptions (the R4 backport) for new builds. |
The Convergence: USCDI and TEFCA
Two federal initiatives are converging on healthcare standards in the U.S.:
- USCDI (United States Core Data for Interoperability), Defines the minimum data elements that must be exchangeable. USCDI v3 (the baseline for certified health IT from 1 January 2026 under the HTI-1 rule) includes clinical notes, health insurance information, and social determinants. All expressed through FHIR R4 profiles. Those profiles come from US Core, and our USCDI vs US Core version mapping shows which US Core release carries each USCDI version.
- TEFCA (Trusted Exchange Framework and Common Agreement), Defines the network for exchanging data. TEFCA establishes rules for how health information networks connect and share data.
Together, USCDI defines what data must be shared and TEFCA defines how it gets shared. USCDI is expressed in FHIR through US Core. TEFCA query-and-retrieve exchange has run largely on IHE document exchange, and the RCE's FHIR Roadmap for TEFCA phases in FHIR-based exchange in stages. In 2023, 70% of non-federal acute care hospitals engaged in all four domains of interoperable exchange at least sometimes, and 43% routinely, according to ONC.
FHIR is more than a REST API
Many comparisons describe FHIR only as REST. The specification supports four ways to exchange the same resources: RESTful APIs, messages, documents and services. This matters when you replace an HL7 v2 feed. A FHIR message Bundle can carry an admit event much like an ADT message, and a FHIR document Bundle can carry a signed clinical summary much like a C-CDA document. Pick the paradigm that matches the workflow, then pick the resources.
C-CDA vs FHIR
C-CDA is a document standard built on HL7 CDA: one XML file holds a whole summary, such as a discharge summary or a referral note, and it travels as a unit, often over Direct. FHIR can send the same content as individual resources that an app queries one at a time, or as a document Bundle when a fixed, signed snapshot is needed. HL7 publishes a C-CDA on FHIR implementation guide (STU 2, based on FHIR R4) for teams that must represent C-CDA documents in FHIR. Use C-CDA where a partner or a certification criterion asks for documents, and FHIR where an app needs specific data on demand.
If you are deciding what to do with your HL7 v2 feeds and FHIR APIs
This section is for the CTO, VP of Engineering, CIO or product head who has to decide which interfaces to keep on HL7 v2, which to expose as FHIR, and who should build them. The usual fears are a go-live that slips because a hospital feed behaves differently from its spec, a FHIR API that passes a demo but fails certification or payer testing, and an interface engine licence that locks you in.
Three questions settle most of the decision:
- Who consumes the data? Systems inside one hospital network: keep HL7 v2. Apps, patients, payers or partners outside it: FHIR R4.
- Is there a federal rule behind it? ONC certification and the CMS payer API rules name FHIR R4. HIPAA administrative transactions stay on X12.
- What does a change cost you? Count the interfaces you run and the hours each one takes to change. The worked example below turns that into a number.
Estimate your own return on an HL7 v2 and FHIR plan
This is an estimate model, not a promise. Use your own numbers. The only default we supply is a public wage benchmark.
Annual interface cost = number of interfaces x engineer hours per interface per year x loaded hourly cost
Annual saving = annual interface cost x share of hours you expect to remove (for example by moving point-to-point feeds behind one interface engine, or by retiring custom extracts that a FHIR API replaces).
Payback in months = one-time project cost / (annual saving / 12)
Worked example with illustrative inputs: 40 interfaces, 60 engineer hours each per year for changes, upgrades and incident fixes, and a loaded cost of $98 an hour. The $98 comes from the U.S. Bureau of Labor Statistics median pay for software developers ($135,980 a year, May 2025) divided by 2,080 hours (about $65) and multiplied by 1.5 for benefits and overhead, which is our assumption. Annual interface cost: 40 x 60 x $98 = $235,200. If the plan removes a quarter of those hours, the saving is $58,800 a year, and a $45,000 project pays back in about 9 months. Replace every input with your own: interface count from your engine, hours from your ticket system, and the share removed from a written assessment.
How we do it
We start from the feeds you already run. We export the channel list from your interface engine, sample real messages from each feed and compare them with the vendor spec, because the gaps we find most often are local Z-segments, repeating fields used in ways the spec does not show, and identifiers that change between systems. Then we map each feed to one of three outcomes: keep on HL7 v2, translate to FHIR in the engine, or rebuild as a native FHIR API.
On the FHIR side we validate every resource against the target profile, such as US Core, before go-live. In the test behind our FHIR versions video, we sent R4-shaped and R5-shaped Encounter records to an R4 and an R5 HAPI FHIR server. All four requests returned 201 Created, yet reading the records back showed that two of them had lost the Encounter class field. Sending the same records to each server's $validate operation rejected both mismatched ones. That is why we validate in testing and in the build pipeline.
Typical order: two weeks to assess and write the plan, then build in slices of a few interfaces each, with message replay tests against captured traffic before each cutover.
See the work before you talk to us
We record our engine and FHIR tests on real software and publish them:
- FHIR DSTU2 vs STU3 vs R4 vs R5 vs R6: what changed, which to use (live test), embedded in our post on building a FHIR R4 server from scratch.
- InterSystems IRIS for Health, live: HL7 v2 to FHIR, visual trace.
- Mirth Connect vs Open Integration Engine vs BridgeLink: one channel, three engines (live test).
- Moving a live Mirth Connect channel to Open Integration Engine.
- What an interface engine does, for business leaders, embedded in our Mirth ADT processing guide.
- Open source Da Vinci servers on GitHub: CRD server and DTR server.
Frequently asked questions
Is FHIR part of HL7?
Yes. FHIR is published by HL7 International. "HL7" on its own usually means HL7 v2 messaging, which is why people compare the two.
Does FHIR replace HL7 v2?
Not for existing interfaces. New apps and federally required APIs use FHIR, while lab, ADT and order feeds inside hospitals keep running on HL7 v2. Most integration teams translate between the two with an interface engine.
What does Fast Healthcare Interoperability Resources (FHIR) mean?
The name describes the design: healthcare data is split into resources, each with its own URL and a defined structure, and systems exchange those resources with ordinary web tools.
Which should a new project use, FHIR or HL7?
Use FHIR R4 for any new app or API. Add HL7 v2 only where you must connect to a hospital system that offers no FHIR interface for the data you need.
How long does an HL7 v2 to FHIR project take?
The assessment takes two weeks. Build time depends on the number of feeds and how far they drift from the spec, which is why we sample real messages before quoting.
Do we need to replace our interface engine to add FHIR?
Usually not. Mirth Connect, Open Integration Engine, IRIS for Health and Rhapsody can all translate v2 to FHIR. We change engines only when licence cost or support status makes it worth the migration.
How do we know our FHIR API is correct and not just well-formed?
A server can accept a resource and still drop data. Validate against the target profile with $validate or the HL7 validator, and run the relevant Inferno test kit before certification or payer testing.
HL7 v2 and FHIR interface assessment
What you receive: an inventory of your HL7 v2 feeds and FHIR APIs, a keep, translate or rebuild decision for each one with the reason, the validation gaps we find in sampled messages, the cost model above filled with your numbers, and a written build plan with order and timeline.
How long: two weeks. You get a fixed quote after a short scoping call.
Book the assessment with our FHIR integration team or book a scoping call.
For the regulatory side, what these standards mean for TEFCA compliance and information blocking, see: Healthcare Interoperability in 2026: Regulations, TEFCA, and Your 90-Day Action Plan
Related guides
- HL7 vs FHIR: When Healthcare Organizations Need Both Standards
- HL7 v2 to FHIR: Migration Guide with Architecture, Roadmap and Mapping Examples
- FHIR R4 vs R5 vs R6: The Developer's Decision Framework for 2026
- X12 vs HL7: Which Standard Does Your Healthcare Integration Actually Need?
- Implementing SMART on FHIR With Local-First Storage
- DICOM Meets FHIR: The Complete Guide to Medical Imaging Interoperability for Architects and Senior Developers
- What is FHIR? The Modern Standard Transforming Healthcare Data Exchange
- Healthcare Software Product Development
Ready to scale?
Talk to our healthcare engineering team about building, integrating, and shipping faster.
Frequently Asked Questions
What are interoperability standards in healthcare?
What is the difference between HL7v2 and FHIR?
Should developers use FHIR R4 or R5 for production healthcare apps?
What is X12 EDI used for in healthcare?
How do healthcare software teams decide which interoperability standard to implement?
How does Nirmitee.io approach healthcare software development?