# html-validate

> Offline HTML5 validator and linter

Latest version **11.16.2** (published 2026-10-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install html-validate
pnpm add html-validate
yarn add html-validate
bun add html-validate
```

Provides the command `html-validate`.

## Health

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

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 11.16.2 |
| Published | 2026-10-04 |
| First published | 2017-10-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | ^22.22.0 \|\| >= 24.8.0 |
| Dependencies | 6 |
| Unpacked size | 7.7 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (Unknown) |
| Author | David Sveningsson |
| Maintainers | ext |
| Keywords | html, lint, validator, html-validate |

## Links

- npm: https://www.npmjs.com/package/html-validate
- Repository: https://gitlab.com/html-validate/html-validate
- Homepage: https://html-validate.org
- Issues: https://gitlab.com/html-validate/html-validate/issues/new
- Funding: https://github.com/sponsors/html-validate
- npm.io page: https://npm.io/package/html-validate

## Dependencies (6)

- [ajv](https://npm.io/package/ajv.md) ^8.0.0
- [kleur](https://npm.io/package/kleur.md) ^4.1.0
- [semver](https://npm.io/package/semver.md) ^7.0.0
- [prompts](https://npm.io/package/prompts.md) ^2.0.0
- [@html-validate/stylish](https://npm.io/package/@html-validate/stylish.md) ^6.0.0
- [@sidvind/better-ajv-errors](https://npm.io/package/@sidvind/better-ajv-errors.md) 7.0.0

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@pandacss/eslint-plugin](https://npm.io/package/@pandacss/eslint-plugin.md) — 18.7K weekly downloads

## Recent versions

- 11.16.2 (latest) — 2026-10-04
- 9.4.2-rc.1 (next) — 2025-03-01
- 4.14.1 (release-4.x) — 2021-09-18
- 4.1.1 (release-4.1.x) — 2021-03-19
- 11.16.1 — 2026-09-27
- 11.16.0 — 2026-09-15
- 11.15.0 — 2026-09-07
- 11.14.0 — 2026-09-05
- 11.13.0 — 2026-09-03
- 11.12.0 — 2026-09-01
- 11.11.0 — 2026-08-30
- 11.10.0 — 2026-08-23
- 11.9.0 — 2026-08-20
- 11.8.0 — 2026-08-17
- 11.7.0 — 2026-08-16
- … 333 more at https://npm.io/package/html-validate/versions

## README

# html-validate

[![pipeline status](https://gitlab.com/html-validate/html-validate/badges/master/pipeline.svg)](https://gitlab.com/html-validate/html-validate/commits/master)
[![coverage report](https://gitlab.com/html-validate/html-validate/badges/master/coverage.svg)](https://gitlab.com/html-validate/html-validate/commits/master)

Offline HTML5 validator. Validates either a full document or a smaller
(incomplete) template, e.g. from an AngularJS or Vue.js component.

Read the full documentation at https://html-validate.org/

## Features

- Can test fragments of HTML, for instance a component template.
- Does not upload any data to a remote server, all testing is done locally.
- Strict and non-forgiving parsing. It will not try to correct any incorrect
  markup or guess what it should do.

## Usage

    npm install -g html-validate
    html-validate [OPTIONS] [FILENAME..] [DIR..]

## Configuration

Create `.htmlvalidate.json`:

```js
{
  "extends": [
    "html-validate:recommended"
  ],

  "rules": {
    "close-order": "error",
    "void": ["warn", {"style": "omit"}]
  }
}
```

## Example

```html
<p>
  <button>Click me!</button>
  <div id="show-me">
    Lorem ipsum
  </div>
</p>
```

```text
  1:1  error  Element <p> is implicitly closed by adjacent <div>  no-implicit-close
  2:2  error  Button is missing type attribute                    button-type
  6:4  error  Unexpected close-tag, expected opening tag          close-order
```

## Bundles

The library comes in four flavours:

- CommonJS full (`dist/cjs/index.js`)
- CommonJS browser (`dist/cjs/browser.js`)
- ESM full (`dist/esm/index.js`)
- ESM browser (`dist/esm/browser.js`)

The browser bundle contains a slimmed version without CLI and NodeJS dependencies.

```ts
/* automatically determine build based on `browser` export condition */
import { ... } from "html-validate";

/* explicitly use nodejs bundle */
import { ... } from "html-validate/node";

/* explicitly use browser bundle */
import { ... } from "html-validate/browser";
```

See [running in browser](https://html-validate.org/dev/running-in-browser.html) for details about getting HTML-Validate running in a browser environment.

## Developing

### Prerequisites

- Node.js 22.16, 24.0 or later.
- NPM 10

### Test

Testing is done using jest.

    npm test

or call `jest` directly.

Some tests are autogenerated from documentation examples, use `npm run docs` to build those before running.

### Lint

Linting is done using ESLint.

    npm run eslint

or call `eslint` directly.

### Build

    npm run build

To build documentation use:

    npm run docs

The documentation can be served locally using:

    npm start

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