htmx 4.0.0 has been released! ~ htmx (https://cdn.jsdelivr.net) (https://four.htmx.org/sitemap-index.xml) (2026-08-28-htmx-4.0.0-is-released.html) (../favicon.svg) (htmx — Atom feed) (https://four.htmx.org/atom.xml) (htmx — RSS feed) (https://four.htmx.org/rss.xml) (../_astro/Layout.0JkR7Gfp.css) (../_astro/_..DYquaUGr.css) (../_astro/content.BQGi-kHu.css) (https://four.htmx.org/) < / - > - htmx home (/) v4 (https://htmx.org) v2 (https://v1.htmx.org) v1 (https://four.htmx.org/docs) docs (https://four.htmx.org/docs/morphing-swaps-guide) Morphing Guide (https://four.htmx.org/docs/htmx-events-guide) htmx Events Guide (https://four.htmx.org/docs/hx-live-guide) hx-live Programmers Guide (https://four.htmx.org/docs/extension-authoring-guide) htmx Extension Authoring Guide (https://four.htmx.org/docs/hcon-guide) HCON (https://four.htmx.org/docs/htmax) htmax (https://four.htmx.org/docs/editor-support) Editor Support (https://four.htmx.org/reference) reference (https://four.htmx.org/patterns) patterns (https://four.htmx.org/extensions) extensions (https://four.htmx.org/essays) essays (https://four.htmx.org/game) game (https://four.htmx.org/about) about Open Search Ctrl K ⌘ K (https://four.htmx.org/discord) (Join the Discord community) (https://github.com/bigskysoftware/htmx) (View source code on GitHub) (https://four.htmx.org/docs) docs (https://four.htmx.org/docs/morphing-swaps-guide) Morphing Guide (https://four.htmx.org/docs/htmx-events-guide) htmx Events Guide (https://four.htmx.org/docs/hx-live-guide) hx-live Programmers Guide (https://four.htmx.org/docs/extension-authoring-guide) htmx Extension Authoring Guide (https://four.htmx.org/docs/hcon-guide) HCON (https://four.htmx.org/docs/htmax) htmax (https://four.htmx.org/docs/editor-support) Editor Support (https://four.htmx.org/reference) reference (https://four.htmx.org/patterns) patterns (https://four.htmx.org/extensions) extensions (https://four.htmx.org/essays) essays (https://four.htmx.org/game) game (https://four.htmx.org/about) about (https://four.htmx.org/discord) (Join the Discord community) Discord (https://github.com/bigskysoftware/htmx) (View source code on GitHub) GitHub On this page (2026-08-28-htmx-4.0.0-is-released.html#htmx-400-release) htmx 4.0.0 Release (2026-08-28-htmx-4.0.0-is-released.html#major-changes) Major Changes (2026-08-28-htmx-4.0.0-is-released.html#new-features) New Features (2026-08-28-htmx-4.0.0-is-released.html#upgrading) Upgrading (2026-08-28-htmx-4.0.0-is-released.html#installing) Installing (2026-08-28-htmx-4.0.0-is-released.html#llms) LLMs (2026-08-28-htmx-4.0.0-is-released.html#conclusion) Conclusion (2026-08-28-htmx-4.0.0-is-released.html#upgrade-music) Upgrade Music (https://github.com/bigskysoftware/htmx/edit/four-dev/www/src/content/announcements/2026-08-28-htmx-4.0.0-is-released.md) Edit page (https://four.htmx.org/announcements) Announcements (https://four.htmx.org/) Home / (https://four.htmx.org/announcements) Announcements / htmx 4.0.0 has been released! htmx 4.0.0 has been released! (Copy page content as Markdown) Copy page (https://four.htmx.org/announcements/2026-08-28-htmx-4.0.0-is-released.md) View as Markdown Open this page as Markdown For LLMs (https://four.htmx.org/llms.txt) llms.txt htmx overview for LLMs (https://four.htmx.org/llms-full.txt) llms-full.txt Complete htmx docs for LLMs Release announcement, 2026-08-28. On this page (2026-08-28-htmx-4.0.0-is-released.html#htmx-400-release) htmx 4.0.0 Release (2026-08-28-htmx-4.0.0-is-released.html#major-changes) Major Changes (2026-08-28-htmx-4.0.0-is-released.html#new-features) New Features (2026-08-28-htmx-4.0.0-is-released.html#upgrading) Upgrading (2026-08-28-htmx-4.0.0-is-released.html#installing) Installing (2026-08-28-htmx-4.0.0-is-released.html#llms) LLMs (2026-08-28-htmx-4.0.0-is-released.html#conclusion) Conclusion (2026-08-28-htmx-4.0.0-is-released.html#upgrade-music) Upgrade Music (htmx 4 land cruiser) (2026-08-28-htmx-4.0.0-is-released.html#htmx-400-release) htmx 4.0.0 Release The htmx team is very happy to announce the release of htmx 4.0.0! This is the culmination of 8 months of work (plus a (https://four.htmx.org/game) game ) and we are very happy with the results. The idea of htmx 4 started to germinate when I decided to create (https://fixiproject.org) fixi and, in doing so, got more familiar with the fetch() API and async programming in JavaScript. (htmx had always used (https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) XMLHttpRequest due to backwards compatibility issues.) One chance evening I was contacted by Christian, who had some interesting ideas around (https://four.htmx.org/docs#streaming-html) streaming HTML that got me thinking that moving the internals to fetch() would simplify things for him and for the library in general.After a bit of work I managed to get Michael and Alex on board, and we were off to the races. Development has been very smooth. We started a port of fixi + the htmx test suite. Over time, we rediscovered why htmx did many of the things that it did and moved our new implementation closer and closer to the old one. At this point the behavioral differences between 2.x and 4.x are relatively small and where they do diverge we have made explicit choices that we feel will put htmx-based applications in a good spot for being (https://www.youtube.com/watch?v=lASLZ9TgXyc) 100-year web services Note that we are not marking 4.0 as (https://docs.npmjs.com/cli/v10/commands/npm-dist-tag#purpose) latest in NPM because we do not want to force-upgrade users who are relying on non-versioned CDN URLs for htmx. Instead, 2.x will remain latest and the 4.0 line will remain next until some point in early 2027. The website, however, will reference 4.0. (2026-08-28-htmx-4.0.0-is-released.html#major-changes) Major Changes As mentioned above, htmx 4, from a user’s viewpoint, is almost identical to htmx 2. There are three major changes: Attribute inheritance is now explicit by default rather than implicit by default (this is the biggest upgrade item) The htmx event names have been standardized & cleaned up. Some advanced users may need to change the events they listen for. History support now does not use localStorage by default (which was a cause of many support headaches). Most people won’t notice this at all. Internally, we migrated from XMLHttpRequest to fetch() but that should be transparent for most users of htmx. (2026-08-28-htmx-4.0.0-is-released.html#attribute-inheritance) Attribute Inheritance In htmx 2 many attributes were “inherited” by default. This allows you to place attributes on parent elements and their behavior will apply to child elements. This behavior, which came from the (https://intercoolerjs.org) intercooler.js days, was inspired by CSS and, unsurprisingly, worked out about the same as CSS: powerful but difficult to understand at times. In htmx 4 attributes are not inherited unless you (https://four.htmx.org/docs#attribute-inheritance) explicitly say so by adding an :inherited after the attribute name: (Copy to clipboard) < div hx-confirm = "Are you sure?" > < button hx-delete = "/item/1" >Delete button > div > < div hx-confirm:inherited = "Are you sure?" > < button hx-delete = "/item/1" >Delete button > div > This will be the largest upgrade burden in migrating from htmx 2 to htmx 4. To make things easier, we have provided a (https://four.htmx.org/docs#upgrade-checker) command line tool to find places you need to mark as inherited. Note that attributes like hx-disinherit , etc. are no longer required and should be removed. (2026-08-28-htmx-4.0.0-is-released.html#events) Events The events triggered by htmx 2 had grown organically over the life of the library and were not particularly well organized, making it difficult to know exactly which event was fired when. In htmx 4, all events now follow htmx:phase:action[:sub-action] : htmx 2 htmx 4 htmx:beforeRequest htmx:before:request htmx:afterRequest htmx:after:request htmx:beforeSwap htmx:before:swap htmx:afterSwap htmx:after:swap htmx:configRequest htmx:config:request In addition, the following changes were made: Most error events collapse into (https://four.htmx.org/reference/events/htmx-error) htmx:error . HTTP error responses fire (https://four.htmx.org/reference/events/htmx-response-error) htmx:response:error . The htmx:xhr:* events are removed. htmx 4 uses fetch() . The htmx:validation:* events are removed in favor of native browser form validation. The full table is in (https://four.htmx.org/docs/whats-new-in-htmx-4) What’s New in htmx 4 . The command line upgrade checker flags old event names in hx-on attributes and in your JavaScript where it can find them. (2026-08-28-htmx-4.0.0-is-released.html#history) History History support has always been included in htmx, allowing you to implement back-button aware actions with simple attributes. In htmx 2, a cache in localStorage was used to snapshot pages for restoration. Unfortunately a large source of issues was that this snapshot could include DOM mutations by 3rd party JavaScript libraries. When the page was restored, those mutations remained but the underlying JavaScript logic was not. htmx 4 does not cache pages in localStorage . On back navigation htmx re-fetches the page and swaps it into
, or into the [hx-history-elt] element if one is present. This allows 3rd party JavaScript libraries to “just work” in most cases and, with good request caching, is very fast. If you want local caching instead, we now ship a very complete (https://four.htmx.org/extensions/hx-history-cache) hx-history-cache extension that restores history from sessionStorage and is designed to integrate well with scripting solutions like Alpine.js, etc. (2026-08-28-htmx-4.0.0-is-released.html#new-features) New Features There are two big new features in htmx 4, both of which we are really excited about: (2026-08-28-htmx-4.0.0-is-released.html#morph-swaps) Morph Swaps We now support (https://four.htmx.org/docs#morphing-swaps) morphing swaps out of the box with htmx. I created (https://github.com/bigskysoftware/idiomorph) idiomorph and nearly included it in htmx 2.x but decided against it. In htmx 4, Michael has done great work improving on that algorithm and integrating it seamlessly into htmx. (2026-08-28-htmx-4.0.0-is-released.html#hx-partial)