Sanitize HTML
AI / AgentStrip HTML tags, scripts, styles, and event handlers to produce clean text for LLM ingestion.
Raw HTML scraped from a webpage is full of noise an LLM doesn't need (scripts, styles, tags), and this strips it down to clean plain text using DOM parsing, preserving basic structural breaks like paragraph boundaries while discarding styling and most semantic structure, since the goal is clean text rather than formatted output. It's a good fit for email HTML exports headed into a search index or embedding pipeline. Despite what it removes overlapping with an XSS concern, treat this as a convenience tool for LLM ingestion rather than a hardened security sanitizer. For actual XSS protection on user-generated content, use a maintained library like DOMPurify with a strict allowlist instead. It runs entirely client-side, though very large HTML documents can be slow in the browser and are better handled via the REST API or SDK.
How to use Sanitize HTML
- 1.Paste raw HTML scraped from a webpage to strip tags, scripts, and styles down to clean plain text before feeding it to an LLM.
- 2.Use it to remove event handlers (`onclick`, etc.) and inline scripts from untrusted HTML before displaying it anywhere.
- 3.Run it on email HTML exports to get readable plain text for indexing, search, or embedding pipelines.
Frequently asked questions
Use via API, SDK, or MCP
cURL# Free: 1,000 req/day · Pro: 10,000 req/day
curl -X POST https://api.utilix.tech/v1/tools/sanitize-html \
-H "Authorization: Bearer utx_live_..." \
-H "Content-Type: application/json" \
-d '{"html":"<p>Hello</p><script>alert(1)</script>","keepLinks":false}'Get an API key from your dashboard · Full API docs →