Developer tool

Code formatter

Beautify code so it can be read, or minify it for shipping.

Code formatter Runs on your device
  • Runs in your browser — your text is never sent anywhere
  • No sign-up, no quotas, free to use as often as you like

How it works

Minified code is unreadable by design, and hand-written code is rarely indented consistently. Both problems are solved by the same tool, and neither is a reason to paste proprietary source into a stranger's website.

Beautifying

Indents and line-breaks JavaScript, CSS and HTML to a consistent style. This is what you want when reading minified library code, cleaning up something pasted from elsewhere, or making a diff readable. The language is detected automatically unless you set it.

Minifying, and what each mode really does

JavaScript is minified by a real parser, which safely shortens names and removes dead code. CSS and HTML are minified conservatively — comments removed and whitespace collapsed, with nothing renamed or restructured. That is safe on any input but will always squeeze out less than a dedicated build tool. It is meant for a quick size cut, not to replace your bundler.

It cannot fix broken code

Both beautifying and minifying need the input to parse. Invalid JavaScript is reported rather than guessed at, because a formatter that repairs code would change what it does.

Why this runs locally

Source code is usually somebody's property, frequently your employer's, and often contains keys and endpoints. Formatting it should not involve uploading it.

FAQ

Code formatter — questions

Which languages does it handle?

JavaScript and JSON, CSS, and HTML, detected automatically or chosen manually.

Is the JavaScript minifier as good as a build tool?

For a single file it is close, since it uses a real parser. CSS and HTML minification here is deliberately conservative.

Will it fix syntax errors?

No. Invalid code is reported rather than guessed at.

Is my code uploaded?

No. Everything runs in your browser.