# Installation
htmx is a single JavaScript file with no dependencies. No build step is required to use it.
## CDN
Add this in your `<head>` tag:
```html
<script src="https://cdn.jsdelivr.net/npm/htmx.org@4.0.0-beta2" integrity="sha384-v+EMKtNUAo5enmQxBqgoU/FWvVvvZHvITNzurHSl4kzvCs94wdlgHUci1lliKWKz" crossorigin="anonymous"></script>
```
### Unminified
```html
<script src="https://cdn.jsdelivr.net/npm/htmx.org@4.0.0-beta2/dist/htmx.js" integrity="sha384-sxLOx04gZNKw/HpiJukyUwiM25Q5SdmvP3I36IHl6wSR4n68abzxLQHxeKKTk7Uq" crossorigin="anonymous"></script>
```
### ES Module
```html
<script type="module" src="https://cdn.jsdelivr.net/npm/htmx.org@4.0.0-beta2/dist/htmx.esm.min.js" integrity="sha384-imtDMsKpIb5KDnuaceZPNUtGHemw6nZSQTAcVNpfegk47oSVnMbe0dp6civ/SA4s" crossorigin="anonymous"></script>
```
### ES Module (unminified)
```html
<script type="module" src="https://cdn.jsdelivr.net/npm/htmx.org@4.0.0-beta2/dist/htmx.esm.js" integrity="sha384-6RhNnkQax3nr4qLjuAzvDdXPn1NfdLRySEzp1OlxCJn0i+nvn02WkqJ9Ctfc4WPi" crossorigin="anonymous"></script>
```
## Download
Instead of using a CDN, consider [self-hosting in production](https://blog.wesleyac.com/posts/why-not-javascript-cdn).
1. Download <a download href="https://cdn.jsdelivr.net/npm/htmx.org@4.0.0-beta2/dist/htmx.min.js">htmx.min.js</a>
2. Save it to your project (e.g., `/js/htmx.min.js`)
3. Add this in your `<head>` tag:
```html
<script src="/js/htmx.min.js"></script>
```
### Other formats
Download: <a download href="https://cdn.jsdelivr.net/npm/htmx.org@4.0.0-beta2/dist/htmx.js">htmx.js</a> (unminified)
Download: <a download href="https://cdn.jsdelivr.net/npm/htmx.org@4.0.0-beta2/dist/htmx.esm.min.js">htmx.esm.min.js</a> (ES module)
Download: <a download href="https://cdn.jsdelivr.net/npm/htmx.org@4.0.0-beta2/dist/htmx.esm.js">htmx.esm.js</a> (ES module, unminified)
## npm
```sh
npm install htmx.org@4.0.0-beta2
```
```javascript
import 'htmx.org';
```
### Named import
```javascript
import htmx from 'htmx.org';
// Now you can use htmx.ajax(), htmx.find(), etc.
```
## htmax
The `htmax.js` file bundles htmx with the most popular extensions in a single file:
* [SSE](https://four.htmx.org/docs/extensions/sse)
* [WebSockets](https://four.htmx.org/docs/extensions/ws)
* [preload](https://four.htmx.org/docs/extensions/preload)
* [browser-indicator](https://four.htmx.org/docs/extensions/browser-indicator)
* [download](https://four.htmx.org/docs/extensions/download)
* [optimistic](https://four.htmx.org/docs/extensions/optimistic)
* [targets](https://four.htmx.org/docs/extensions/targets).
The extensions are automatically available, you can just use their attributes directly (e.g. `hx-sse:connect`, `hx-ws:connect`).
```html
<script src="/js/htmax.min.js"></script>
```
Install htmx via CDN, npm, or direct download
htmx is a single JavaScript file with no dependencies. No build step is required to use it.