Home/Web Tools/JavaScript minifier and prettier

JavaScript minifier and prettier

JavaScript Minifier and Prettier

Minify JavaScript with Terser or prettify it with Prettier for readable output.

0 -> 0 bytes Ready
InputPaste JavaScript here
OutputLive format with a short delay
Prettify or minify in one view Clean output ready to copy Fits desktop and mobile

How it works

Choose Prettify to format JavaScript with Prettier or Minify to compress it with Terser. The tool keeps code logic intact while reshaping whitespace and punctuation.

  • Prettify expands functions with consistent spacing and line breaks.
  • Minify can rewrite expressions, so review critical debug builds.

Quick examples

Prettify
const add=(a,b)=>{return a+b}
const add = (a, b) => { return a + b; };
Minify
const add = (a, b) => { return a + b }
const add=(a,b)=>a+b;

Minify reduces payload size while Prettify helps with edits and reviews.

Mini FAQ

Does minify change behavior?

It removes whitespace and can rewrite expressions. Test critical paths after minifying.

Why is my JavaScript failing to format?

Prettier needs valid JavaScript. Fix missing braces or invalid syntax and try again.

Can I use TypeScript?

This tool targets plain JavaScript only. TypeScript may fail to parse.