JSON Parser

JavaScript Minifier & Beautifier Online

Minify JavaScript with Terser (compression and variable-name mangling) or beautify minified code back into readable, indented source. Syntax errors are reported instead of producing broken output, and nothing is uploaded.

How to format or minify JavaScript

  1. Paste your JavaScript into the Input box.
  2. Choose Beautify for readable output or Minify for the smallest output. The result updates as you type.
  3. Click Copy to copy it. In Minify mode the badge shows how much smaller the output is.

Example

Input JavaScript

// Fetch users and group them by role
async function loadUsers(url) {
  const response = await fetch(url);
  if (!response.ok) { throw new Error("Request failed: " + response.status); }
  const users = await response.json();
  return users.filter((user) => user.active);
}

Beautified

// Fetch users and group them by role
async function loadUsers(url) {
  const response = await fetch(url);
  if (!response.ok) {
    throw new Error("Request failed: " + response.status);
  }
  const users = await response.json();
  return users.filter((user) => user.active);
}

Same input

// Fetch users and group them by role
async function loadUsers(url) {
  const response = await fetch(url);
  if (!response.ok) { throw new Error("Request failed: " + response.status); }
  const users = await response.json();
  return users.filter((user) => user.active);
}

Minified

async function loadUsers(t){const a=await fetch(t);if(!a.ok)throw new Error("Request failed: "+a.status);return(await a.json()).filter(t=>t.active)}

Tips

  • Minify compresses the code and shortens local variable names, which typically removes a large share of the file size.
  • Beautify restores formatting, but mangled variable names can't be restored.
  • Modern syntax such as async/await, classes and optional chaining is supported.

Related tools

Minify CSS and HTML, test patterns with the regex tester, or escape strings with JSON Escape.

Frequently asked questions

How do I minify JavaScript online?
Paste your code and choose Minify. It is compressed and variable names are shortened using Terser, the same minifier used by many build tools, so the output is as small as possible.
Can I beautify minified JavaScript?
Yes. Choose Beautify to turn minified or hard-to-read code into consistently indented, readable JavaScript. Mangled variable names can't be restored, only the formatting.
Does it support modern syntax?
Terser supports modern ES syntax including async/await, classes, optional chaining and modules. If your code has a syntax error, the tool shows the error instead of output. Everything runs in your browser — your code is never uploaded to a server.
Handles JSON files up to 20MB smoothly