HTMX 4.0: Hypermedia shifts into a higher gear
Originally published in Turkish. Read the original →

Long considered 'feature-complete', HTMX drops its XHR foundation and moves to the Fetch API in version 4.0. This change strengthens both performance and simplicity with streaming-based UI updates, Idiomorph morphing built into the core, more explicit inheritance behavior and more visible UI responses to errors.
HTMX had long been seen as a "finished" project. For many people, version 2.0 was the final stop: the goals were clear, it was widely used in production and the approach had kept its simplicity. HTMX's creator Carson Gross had even said outright at one point that "there will be no 3.0".
Then the team made a decision that will sound very familiar to developers: they ripped out the engine entirely and rebuilt it on a more modern foundation. The result is HTMX 4.0. The version number may look like a joke, but on the technical side it signals a serious architectural change.
Why does HTMX 4.0 matter?
At the heart of HTMX 4.0 is the Fetch API, used directly instead of the XMLHttpRequest (XHR) that had been in place for years. On paper this looks like a "technical update", but it makes a big difference for both performance and developer experience.
Previously, the browser side mostly waited for the entire response and only then performed the swap. Thanks to the ReadableStream support that comes with Fetch, HTMX can now receive and process content chunk by chunk. That means a smoother interface that responds faster to the user.
The era of native streaming with the Fetch API
The HTMX 2.x line relied on an XHR-based design. This approach worked; however, buffering the response and processing it afterwards introduced latency, especially in scenarios with long or multi-part responses.
With HTMX 4.0, the flow is more natural:
- The server response is processed piece by piece as it arrives.
- The interface can be updated incrementally instead of with a single big swap.
- You get a more modern data flow with less JavaScript code.
This structure offers benefits in line with modern "stream-first" approaches like React Server Components, while keeping HTMX's core promise: staying as HTML-centric as possible.
Idiomorph is now in the core
The second standout move in HTMX 4.0 is that the DOM morphing approach is now more firmly part of the core. Idiomorph, which used to be used as an extension, is becoming part of the default experience.
The morphing logic is simple: the incoming HTML is compared with the existing DOM and only the changed parts are updated. This means:
- Less screen jank,
- A more consistent sense of state,
- Faster visual transitions.
The interesting thing about this approach is that it has evolved in dialogue with ideas from the Hotwired ecosystem. So instead of "HTMX vs. the others", the picture is a healthier one: the "joint evolution of a good idea".
Breaking change: prop inheritance is now explicit
One of HTMX 4.0's deliberate breaking changes concerns attribute/property inheritance. In previous versions, some attributes such as hx-target could be implicitly carried down from parent elements. In practice this produced hard-to-trace behavior like "why is this button swapping here?"
In the new version, the default is no inheritance. If you want inheritance, you have to state it explicitly (for example with the :inherited form). This decision strengthens the principle of locality of behavior: you need less "digging through parent templates" to see what an element will do.
The history optimization has been removed
HTMX 2.x had an approach that took DOM snapshots and kept them in localStorage to speed up history navigation. It looked good in theory, but in practice it could introduce fragility. HTMX 4.0 simplifies this complex mechanism and falls back to standard browser behavior, i.e. a full page load when needed.
This decision continues the "less magic, more predictable behavior" line.
Error states are now visible
With 4.0, content returned for statuses like 404/500 can be swapped in a more meaningful way. Compared with the previous behavior, where these scenarios failed silently, this gives clearer feedback to both the user and the developer.
The idea of status-code-based targeting is also noteworthy: routing different HTTP ranges to different UI areas makes error handling expressible directly at the HTML level.
Cleaner multi-updates with
The new tag makes targeting multiple UI spots in a single response more readable. Compared with the old "out-of-band swap" approach, it expresses intent more clearly and simplifies server-side templates.
Especially on dashboard-like screens, in scenarios where a single request updates the sidebar + content + notification area, this structure brings a serious cleanup.
Native View Transitions integration
HTMX 4.0 moves to a line that is more compatible with the browser's View Transitions API capabilities. This makes it easier to build page transitions with more of an "app feel" without adding extra JavaScript weight.
Conclusion: More modern, but still simple
The most valuable aspect of HTMX 4.0 is not adding new features but updating the foundation. The move to the Fetch API makes both streaming and a leaner core possible; Idiomorph and the other improvements then settle in on top of that more naturally.
In short: HTMX is not abandoning its "do a lot with little JavaScript" claim. It is simply shifting that claim into a higher gear for the browser realities of 2026.




