Tool

HTML Cleaner & Token Saver

Strip scripts, ads, and CMS chrome from exported HTML in the browser, keep code blocks intact, and see the estimated token savings.

100% client-side: Your files never leave your browser.

Cleaning options
0 B

Need to translate this static HTML file? Open HTML Translator →

0 B
Reference

Clean an export before a model sees it

A CMS export often wraps a short article in scripts, style blocks, share bars, and ad slots, wasting context when pasted into an LLM prompt, RAG index, or migration workflow. Cleaning static HTML in the browser drops that noise while keeping headings, paragraphs, link text, alt text, and byte-for-byte code samples intact.

What each preset removes

Safe Clean strips technical tags and empty wrappers. CMS & Blog Clean adds widget removal, lazy-load image promotion, tracking removal, and stray Markdown bold repair. Aggressive LLM Prep also strips presentational attributes while keeping semantic, table, link, and language-* attributes.

BehaviorSafe CleanCMS & Blog CleanAggressive LLM Prep
Scripts, styles, noscript, template, and commentsStrippedStrippedStripped
IframesKeptStrippedStripped
Empty p, div, and span tagsStrippedStrippedStripped
Outer markdown html fencesStrippedStrippedStripped
Ad, share, TOC, and newsletter widgetsKeptStrippedStripped
Lazy-load src and tracking parametersLeft as exportedPromoted and strippedPromoted and stripped
Image attributesKeptKeptsrc, alt, title, width, height only
style, id, class, and data attributesKeptKeptStripped, language-* class kept
Stray Markdown bold in paragraphsKeptConverted to strongConverted to strong
pre, code, kbd, and textareaByte-for-byteByte-for-byteByte-for-byte
Fragment unwrapOff until toggledOff until toggledOff until toggled

Why code is copied out before cleanup

Blank-line collapsing and Markdown repair can corrupt a sample. A Python line such as x = 2 ** 3 looks like bold markers, and a SQL sample loses its indent when blank lines are flattened. Each pre, code, kbd, and textarea region is copied out before that work. An outer pre that contains code is one block, so the inner tags are not rewritten alone. Newlines, tabs, spaces, entities, and asterisks are written back unchanged. A paragraph may still turn asterisks around a word into a strong element. The same asterisks inside a code span stay an expression.

FAQ

How are lazy-load images recovered?

Themes often leave an SVG or blank.gif in src and store the real URL in data-src, data-orig-file, data-full, data-lazy-src, or data-img-url. CMS and Aggressive modes promote the first non-empty lazy URL into src while leaving real base64 images intact and stripping utm_*, fbclid, gclid, mc_cid, and mc_eid.

How accurate is the token estimate?

The badge divides character count by four and rounds up as a rough English subword estimate. Use the percentage saved to compare before and after, not as a provider quote.

Why does the visual preview use an empty sandbox?

The preview iframe uses an empty sandbox attribute so scripts, forms, and popups cannot run. Scripts, iframes, objects, embeds, refresh metas, inline on* handlers, and javascript: URLs are also stripped before rendering.

Should static HTML be cleaned before translation?

Yes when an export carries theme chrome, ads, or inline scripts. Trimming noise keeps the document focused on visible text and stable tags before opening the translator.

Does cleaning upload the file?

No. Everything runs locally in the browser, files stay on the computer, and input over 2 MB is refused.

Read how to translate HTML without breaking layout, how to extract translatable strings from HTML to JSON, and how a Python script can prepare HTML files. Check block comments with the Gutenberg markup checker, then open the HTML translator. More utilities sit in the tools hub. For a published page, start from the HTML Translate home page only after the export is static HTML.