Skip to content
Browser tool Runs locally

JSON Minifier

Paste JSON to remove whitespace and produce compact output. Runs locally in your browser.

Input JSON
0 chars
Minified output
Minified JSON will appear here.

Which tool should I use?

Use this Minifier for compact JSON output. JSON Formatter also includes Minify and Validate controls when you want one workspace for readable and compact output; JSON Validator focuses on syntax feedback. None verifies your application’s business rules.

Worked example

Run the input above with the default settings. The output below shows the exact result for this example.

JSON input

{
  "ok": true
}

Expected result

{"ok":true}

What is JSON minification?

JSON minification removes insignificant whitespace - the indentation, line breaks, and extra spaces between tokens - without touching the actual data. The output is functionally identical JSON, just written on a single, compact line.

How to use this tool

  1. Paste your formatted JSON into the input field.
  2. Click Minify.
  3. Copy the compact output.

Why minify JSON?

  • Reduce payload size when sending JSON over a network, which matters most for large or frequent requests.
  • Save space in configuration files, cached data, and logs.
  • Produce compact, single-line output while preserving source tokens. This is minification, not canonical JSON normalization.
  • Strip out accidental whitespace or formatting inconsistencies before storing JSON in a database column.

Whitespace inside strings is data

Whitespace inside a JSON string is significant and is preserved. For example, {"name":"Ada Lovelace"} keeps the space between the first and last name; only structural whitespace outside string values can be removed.

Common mistakes

  • Minifying JSON that's actually invalid - a missing comma or unquoted key will fail to minify, since the tool needs to parse the JSON first. Use a JSON validator to find the exact issue.
  • Assuming minified JSON is meant to be read by people - once minified, treat it as machine output; keep a formatted copy if you'll need to review it later.
  • Minifying JSON that contains comments - standard JSON doesn't support comments, so a file with // or /* */ notes isn't valid JSON to begin with and needs those removed first.

Frequently asked questions

Does minifying change my data?
No. Minification only removes insignificant whitespace - spaces, tabs, and line breaks between tokens. Every key, value, and the overall structure stay exactly the same; original number tokens, string escapes, key order, and duplicate member names are preserved. Duplicate names can still be interpreted differently by downstream parsers.
Is my JSON uploaded to a server?
No. Minification runs entirely in your browser, and this tool does not send the JSON to an Odelvo processing service.
What's the difference between a minifier and a formatter?
A minifier strips whitespace to produce the smallest possible representation, meant for machines. A formatter does the opposite - it adds consistent indentation and line breaks to make JSON easier for humans to read.
Can minification reduce file size by a lot?
Yes, often by 30–60% for JSON that was pretty-printed with indentation, especially deeply nested structures with many short values, since every level of indentation and every newline gets removed.
Should I minify JSON before sending it over an API?
It's common for production traffic where every byte matters, but most APIs and JSON parsers don't care either way - whitespace outside strings has no semantic meaning in JSON. Minify when you want smaller payloads; keep it formatted when humans need to read it, e.g. in version control.

Related tools