Anchor Text Analyzer
See the anchor text profile of a page, grouped and ranked.
Remove comments and whitespace without breaking your code.
The JavaScript Minifier removes comments and the whitespace that provably cannot change meaning, tokenising strings, template literals and regular expressions properly rather than pattern-matching them. It will not collapse the file onto one line, because a line break in JavaScript can be doing a semicolon's job and no amount of whitespace cleverness knows which ones are.
Paste JavaScript and the minifier removes comments and the whitespace that provably cannot change meaning. Strings, template literals and regular expressions are tokenised properly rather than pattern-matched, so nothing inside them is touched.
It will not collapse your file onto one line, and that is deliberate. JavaScript inserts semicolons at line breaks under rules that depend on what is on either side, so `a` newline `(b)` and `a(b)` are two different programs. This minifier only removes a line break after a character that cannot end a statement, which makes the transformation safe by construction rather than safe in testing. What it does not do is rename variables, remove dead code or restructure anything — a real compressor like Terser does all three and will beat this comfortably. This is for the case where you want a smaller file you can still read the diff of.
Strings, templates with nested interpolation and regex literals are recognised, not guessed at.
A slash is read in context, so a regular expression is never mistaken for a division sign.
A line break is only removed after a character that cannot end a statement.
a + +b never becomes a ++b, which is the classic whitespace-minifier bug.
It says plainly that Terser will beat it, and what Terser does that this does not.
A file or a fragment. It stays in your browser.
Before and after sizes with the percentage and a gzipped estimate.
Line breaks that were doing a semicolon's job are kept, so the result is still readable.
Take the result into your page or your build step.
It is built not to. Strings, templates and regular expressions are tokenised rather than pattern-matched, and a line break is only removed after a character that cannot end a statement — which is exactly the rule automatic semicolon insertion turns on. That said, always test the output before shipping it.
Because putting it on one line is not safe. JavaScript inserts semicolons at some line breaks and not others, depending on what is on either side, so removing every break changes what some programs do. A minifier that produces one line does it by parsing the whole program first.
They will beat it, considerably. They parse the code into a syntax tree, rename local variables, drop unreachable branches and restructure expressions. This removes comments and whitespace. Use a real compressor in a build step; use this when you want a quick, reviewable reduction.
Yes for anything expressed in ordinary tokens — arrow functions, classes, optional chaining, template literals with nested interpolation. It is a tokeniser rather than a parser, so it does not need to understand your syntax, only to recognise where strings and regexes begin and end.
What people who use the JavaScript Minifier think of it. Reviews come from visitors and are posted as written.
No ratings yet
Yours would be the first.
0 reviews
Newest first
No reviews yet
Be the first to rate the JavaScript Minifier. It takes half a minute and no account.
Write the first reviewSee the anchor text profile of a page, grouped and ranked.
Deduplicate, trim and tidy a messy keyword export.
Turn a topic into dozens of workable title options.
Turn a list of questions into valid FAQPage JSON-LD.
Build robots and X-Robots-Tag directives without guessing the syntax.
Find every image with no alt text, or bad alt text.
Write a valid ads.txt so your ad inventory is not spoofed.
Price, stock, rating and reviews as product rich snippet markup.