What This Minifier Does and Deliberately Avoids
Minification has two very different levels. The first removes what the parser ignores anyway: comments, indentation and whitespace that carries no meaning. The second rewrites the program itself by renaming variables, inlining functions and deleting unreachable branches. This tool does only the first, because that is the part that is safe to run on a paste with no build configuration and no knowledge of how the code is loaded. In CSS it also shortens zero lengths and leading zeros, drops the final semicolon in a block, and leaves the inside of every string untouched. In JavaScript it keeps line breaks, since removing one can silently change behaviour through automatic semicolon insertion, most famously after a bare return. In HTML it leaves pre, textarea, script and style content exactly as written, because whitespace there is significant.
How to Minify Code
- 1Paste your code or open a file; the language is detected from the content unless you pick a tab yourself.
- 2Check the before and after sizes to see how much of the file was comments and formatting.
- 3Read the output to confirm nothing you rely on was removed, particularly licence banners and conditional comments, which are kept.
- 4Copy the result or download it as a .min file ready to serve.
- 5For production JavaScript, run the result through your bundler's minifier as well to get identifier renaming and dead-code removal.
When a Quick Minify Helps
Trim an inline snippet
Shrink a small stylesheet or script that is pasted into a template, an email, or a CMS field where no build step exists.
Find out how much is comments
Compare the original and minified byte counts to see whether a large file is really large or mostly documentation and formatting.
Fit inside a size limit
Get a widget, a tag manager snippet, or a serverless inline script under a character or byte cap without changing what it does.
Prepare a reproduction
Strip comments and formatting noise from a sample before attaching it to a bug report, while keeping the logic intact and readable.
Frequently asked questions
Why are line breaks kept in JavaScript?
Because removing one can change what the program does. A return followed by a newline returns undefined; join those lines and it suddenly returns the next expression. The same hazard applies to break, continue, throw and postfix increment. A full minifier parses the whole program and can prove when a newline is removable; a whitespace-level tool cannot, so it keeps them.
Will this break my CSS if it contains content strings or url() values?
No. Strings are set aside before any whitespace rule runs and restored afterwards, so spaces and combinator characters inside content: " a > b " survive exactly as written. The same protection covers font names and data URIs.
Are licence comments removed?
No. A block comment starting with /*! is kept in both CSS and JavaScript, which is the convention minifiers use for preserving copyright and licence notices. HTML conditional comments beginning with <!--[if are kept too, because they still control rendering in legacy engines.
How does this compare to esbuild, Terser or cssnano?
Those parse code into a syntax tree and can rename identifiers, fold constants and remove unreachable branches, which typically saves far more. They are the right choice inside a build. This tool is for the cases where there is no build: a single paste, no install, no configuration, and nothing sent to a server.
Is my code uploaded anywhere?
No. The minifier is written in the page and runs entirely on your device, so it works offline and neither the source nor the result leaves your browser.