About Code Minifier
Code Minifier strips redundant characters β whitespace, comments, unnecessary tokens β from HTML, CSS, and JavaScript to reduce file size. Smaller files load faster, use less bandwidth, and often improve Lighthouse / PageSpeed scores. Three languages are handled with language-specific rules so the output stays syntactically valid.
Everything runs client-side. Your source code is never uploaded β safe for confidential markup, internal stylesheets, or scripts under NDA. Paste, click Minify, copy the result.
Basic minification only. This tool performs safe, universal transformations (strip comments, collapse whitespace). For maximum compression, use a build-time tool like terser (JS), cssnano (CSS), or html-minifier-terser (HTML) which perform advanced tree-shaking and identifier mangling.
How to use
Pick a language
HTML, CSS, or JavaScript β each has its own minification rules.
Paste your code
Or click "Load sample" to try it with example code.
Click Minify
The output panel shows the compact result plus the size savings badge.
Copy or download
Paste into your codebase, or download as a file with the right extension.
Key Features
Language-specific minifiers
HTML: strips comments, collapses inter-tag whitespace, preserves content inside <pre>, <textarea>, <script>, <style>, and <code> tags. CSS: strips /* */ comments, collapses whitespace, tightens around braces, colons, semicolons, and commas. JavaScript: strips // and /* */ comments (string- and regex-safe), collapses whitespace.
Toggle options for HTML
Strip comments β remove all HTML comments. Keep IE conditionals β preserve <!--[if IE]>...<![endif]--> for legacy sites. Preserve newlines β keep line breaks between tags (still safe, slightly larger output).
Live savings badge
See exactly how many bytes and what percentage you saved. Small savings on a single file compound across a whole site.
Copy + Download with correct extension
Copy to clipboard, or download as .html / .css / .js based on the active tab.
Common Use Cases
- Quick minification of email templates before sending
- Compressing inline CSS/JS in a CMS entry
- Shrinking a static HTML file for a landing page test
- Reducing size of legacy scripts that skip a build step
- Cleaning up handwritten CSS before pasting into a stylesheet
- Testing how minification affects a specific snippet before adding to production
- One-off compression for A/B test variants
- Comparing source vs minified size for a Lighthouse report
Security & Privacy
- 100% client-side: minification runs in your browser. No source ever leaves your device.
- Works offline: once the page loads, disconnect and it still works.
- No account, no logging: use freely for confidential or NDA-covered code.
- Basic rules only: the transformations here are conservative β they never mangle identifiers, dead-code eliminate, or reorder anything. What comes out is functionally identical to what went in.