# htmlhint

> The Static Code Analysis Tool for your HTML

Latest version **1.9.2** (published 2026-03-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install htmlhint
pnpm add htmlhint
yarn add htmlhint
bun add htmlhint
```

Provides the command `htmlhint`.

## Health

**Score 63/100 (C)** — status: stable.

Positive: has types package; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.9.2 |
| Published | 2026-03-05 |
| First published | 2014-04-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/htmlhint) |
| Module format | ESM + CommonJS |
| Node | >=18 |
| Dependencies | 8 |
| Unpacked size | 452.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3310 |
| Maintainers | thedaviddias, coliff |
| Keywords | html, hint, analysis, lint, javascript |

## Links

- npm: https://www.npmjs.com/package/htmlhint
- Repository: https://github.com/htmlhint/HTMLHint
- Homepage: https://htmlhint.com
- Issues: https://github.com/htmlhint/HTMLHint/issues
- Funding: https://opencollective.com/htmlhint
- npm.io page: https://npm.io/package/htmlhint

## Dependencies (8)

- [xml](https://npm.io/package/xml.md) 1.0.1
- [glob](https://npm.io/package/glob.md) ^13.0.6
- [async](https://npm.io/package/async.md) 3.2.6
- [chalk](https://npm.io/package/chalk.md) 4.1.2
- [is-glob](https://npm.io/package/is-glob.md) ^4.0.3
- [commander](https://npm.io/package/commander.md) 11.1.0
- [node-sarif-builder](https://npm.io/package/node-sarif-builder.md) 3.2.0
- [strip-json-comments](https://npm.io/package/strip-json-comments.md) 3.1.1

## 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

- 1.9.2 (latest) — 2026-03-05
- 1.0.0-beta.1 (beta) — 2020-06-25
- 1.9.1 — 2026-02-11
- 1.9.0 — 2026-02-10
- 1.8.1 — 2026-02-06
- 1.8.0 — 2025-11-25
- 1.7.1 — 2025-09-16
- 1.7.0 — 2025-09-11
- 1.6.3 — 2025-06-18
- 1.6.2 — 2025-06-18
- 1.6.1 — 2025-06-17
- 1.6.0 — 2025-06-17
- 1.5.1 — 2025-06-07
- 1.5.0 — 2025-06-06
- 1.4.0 — 2025-06-03
- … 40 more at https://npm.io/package/htmlhint/versions

## README

<h1 align="center">
  <br>
  <a href="https://htmlhint.com"><img src="https://raw.githubusercontent.com/htmlhint/HTMLHint/main/website/src/assets/img/htmlhint.png" alt="Logo HTMLHint" width="170"></a>
  <br>
  HTMLHint
  <br>
</h1>

<h4 align="center">The static code analysis tool you need for your HTML.</h4>

<p align="center">
  <a href="https://www.npmjs.com/package/htmlhint">
    <img src="https://img.shields.io/npm/v/htmlhint" alt="npm Version">
  </a>
  <a href="https://www.bestpractices.dev/projects/6697">
    <img src="https://www.bestpractices.dev/projects/6697/badge" alt="Open Source Security Foundation (OpenSSF) best practices: Passing">
  </a>
  <a href="https://www.npmjs.com/package/htmlhint">
    <img src="https://img.shields.io/npm/dm/htmlhint.svg" alt="npm count">
  </a>
  <a href="https://github.com/htmlhint/HTMLHint/blob/main/LICENSE.md">
    <img src="https://img.shields.io/github/license/htmlhint/HTMLHint" alt="MIT License" />
  </a>
</p>

<p align="center">
  <a href="#-installation-and-usage">How To Use</a> • <a href="/.github/CONTRIBUTING.md">Contributing</a> • <a href="https://htmlhint.com">Website</a>
</p>

## Table of Contents

- **[Installation and Usage](#-installation-and-usage)**
  - **[Local Installation and Usage](#local-installation-and-usage)**
  - **[Global Installation and Usage](#global-installation-and-usage)**
- **[Example output](#-example-output)**
- **[Configuration](#-configuration)**
- **[Docs](#-docs)**

## 📟 Installation and Usage

There are two ways to install HTMLHint: globally and locally.

### Local Installation and Usage

In case you want to include HTMLHint as part of your project, you can install it locally using npm:

```bash
npm install htmlhint --save-dev
```

After that, You can run HTMLHint on any file or directory like this:

```bash
./node_modules/.bin/htmlhint www/index.html
./node_modules/.bin/htmlhint www/**/*.html
```

Or, you can use HTMLHint linter programmatically, like this:

```js
import { HTMLHint } from 'htmlhint'
const htmlVerificationHints = HTMLHint.verify(localHtmlContent)
console.log('htmlVerificationHints', htmlVerificationHints) // this logs a list of `Hint`s which contain information on all linting errors
```

### Global Installation and Usage

If you want to make HTMLHint available to tools that run across all of your projects, you can install HTMLHint globally using npm:

```bash
npm install htmlhint -g
```

After that, you can run HTMLHint on any file like this:

```bash
htmlhint www/index.html
htmlhint www/**/*.html
```

You can even launch HTMLHint to analyze an URL:

```bash
htmlhint https://htmlhint.com/
```

## 📃 Example output

## 🔧 Configuration

Search `.htmlhintrc` file in current directory and all parent directories:

```bash
htmlhint
htmlhint test.html
```

Custom config file:

```bash
htmlhint --config htmlhint.conf test.html
```

Custom rules:

```bash
htmlhint --rules tag-pair,id-class-value=underline index.html
```

Inline rules in `test.html`:

```html
<!--htmlhint tag-pair,id-class-value:underline -->
<html>
  <head>
    ...
  </head>
</html>
```

## 📙 Docs

1. [How to use](https://htmlhint.com/getting-started/)
2. [All Rules](https://htmlhint.com/rules/)
3. [Changelog](https://htmlhint.com/changelog/)
4. [How to Develop](/.github/CONTRIBUTING.md)

## © License

[MIT License](./LICENSE.md)

## 💪🏻 Contributors

This project exists thanks to all these people. [Contribute](/.github/CONTRIBUTING.md).
<a href="https://github.com/htmlhint/HTMLHint/graphs/contributors"><img src="https://opencollective.com/htmlhint/contributors.svg?width=890" alt="HTMLHint Contributors" /></a>

## 🏅 Backers

Thank you to all our backers! [Become a backer](https://opencollective.com/htmlhint#backer).

<a href="https://opencollective.com/htmlhint#backers" target="_blank"><img src="https://opencollective.com/htmlhint/backers.svg?width=890" alt="Backers"></a>

## 🎖 Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor](https://opencollective.com/htmlhint#sponsor).

<a href="https://opencollective.com/htmlhint/sponsor/0/website" target="_blank"><img src="https://opencollective.com/htmlhint/sponsor/0/avatar.svg" alt="Sponsor"></a>

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