HTML / CSS / JS Minifier
Strip whitespace and comments from HTML, CSS, or JavaScript — see the size saved and copy the result.
<!doctype html><html lang="en"><head><title>Sample Page</title></head><body><h1>Hello, world!</h1><p>This is a paragraph with multiple lines.</p></body></html>
How to use
- Paste your source code.
- Pick the language (HTML / CSS / JS).
- Toggle whether to strip comments.
- Copy the minified output.
About this tool
ShowHide
Shrink HTML, CSS or JavaScript by stripping comments and squeezing out the whitespace a build step would normally remove, with the before and after sizes and the saving shown so you can see whether it was worth it. It is a text-level squeezer rather than a parser, and that shapes what it is good for. Whitespace is collapsed everywhere, including inside pre and textarea elements where spacing is meaningful, so run it on markup without those or restore them afterwards. On JavaScript it only removes comments and spacing — no renaming, no dead-code removal — which makes it handy for an inline snippet or an email template but no substitute for a real bundler on production code. Everything runs locally in your browser.
Frequently asked questions
Is this safe for production?
For small CSS or HTML, yes — the rules are conservative. For JavaScript, prefer a tool like terser or esbuild in your build, since this tool doesn't rename variables, fold constants, or do dead-code elimination.
Why isn't my JS more compressed?
True JS compression needs an AST-based tool. This minifier removes whitespace and comments only — that's already a big win for hand-written snippets but won't match terser's output.
Will it break HTML inside <pre> or <textarea>?
It can — whitespace there is significant. Avoid running the minifier on HTML containing those elements, or replace their contents with a placeholder first.
Are CSS comments important?
Sometimes — license headers in /*! comments by convention are kept by professional minifiers. This tool removes all comments if 'strip comments' is on; for license-preserving output, set it off.
Related tools
SVG Optimizer
Shrink an SVG with SVGO — strip editor cruft, round coordinates, merge shapes — and see before and after side by side. Nothing is uploaded.
Image
Image Compressor
Compress and resize JPEG, PNG, and WebP images in your browser.
Image
PDF Compressor
Shrink a PDF by re-encoding the images inside it. Text stays selectable and searchable. Nothing is uploaded.
File
Video Compressor & Trimmer
Make a video smaller, cut out a clip or remove its sound, right in your browser: pick a resolution, a quality or a target file size. Nothing is uploaded.
Image
CSS to JS Style Object Converter
Convert a CSS declaration block into a React/JS inline style object, in your browser.
Developer
CSS Selector Tester
Test a CSS selector against your HTML and see exactly which elements it matches, in your browser.
Developer