Kharabeesh
On-device ع

JavaScript Formatter & Compactor

Beautify JavaScript or JSON with your choice of indentation and brace style, or compact it by removing comments and whitespace while keeping the line breaks the code relies on. Names are never changed.

Free, no sign-up Saved on your device only Works offline after first open

The tool

Loading the tool…

How to use

  1. Paste JS or JSON, or open a file.
  2. Choose Format and a brace style, or Minify to compact it.
  3. Copy or download the result.

Privacy & how it works

Saves your data in this browser only (back it up or delete it from “My data”).

  • Engine: beautifier (open-source libraries bundled with the site).
  • Works offline after you open it once.

Frequently asked questions

Is compacting the same as tools like Terser?

No. It only removes comments, spaces and unnecessary line breaks; it never renames variables or removes code. Files shrink, but less than with full build tools.

Why are some line breaks kept after compacting?

JavaScript sometimes treats a line break as a semicolon (for example after return or before ++). Those line breaks are kept so the code means the same thing.

Does it support TypeScript and JSX?

Formatting works with much TypeScript and with JSX to a limited extent. Compacting is designed for plain JavaScript.

Related tools