Web Development · head to head
HTMX vs Stimulus

HTMX
Web Development
Lightweight JavaScript library enabling AJAX, WebSockets, and server-sent events in HTML
- From
- Free
- Free plan
- Yes

Stimulus
Web Development
Small JavaScript framework that adds behaviour to existing server rendered HTML
- From
- Free
- Free plan
- Yes
The short version
- HTMX is a lightweight JavaScript library; Stimulus is an MIT licensed JavaScript framework.
- Both are free.
- Only HTMX lists AJAX requests; only Stimulus lists designed to pair with Turbo in Hotwire.
- Where HTMX falls short: best suited for server-rendered architectures, not pure client-side SPAs.
- Where Stimulus falls short: does not render templates, so HTML must come from the server or another tool.
How do HTMX and Stimulus differ?
Only the attributes on which HTMX and Stimulus actually diverge.
On every field we record, HTMX and Stimulus match. The differences are in what each one covers, below.
Identical on both: starting price (Free), pricing model (Open-source), free tier (Yes), platforms (Web), category (Web Development).
Not yet recorded: founded for HTMX.
Which features does each one have?
They share no listed features; 7 appear only for HTMX and 7 only for Stimulus. Drawn from each product's published feature list. An absence here means we hold no record of it - not that the product lacks it.
Only in HTMX
- AJAX requests
- HTTP verb support
- DOM targeting
- Swap strategies
- WebSocket support
- Server-sent events
- Out-of-band updates
Only in Stimulus
- Controllers attached through data-controller
- Actions that bind DOM events to controller methods
- Targets for locating elements inside a controller
- Values that read, write and observe data attributes
- Works with server rendered HTML
- Designed to pair with Turbo in Hotwire
- MIT licensed open source
What is each one used for?
HTMX is most often brought in for building interactive applications without JavaScript framework complexity; Stimulus for adding small interactions to Rails views. The jobs each tool is most often brought in to do.
HTMX
- Building interactive applications without JavaScript framework complexitynot Stimulus
- Server-rendered applications requiring dynamic updatesnot Stimulus
- Adding interactivity to existing server-side applicationsnot Stimulus
- Hypermedia-driven applications using HTML-first approachesnot Stimulus
Stimulus
- Adding small interactions to Rails viewsnot HTMX
- Progressive enhancement of server rendered pagesnot HTMX
- Pairing with Turbo for fast page updatesnot HTMX
- Replacing scattered jQuery codenot HTMX
- Form and widget behaviour on existing HTMLnot HTMX
Where do HTMX and Stimulus fall short?
HTMX's most cited limit: best suited for server-rendered architectures, not pure client-side SPAs. Stimulus's: does not render templates, so HTML must come from the server or another tool. Documented limitations, not opinions. Every one is a constraint you would hit in normal use.
HTMX
- Best suited for server-rendered architectures, not pure client-side SPAs
- Limited client-side state management capabilities compared to frameworks
- Smaller ecosystem with fewer third-party libraries and tools
- Learning curve for developers from JavaScript framework backgrounds
Stimulus
- Does not render templates, so HTML must come from the server or another tool
- No built in routing, data fetching or client side state management
- Behaviour is tied to data attributes in markup, which some teams find harder to trace
- Not a component framework, so large interactive interfaces need other libraries
How much do HTMX and Stimulus cost?
HTMX is free to use; Stimulus is free to use. Plan by plan below, from each vendor's own pricing page.
HTMX
Free- Open source (BSD 0-clause)Free
Stimulus
FreeNo published plan breakdown. See the Stimulus review.
Which should you pick?
Choose HTMX if
- You need ajax requests.
- You want to start without paying.
- You also want http verb support.
Choose Stimulus if
- You need controllers attached through data-controller.
- You want to start without paying.
- You also want actions that bind dom events to controller methods.
Questions people ask
- Is HTMX or Stimulus better?
- It depends on the job. HTMX fits building interactive applications without JavaScript framework complexity; Stimulus fits adding small interactions to Rails views. HTMX starts at Free and Stimulus at Free.
- Which is cheaper, HTMX or Stimulus?
- HTMX starts at Free and Stimulus at Free.
- Does HTMX or Stimulus run on more platforms?
- Both run on Web, so platform support will not decide this one for you.
- Can I use HTMX for free?
- Both have a free tier, so you can try either at no cost before committing.
- What is HTMX best used for?
- HTMX is most often used for building interactive applications without javascript framework complexity, server-rendered applications requiring dynamic updates, adding interactivity to existing server-side applications, hypermedia-driven applications using html-first approaches. Of those, building interactive applications without javascript framework complexity and server-rendered applications requiring dynamic updates are not what Stimulus is typically brought in for.
- What can HTMX do that Stimulus cannot?
- HTMX covers AJAX requests, HTTP verb support, DOM targeting, Swap strategies. Stimulus covers Controllers attached through data-controller, Actions that bind DOM events to controller methods, Targets for locating elements inside a controller, Values that read, write and observe data attributes.
Answered from the vendors’ own pages
HTMX: How big is the HTMX JavaScript library?
HTMX is only 16 kilobytes minified and gzipped with zero external dependencies.
SourceStimulus: What is Stimulus used for?
Stimulus enhances HTML that already exists on the page by connecting JavaScript controllers to elements through data attributes. It does not generate the HTML itself.
SourceHTMX: Can HTMX work with JSON APIs?
While HTMX is optimized for HTML responses, it can work with JSON through additional configuration and response handling.
SourceStimulus: What are the core concepts in Stimulus?
Controllers are the main unit, and they are joined by actions, targets and values. Actions link events to methods, targets find elements and values store state in data attributes.
SourceHTMX: Does HTMX support real-time features like WebSockets?
Yes, HTMX includes support for WebSockets and server-sent events for real-time bidirectional communication.
SourceStimulus: What licence does Stimulus use?
The GitHub repository states that Stimulus is released under the MIT licence. It is free to use.
SourceStimulus: Why was Stimulus created?
According to the project's origin page, Basecamp used a mix of jQuery, vanilla JavaScript and object oriented subsystems that were hard to reuse and learn. Stimulus condensed those patterns into a small, consistent framework.
SourceRelated pages
Other head to heads
- HTMX vs Alpine.js
- HTMX vs jQuery
- HTMX vs React
- HTMX vs Flask
- HTMX vs Astro
- HTMX vs Remix
- HTMX vs Ant Design
- HTMX vs Tailwind CSS
- HTMX vs FastAPI
- HTMX vs Lit
- HTMX vs Next.js
- HTMX vs Stencil
- HTMX vs SvelteKit
- HTMX vs TypeScript
- HTMX vs Babel
- HTMX vs Cloudflare Pages
- HTMX vs Eleventy
- HTMX vs Vue.js
- HTMX vs Svelte
- HTMX vs Angular
- HTMX vs MUI
- HTMX vs Preact
- HTMX vs SolidJS
- HTMX vs Bootstrap
- HTMX vs Vercel
- HTMX vs Express.js
- HTMX vs Apache HTTP Server
- HTMX vs Base UI
- HTMX vs Jekyll
- HTMX vs v0 by Vercel
- HTMX vs Turbopack
- Stimulus vs Alpine.js
- Stimulus vs jQuery
- Stimulus vs React
- Stimulus vs Flask
- Stimulus vs Astro
- Stimulus vs Remix
- Stimulus vs Ant Design
- Stimulus vs Tailwind CSS
- Stimulus vs FastAPI
- Stimulus vs Lit
- Stimulus vs Next.js
- Stimulus vs Stencil
- Stimulus vs SvelteKit
- Stimulus vs TypeScript
- Stimulus vs Babel
- Stimulus vs Cloudflare Pages
- Stimulus vs Eleventy
- Stimulus vs Vue.js
- Stimulus vs Svelte
- Stimulus vs Angular
- Stimulus vs MUI
- Stimulus vs Preact
- Stimulus vs SolidJS
- Stimulus vs Bootstrap
- Stimulus vs Vercel
- Stimulus vs Express.js
- Stimulus vs Apache HTTP Server
- Stimulus vs Base UI
- Stimulus vs Jekyll
- Stimulus vs v0 by Vercel
- Stimulus vs Turbopack
