PixelTools

JSON Minifier

Strip whitespace from JSON to make it as small as possible. Free, instant, and private.

0 characters
Minified JSON0 characters
Your minified code will appear here.

Why use PixelTools' json minifier

Five languages in one tool

JSON, JavaScript, HTML, CSS, and YAML, switchable in one click without losing what you pasted.

Beautify or minify

Readable output with your choice of 2 spaces, 4 spaces, or tabs, or the smallest possible size.

Instant, live output

The result updates as you type or paste. No button to click and no page reload.

Clear error messages

Invalid JSON, YAML, or JavaScript shows what went wrong and where, instead of failing silently.

Copy or download

Copy the result to your clipboard or save it as a .json, .js, .html, .css, or .yaml file.

100% private

Your code never leaves your browser. Nothing is uploaded, logged, or stored.

Three steps to use the json minifier

  1. 1

    Paste your JSON

    Paste the code into the input box. The language is already set to JSON.

  2. 2

    Choose how to minify it

    Minify is selected. Switch to Beautify if you want readable output instead.

  3. 3

    Copy or download the result

    The output updates as you type. Copy it with one click, or download it as a file.

When a minified JSON file helps

Whitespace in JSON is only there for humans. Machines read the compact form just as well, and it is smaller to send and store.

Reading minified production code

Re-indent a minified JavaScript or CSS file so you can follow what it does while debugging.

Shrinking API payloads and config

Minify JSON before embedding it in a request, a fixture, or a environment variable.

Cleaning up pasted snippets

Make code from a forum, email, or chat match a consistent indent before it goes into your project.

Checking a config file

Paste YAML or JSON to confirm it is valid and see its structure laid out properly.

Frequently asked questions

What does a JSON minifier remove?

+

It removes every space, tab, and line break that sits outside a string value. Keys, values, and the data itself are untouched, so the minified JSON parses to the same object (for numbers JavaScript can hold exactly, see below).

Will minifying change my data or key order?

+

No. Keys stay in their original order and values are not altered. One edge case: a number with more precision than JavaScript can hold, like a 20-digit ID, is rounded by the parser before it is written back out.

Why does the minifier say my JSON is invalid?

+

JSON is stricter than a JavaScript object. Keys must be in double quotes, single quotes are not allowed, and a trailing comma after the last item is an error. The message points at the position of the first problem.

Is my code uploaded anywhere?

+

No. Beautifying and minifying both run entirely in your browser with JavaScript. Nothing you paste is sent to a server, logged, or stored, so it is safe to use on private or unreleased code.

Need a different language?

Or see the full code beautifier & minifier for all five languages.

JSON Minifier now

Free, instant, no account needed.