HTML Minifier
web.minify_html
Overview
You send an HTML document and we return a smaller version by collapsing removable whitespace and stripping comments (plus optional conservative markup cleanups when you enable them). Content inside pre, textarea, script, and style stays byte-stable — we never minify or parse JavaScript. This is not a sanitizer: dangerous markup you send in, including script payloads, comes back out. Use web.sanitize_html when you need XSS-safe HTML.
You want smaller markup without a minifier quietly rewriting a script block or being mistaken for a safety check it never performed.
Reliability
Same document and same options give the same bytes for as long as the HTML engine stays on the build named in _meta.parserProfile; an engine upgrade can shift the output slightly, so compare against that value rather than assuming byte stability forever. Nothing leaves the platform, and content inside pre, textarea, script, and style is copied through untouched, as is anything under a white-space:pre style. Two things surprise people: a small fragment can come back larger, because we return a complete document, and savedBytes then reports 0; and we are not a safety pass, so a script payload you send in comes straight back out. Three failures stop the call. HTML_PARSE_FAILED — the document could not be read at all, which is worth one retry after you check it really is HTML rather than another format; HTML_DEPTH_LIMIT_EXCEEDED — elements nest deeper than 256 levels, so flatten the markup or split the document, since retrying it unchanged fails again; HTML_OUTPUT_TOO_LARGE — the result would pass 2097152 bytes, which happens when a nearly full-size input grows during serialisation, so minify the page in sections instead.
Context footprint
The whole minified document comes back inline, so expect a reply about the size of the page itself, up to roughly two megabytes. A successful call costs 2 execution credits.
When to use it
When you hold markup you already trust and want it smaller but rendering the same.
When the markup came from somewhere you do not trust, or when what you really want compressed is the JavaScript or CSS.
Runs on jsoup's HTML parser and serializer, with the whitespace rules applied on top.
Scope
Non-goals
- Does not minify or even parse the JavaScript inside script elements
- Does not minify CSS beyond collapsing its whitespace when you ask
- Does not make markup safe — web.sanitize_html is the skill for that
- Does not reorder attributes or restructure the document
- Does not render the page or load anything it links to
- Does not claim the smallest possible output
Properties
Capabilities
Cost & billing
Flat rate per invocation
File handling
How we handle your data
What this means
This skill may receive sensitive content and may return submitted, transformed, extracted, or reformatted content.
Squillify guarantees
- Runs inside Squillify
- This skill runs inside Squillify.
- Payloads are not sent to an external service by this skill.
- Squillify does not permanently store submitted payloads.
- Telemetry records metadata only, not submitted content.
- Submitted payloads are not used for training.
- Submitted payloads are not reviewed by humans.
- This skill does not target sensitive data.
- The response may contain submitted or transformed content.
Your responsibility
Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| html | string | Yes | HTML source to minify without executing scripts. |
| options | object | No | Purpose-bound bounded minification option object; omit it to use all safe defaults. It contains from 0 through 256 purpose-bound properties — unconstrained RFC 8259 JSON items. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| html | string | Yes | Minified HTML preserving configured semantics. |
| inputBytes | integer | Yes | Original UTF-8 byte count. |
| outputBytes | integer | Yes | Returned UTF-8 byte count. |
| savedBytes | integer | Yes | Removed UTF-8 byte count. |
| savedPercent | number | Yes | Percentage of bytes removed. |
| transformations | array | Yes | Bounded array of applied transformation names in deterministic order. The item shape is defined by the nested schema and the array contains from 0 through 64 items. |
| findings | array | Yes | Bounded array of minification findings. The item shape is defined by the nested schema and the array contains from 0 through 20000 items. |
| _meta | object | Yes | Closed minifier metadata receipt with parser and option details. Its documented web receipt properties are bounded to 128 entries — unconstrained RFC 8259 JSON items. |
API contract
POST /v1/executecurl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"web.minify_html","input":{"html":"<p>Hi</p>"}}'import { Squillify } from "@squillify/sdk";
const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });
const { output } = await sq.execute("web.minify_html", {"html":"<html>\n <body>\n <!-- comment -->\n <p>Hello world</p>\n </body>\n</html>"});Errors
| Code | HTTP | Retryable | Description |
|---|---|---|---|
| VALIDATION_ERROR | 400 | No | The request payload failed schema validation. |
| UNAUTHORIZED | 401 | No | Missing or invalid API key. |
| SKILL_NOT_ACCESSIBLE | 403 | No | The API key is not granted access to this skill. |
| SKILL_NOT_AVAILABLE_FOR_PLAN | 403 | No | This skill is not included in your current plan. |
| PLAN_ELIGIBILITY_UNAVAILABLE | 503 | Yes | Plan eligibility could not be decided. Retry after backoff. |
| SKILL_NOT_FOUND | 404 | No | The requested skill or version does not exist. |
| TENANT_RATE_LIMITED | 429 | Yes | Request rate limit exceeded. Retry after backoff. |
| QUOTA_EXCEEDED | 429 | Yes | Plan quota exhausted. Retryable once the quota period resets. |
| EXECUTION_TIMEOUT | 504 | Yes | Execution exceeded the allowed time budget. |
| HTML_PARSE_FAILED | 400 | No | The request payload failed this skill's input validation. |
| HTML_DEPTH_LIMIT_EXCEEDED | 429 | No | A size, quota, rate, or time limit was exceeded. |
| HTML_OUTPUT_TOO_LARGE | 429 | No | A size, quota, rate, or time limit was exceeded. |
Other limits
| Limit | Value |
|---|---|
| Recommended inline bytes | 32 KiB |
Limitations
- Does not minify or even parse the JavaScript inside script elements
- Does not minify CSS beyond collapsing its whitespace when you ask
- Does not make markup safe — web.sanitize_html is the skill for that
- Does not reorder attributes or restructure the document
- Does not render the page or load anything it links to
- Does not claim the smallest possible output
- Making untrusted markup safe to display, which web.sanitize_html handles
- Bundling or compressing JavaScript and CSS
How to call
POST /v1/execute (requires authentication)
{
"skillKey": "web.minify_html",
"input": {
"html": "<html>\n <body>\n <!-- comment -->\n <p>Hello world</p>\n </body>\n</html>"
}
}Examples
Marketing landing page snippet — comment stripped and whitespace collapsed
{
"html": "<html>\n <body>\n <!-- comment -->\n <p>Hello world</p>\n </body>\n</html>"
}{
"outputBytes": 57,
"html": "<html><head></head><body><p>Hello world</p></body></html>",
"transformations": [
"REMOVE_COMMENTS",
"COLLAPSE_WHITESPACE"
],
"findings": [],
"savedPercent": 27.85,
"inputBytes": 79,
"savedBytes": 22,
"_meta": {
"parserProfile": "jsoup-1.18.3",
"preservedRegions": 0
}
}Inline script preserved byte-for-byte while surrounding markup shrinks
{
"html": "<html><body><script>var x = 1;</script><p>Hi</p></body></html>"
}{
"outputBytes": 75,
"html": "<html><head></head><body><script>var x = 1;</script><p>Hi</p></body></html>",
"transformations": [
"COLLAPSE_WHITESPACE"
],
"findings": [],
"savedPercent": 0,
"inputBytes": 62,
"savedBytes": 0,
"_meta": {
"parserProfile": "jsoup-1.18.3",
"preservedRegions": 1
}
}Recommended use cases
- Shrink HTML templates before you ship or store them
- Strip authoring whitespace and build comments out of a static page
- Measure how much a page would gain from minification
Avoid for
- Making untrusted markup safe to display, which web.sanitize_html handles
- Bundling or compressing JavaScript and CSS
Related skills
Composable with
Safety & privacy
- Runs without calling any external service.
- Your payloads are never stored permanently.
- Telemetry captures metadata only — never your payload contents.
- We never train models on your payloads.
- No human reviews your payloads.