Code & Data
Minify JavaScript, with the semicolons it needs
Paste JavaScript and get it back without the comments and indentation. The careful part is the semicolons — a newline in JavaScript is sometimes a statement terminator, and removing it silently changes the program.
Paste JavaScript above and the result appears here.
- Runs in your browser
- No account required
- Free to use
How it works
A newline is sometimes a semicolon
Automatic semicolon insertion means `let a = 1` on one line and `let b = 2` on the next are two statements with nothing written between them. Join those lines and you get a syntax error, or worse, something that parses and means something else. So every line break is examined, and where one was doing the work of a semicolon, a real one is written.
And sometimes it is not
The dangerous case is the opposite one. `if (a)` followed by a newline is not the end of a statement — putting a semicolon there gives you `if(a);b()`, which runs perfectly and never executes the branch. Every parenthesis is classified as a control head or a call before anything is joined, precisely so that does not happen.
Restricted productions are respected
`return` on a line of its own returns undefined, whatever is written underneath it. That is a real behaviour some code depends on and much more code trips over, and either way the minifier has to preserve it rather than helpfully closing the gap.
What it does
It says how many it added
The count of semicolons written where a line break used to be. A high number on your own code is a hint that it relies on automatic insertion more than you thought.
Operators cannot fuse
`a + +b` closed up to `a++b` is a different program. Two operators that would form a third are kept apart.
Before and after, in bytes
Measured as UTF-8, which is what actually travels, rather than as a character count.
Runs in your browser
No account and no upload — what you type is never sent anywhere. Analytics records that the tool was opened, never what you put into it.
Practical advice
Getting a better result
- This is whitespace and comments only. It does not rename variables, fold constants or remove unreachable code — expect a fraction of what esbuild or Terser achieve in a build step.
- Most of the win on unminified source is the indentation and the comments, so the saving is still real. On code that has already been through a compressor there is nothing left to take.
- Serve it compressed as well. Gzip or Brotli on the server does far more for transfer size than minification does, and the two stack.
- Keep the readable version. Minified code with no source map is a file nobody can debug, and you will need to at some point.
- A licence comment you are obliged to keep will be removed along with the rest — put it back by hand, or keep that file out of this tool.
Questions
Things people ask
How much smaller will my file get?
On ordinary, well-commented source, often a third to a half. On code that has already been minified, almost nothing. The panel shows the real figure for your file rather than a claim.
Is it safe to use on production code?
It is careful about the cases that matter — semicolon insertion, control heads, restricted productions — and every one of those is covered by tests that run the minified output and compare the result. But it is a tokenizer, not a parser, so test the output before you ship it, as you would with any build step.
Why does it not rename my variables?
Renaming safely requires knowing every scope in the file and every place a name could be reached by something outside it — `eval`, `with`, a global, a property access built from a string. Guessing at that is how a minifier silently breaks an application, so this one does not try.
Will it break my code?
The known hazards are handled and tested. The honest answer is that any transformation of source can be wrong on input nobody anticipated, which is why the readable original is worth keeping and the output is worth testing.
Related tools
JSON Formatter
Format and minify JSON, with errors that name the line.
Runs entirely in your browser
Open toolJSON Validator
Check JSON and get the line, column and cause of any error.
Runs entirely in your browser
Open toolJSON Viewer
Explore JSON as a collapsible tree instead of scrolling it.
Runs entirely in your browser
Open toolJSON to CSV
Turn an array of objects into a spreadsheet-ready CSV.
Runs entirely in your browser
Open toolWho builds these
Free tools by day. Websites that earn their keep by trade.
KuConvert is built by KUDUY, a web design and development agency. From custom WordPress builds to SEO and e-commerce, everything they do is engineered to bring you more qualified traffic and turn it into revenue.
Web Design
Custom, conversion-focused web design that captivates visitors and turns them into paying customers. Mobile-first, fast, and built to rank.
Web Development
Custom WordPress websites built with clean code, blazing-fast performance (Core Web Vitals optimised), and enterprise-grade security.
E-Commerce
Online stores that convert visitors to customers with seamless shopping experiences.
SEO
Technical SEO, keyword research, on-page optimisation and local SEO strategies that drive qualified organic traffic.
Digital Marketing
Data-driven campaigns that deliver measurable ROI across every channel.
Branding
Memorable brand identities that stand out in any market and build lasting trust.
Website Help
One-on-one expert support for bug fixes, updates and ongoing maintenance — without a long-term retainer.
Fixed scope, no surprise invoices
Most sites ship in four to eight weeks with the scope and the price agreed up front.
SEO from day one
Search is designed into the build — structure, schema and Core Web Vitals — not retrofitted.
A team, not a ticket queue
A project manager, a designer and a developer you can actually reach.
Need your whole site to load this fast?
Images are usually the heaviest thing on a page and the easiest win. KUDUY works on site speed, image delivery and Core Web Vitals for teams who would rather not do it by hand.
This tool runs entirely in your browser. Your files are never uploaded.