Search tools

JSON Minifier

Shrink JSON to a single compact line for APIs, config values and storage — validated as you go.

JSON Minifier tool

Processing runs in your browser.

Pretty-printed JSON is great for people and wasteful for machines. When JSON goes into an environment variable, a URL, a cookie or a database field, line breaks and indentation only add bytes and sometimes break things. This minifier produces the most compact valid JSON in one step.

When to minify

  • Environment variables and secrets managers that expect a single-line value.
  • Embedding JSON in HTML attributes or JavaScript strings.
  • Storage: save space when keeping JSON in databases, logs or local storage.
  • Test fixtures: keep inline JSON short in test code.

To go back to a readable version, use the JSON Formatter.

How to use the JSON Minifier

  1. Paste formatted JSON on the left, or open a .json file.
  2. The minified version appears on the right with the size before and after.
  3. If the JSON is invalid, fix the error shown by line and column.
  4. Copy the result or download it.

Features

  • Removes every unnecessary space, tab and line break without changing the data.
  • Validates the JSON first, so you never minify broken data.
  • Shows bytes saved and the percentage reduction.
  • Keeps string contents exactly as they are, including spaces inside values.

Frequently asked questions

Does minifying JSON change the data?

No. Whitespace between tokens has no meaning in JSON, so the minified version parses to exactly the same values. Spaces inside strings are kept.

How much smaller does JSON get?

Typically 10–30% for pretty-printed JSON, more if it was indented with four spaces or tabs. Servers that use gzip or Brotli compression shrink it much further, so minifying matters most for stored data and URL or header values.

Why minify JSON at all?

To fit JSON into places where size or line breaks matter: environment variables, query strings, database columns, HTML data attributes and message queues.

Written by