JavaScript beautifier and minifier
Format or compact JavaScript source locally, with copy and file download.
A clear answer. Here’s how.
Formats JavaScript with Prettier’s Babel parser. Minification uses Terser with compression and name mangling disabled, so it removes formatting without optimizing expressions or renaming variables; license comments are retained. Choose script or module parsing for minification. Does not execute source, resolve imports or support TypeScript/JSX minification. Up to 200,000 characters.
How this is checked
2 reference checks passed These 2 cases were run when this page was built, on 3 December 2026, and all reproduce within the stated tolerance. The same cases are part of the automated tests that run on every change to Toolmoz. Engine version 1.
See the checks and where each expected answer comes from
Case 1
- Inputs
- Source const x = 1;Output minify
- Expected, and what Toolmoz gave
- text expected const x=1;, Toolmoz const x=1;
- Where the expected answer comes from
- Token-preserving compaction of const, x, =, 1 and ; requires a space only between const and x.
- Allowed difference
- exact
Case 2
- Inputs
- Source console.log("a b");Output minify
- Expected, and what Toolmoz gave
- text expected console.log("a b");, Toolmoz console.log("a b");
- Where the expected answer comes from
- A string literal retains its internal space and statement tokens.
- Allowed difference
- exact
What this shows: the engine reproduces independently worked values for these cases. It does not prove every possible input is right. To test an answer you were given, see how to check a number; to see what is and is not checked across Toolmoz, see the accuracy ledger.
See a worked example
Worked example
A fixed demonstration, separate from the values you enter above.
- Source
- export function greet(name){return `Hello, ${name}!`;}
- Output
- Beautify
- Indent
- 2 spaces
- JavaScript source type (minify)
- Module
Example result
export function greet(name) {
return `Hello, ${name}!`;
}
Source is parsed locally and never executed. Review formatting before using the result.