# happy-dom

> Happy DOM is a JavaScript implementation of a web browser without its graphical user interface. It includes many web standards from WHATWG DOM and HTML.

Latest version **20.14.5** (published 2026-09-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install happy-dom
pnpm add happy-dom
yarn add happy-dom
bun add happy-dom
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 20.14.5 |
| Published | 2026-09-12 |
| First published | 2019-09-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=20.0.0 |
| Dependencies | 7 |
| Unpacked size | 8.2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 4656 |
| Author | David Ortner |
| Maintainers | davidortner |
| Keywords | jsdom, dom, browser, custom, elements, web, components, html, whatwg, w3c |

## Links

- npm: https://www.npmjs.com/package/happy-dom
- Repository: https://github.com/capricorn86/happy-dom
- Issues: https://github.com/capricorn86/happy-dom/issues
- npm.io page: https://npm.io/package/happy-dom

## Dependencies (7)

- [ws](https://npm.io/package/ws.md) ^8.21.0
- [entities](https://npm.io/package/entities.md) ^7.0.1
- [@types/ws](https://npm.io/package/@types/ws.md) ^8.18.1
- [@types/node](https://npm.io/package/@types/node.md) >=20.0.0
- [whatwg-mimetype](https://npm.io/package/whatwg-mimetype.md) ^3.0.0
- [buffer-image-size](https://npm.io/package/buffer-image-size.md) ^0.6.4
- [@types/whatwg-mimetype](https://npm.io/package/@types/whatwg-mimetype.md) ^3.0.2

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 20.14.5 (latest) — 2026-09-12
- 20.14.4 — 2026-09-12
- 20.14.3 — 2026-09-09
- 20.14.2 — 2026-09-09
- 20.14.1 — 2026-09-09
- 20.14.0 — 2026-09-03
- 20.13.2 — 2026-09-02
- 20.13.1 — 2026-09-02
- 20.13.0 — 2026-09-02
- 20.12.2 — 2026-09-02
- 20.12.1 — 2026-09-01
- 20.12.0 — 2026-08-29
- 20.11.15 — 2026-08-28
- 20.11.14 — 2026-08-28
- 20.11.13 — 2026-08-28
- … 757 more at https://npm.io/package/happy-dom/versions

## README

![Happy DOM Logo](https://github.com/capricorn86/happy-dom/raw/master/docs/happy-dom-logo.jpg)

A JavaScript implementation of a web browser without its graphical user interface.

## DOM Features

- Custom Elements (Web Components)

- Declarative Shadow DOM

- Mutation Observer

- Tree Walker

- Fetch API

And much more..

## Documentation

[Documentation](https://github.com/capricorn86/happy-dom/wiki/) | [Getting Started](https://github.com/capricorn86/happy-dom/wiki/Getting-started) | [Setup as Test Environment](https://github.com/capricorn86/happy-dom/wiki/Setup-as-Test-Environment) | [GitHub](https://github.com/capricorn86/happy-dom/)

## Works With

[Vitest](https://vitest.dev/) | [Bun](https://bun.sh) | [Jest](https://jestjs.io/) | [Testing Library](https://testing-library.com/) | [Google LitElement](https://lit.dev/) | [Vue](https://vuejs.org/) | [React](https://reactjs.org) | [Svelte](https://svelte.dev/) | [Angular](https://angular.dev/)

## Module Systems

[ESM](https://nodejs.org/api/esm.html#introduction) | [CommonJS](https://nodejs.org/api/modules.html#modules-commonjs-modules)

## Performance

| Operation                            | JSDOM   | Happy DOM |
| ------------------------------------ | ------- | --------- |
| Import / Require                     | 333 ms  | 45 ms     |
| Parse HTML                           | 256 ms  | 26 ms     |
| Serialize HTML                       | 65 ms   | 8 ms      |
| Render custom element                | 214 ms  | 19 ms     |
| querySelectorAll('tagname')          | 4.9 ms  | 0.7 ms    |
| querySelectorAll(':nth-child(2n+1)') | 10.4 ms | 3.8 ms    |

See how the test was done [here](https://github.com/capricorn86/happy-dom-performance-test)

---
_Source: https://npm.io/package/happy-dom · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
