# HTML minifier

Shrink HTML by removing comments and needless white space, without touching pre, textarea, script or style.

- Endpoint: `POST https://setget.net/v1/tools/html-minify` with JSON `{"input": {...}}`
- MCP: `run_tool` with `slug` = `html-minify`
- Page: https://setget.net/tools/html-minify

## Inputs

- `text` (required, string): The HTML to minify.
- `keep_comments` (optional, boolean, default `false`): Keep ordinary comments. Conditional comments are always kept.

## Example

```json
{"input":{"text":"<div>\n  <p> Hello   <b>world</b> </p>\n  <!-- note -->\n  <pre> a  b </pre>\n</div>"}}
```

Result:

```json
{"text":"<div><p>Hello <b>world</b></p><pre> a  b </pre></div>","bytes_before":80,"bytes_after":53,"saved":27,"saved_percent":33.8}
```

**Is a space between two words ever removed?** No. Runs of white space are collapsed to one space, and removed completely only next to block-level tags such as div or p, where browsers ignore them anyway.

**Are inline scripts and styles minified?** No. Their content is copied exactly. Use the CSS minifier for style sheets.
