HTML Minifier
Compress pasted HTML snippets or local .html files in your browser with conservative options that preserve script, style, and whitespace-sensitive content by default.
Click to choose an HTML file or drop it here
You can also paste HTML directly into the editor below.
0 bytes
0 bytes
Conservative defaults
The default preset removes ordinary whitespace and comments but keeps inline JavaScript, CSS, quotes, and whitespace-sensitive elements intact.
Snippet and file input
Paste partial HTML, full documents, malformed snippets, or load a local .html file before copying or downloading compressed output.
Size comparison
Compare original and minified byte counts before deciding whether the compressed HTML is worth using in your workflow.
Frequently Asked Questions
Is my HTML uploaded to Convertr?
No. The minifier runs locally with browser JavaScript. Pasted HTML and selected files are not sent to Convertr servers.
Why preserve script and style content by default?
Embedded JavaScript and CSS can be sensitive to rewriting. This tool focuses on HTML compression, so separate CSS and JS minifiers can be added later if needed.
When should I avoid removing optional tags?
Keep optional tags when comparing source, debugging unusual markup, or working with tools that expect explicit closing tags.
Related developer tools
HTML Minifier
Reduce pasted HTML by removing selected comments and unnecessary whitespace.
- Input
- HTML source and explicit minification options.
- Output
- Minified HTML plus size comparison.
- Real limitations
- Minification is not sanitization or validation; whitespace-sensitive elements, templates, inline scripts, and malformed markup require review.
- Privacy and data handling
- HTML source and explicit minification options is processed in this browser tab. Convertr does not receive or store it; closing or reloading the page clears the working state unless the tool explicitly offers a local download.
How to use this tool
- Provide HTML source and explicit minification options in the tool controls.
- Choose the settings that affect minified HTML plus size comparison, then run the tool.
- Review minified HTML plus size comparison before copying or downloading it.
Common failure modes
Broken markup, an unterminated comment, or aggressive settings around preformatted content can make the result unsuitable.
Useful example
Minify a formatted article fragment while preserving whitespace inside its pre element.