Skip to content
Allin

JavaScript Minifier / Beautifier

Minify or beautify JavaScript in your browser, with a tokenizer that respects strings, regex and comments.

JavaScript Minifier / Beautifier is free to use as often as you like, directly from this page. You will find it under JSON, XML & formats, with CSS Beautifier and HTML Beautifier for the neighbouring cases.

How to use it

  1. Open the tool — no signup or install needed.
  2. Enter your input or adjust the available options.
  3. Get your result instantly, then copy or download it.

Frequently asked questions

What is JavaScript Minifier / Beautifier?

Minify or beautify JavaScript in your browser, with a tokenizer that respects strings, regex and comments.

When would I actually use this?

Making a machine-generated blob readable, finding the character where a parse fails, and shrinking a file before it ships.

What is the most common mistake?

Assuming valid means correct. A document can parse cleanly and still have the wrong shape for whatever will read it — validation checks the syntax, not the schema.

How is JavaScript Minifier / Beautifier different from CSS Beautifier?

They sit next to each other but answer different questions: CSS Beautifier is the one to open when you need it to reformat minified or messy CSS into clean, properly indented rules — or minify it back. Pick whichever matches what you're starting from — both are free.

Is there a tool for the next step?

HTML Beautifier is the closest one after this: Turn minified or tangled HTML into cleanly indented, readable markup — or minify it.

What else is worth having open alongside it?

CSS minifier and Is JavaScript enabled? — they come up in the same task often enough to be worth a second tab.

Where do the figures come from?

Parsing and serialisation follow each format's specification. Key order and whitespace are not semantically meaningful in JSON or YAML, so a reformatted document is equivalent even when the bytes differ.

Further reading

All guides
GuideWhat a Minifier Can Remove, and What It Must NotMinification has to preserve meaning, and the interesting part is the whitespace that carries meaning: the descendant combinator, the spaces inside calc(), the gap between two inline elements. Measured here on real files, including how much brotli was going to save you anyway.GuideBeautify or Minify: What Each Is For, and What It Does to the WeightFour real stylesheets run through the minifier, measured raw and after gzip. Stripping every space saved 48, 103, 104 and 147 compressed bytes; stripping comments saved 57, 1 358, 2 420 and 1 042. Plus the five inputs this minifier breaks.How-toBuilding a Markdown Table From Scratch, Without Counting Dashes by HandThe smallest thing that is still a table is two lines: a header row and a delimiter row. Here is why the second one is mandatory in GitHub Flavored Markdown, where pipe tables do not exist at all, and what a generator does that hand-typing cannot.GuidePasting a Table Into a Pull Request: What Breaks, and the Two Characters That Break ItA Markdown table has exactly two forbidden characters in a cell: the pipe and the line break. Here is what each one does, how a converter handles them, why the escape has to be applied in the right order, and why padding never matters.ExplainerXML to JSON: Attributes, Repetition, and the Single-Element Array TrapTwo documents that differ only in how many children exist produce two different JSON shapes, and no converter can tell them apart without a schema. Plus what this one really does with attributes, mixed content and whitespace — and the one thing it still cannot record.ExplainerYAML Looks Friendly and BitesYAML is JSON plus a type-inference layer, and the inference is the dangerous part. The same file run through a YAML 1.2 parser and a YAML 1.1 parser: no is a string in one and false in the other, 01234 is 1234 in one and 668 in the other, and 12:30:00 is a number in one of them.