ToolsYard

Code Minifier

Choose a language, then paste code below — the minified result updates as you type.

What this tool does

This tool strips comments and collapses unnecessary whitespace from CSS, JavaScript, or HTML, reducing file size without changing behavior. It's a conservative minifier — it doesn't rename variables, remove dead code, or restructure logic the way a build-tool minifier like Terser does, but it safely removes the whitespace and comments that make hand-written code readable but aren't needed for it to run. Everything happens locally in your browser.

Example use case

Pasting a small CSS or JavaScript snippet into an inline <style> or <script> tag, a browser bookmarklet, or anywhere else with a size constraint, without setting up a full build pipeline just to strip whitespace.

Note on correctness

String literals, template literals, and regular expressions in JavaScript are left untouched so quotes and escape sequences inside them are never altered. For HTML, the contents of <pre>, <textarea>, <script>, and <style> tags are preserved as-is — use the CSS or JavaScript tab separately to minify embedded code blocks.