1. Home
  2. Code
  3. JS & JSON Minifier / Beautifier

JavaScript & JSON Minifier and Beautifier

Minify JavaScript and JSON to save bytes, or pretty-print it so you can read it. Comments and strings stay intact.

What it is for?
Processed on the server Free, no sign-up

What it is for?

Minified code is small but hard to read, and readable code carries bytes the browser does not need. Paste a script, a JSON API response or a config file here and switch between the two: compress it before you ship it, beautify it when you have to read or debug it.

How it works

Compress removes whitespace and comments without touching strings, template literals or regular expressions. Valid JSON is minified as JSON, so the output stays valid.

Beautify re-indents your code with four spaces. Tick "Decode special JSON chars" to turn escaped characters such as \u00e7 back into readable text.

That option only applies when the input is valid JSON. For ordinary JavaScript it changes nothing.

What Compress does not do

  • It does not shorten variable or function names. The file gets smaller, but names stay as you wrote them, so errors in the console are still easy to trace.
  • It keeps no comments, not even license headers that start with /*!. Add them back by hand if your license requires it.
  • It does not drop line breaks blindly. Where a line break ends a statement, a semicolon is written in its place, so code without semicolons still runs on one line.

Example

A JSON object spread over twenty indented lines comes back as a single line such as {"id":7,"name":"Gcode","tags":["a","b"]}. Beautify turns that line back into an indented block with four spaces per level.

Where your code goes

Compress and Beautify run on our server. The code is sent with the request, processed and sent back; the tool does not save it. Still, remove API keys and passwords before you paste a config file.