JSON minify

Turn raw JSON into a compact one-line string

Paste JSON on the left and copy the minified output on the right

Last updated: February 6, 2026
Frank Zhao - Creator
CreatorFrank Zhao
{"hello":["world"]}

Introduction / overview

The JSON Minify calculator turns a valid JSON document into a compact one-line JSON string by removing spaces, indentation, and line breaks.

It’s useful when you need to paste JSON into a config field, an environment variable, a ticket, or a tool that expects a single-line payload.

Who is this for?

Developers, data analysts, QA engineers, and anyone who copies JSON between tools (Postman, curl, feature flags, dashboards, CI variables).

Why is it reliable?

The tool parses your input and re-serializes it. If the output exists, it’s guaranteed to be syntactically valid JSON.

Need the opposite? Pair this with our JSON to YAML converter for human-friendly editing, or use YAML to JSON converter to turn configs into strict JSON.

How to use / quick start

  1. 1Paste your JSON into “Your raw JSON”.
  2. 2If the input is valid, the minified JSON appears on the right instantly.
  3. 3Click the copy button to copy the minified output.
  4. 4Use Reset to restore the default example JSON.

How to read the result

The output is the same data, just without extra whitespace. Keys and values stay the same, but line breaks and indentation disappear.

If you need a readable format again, paste the minified output into a JSON formatter (or convert it to YAML for editing).

Step-by-step examples

Example 1: Estimate size savings

Say you have a prettified JSON payload that is about 1200 bytes1200\ \text{bytes} and the minified output becomes 860 bytes860\ \text{bytes}.

saved=rawminified\text{saved} = \text{raw} - \text{minified}==12008601200 - 860==340 bytes340\ \text{bytes}
percent saved\text{percent saved}==3401200×100%\frac{340}{1200}\times 100\%==28.3%28.3\%

In real networks you still want compression (like gzip or brotli), but minifying makes copy/paste and storage workflows much smoother.

Example 2: Make JSON safe to paste into a single-line field

Some tools reject multi-line values (for example, certain CI variables or form inputs). Minified JSON becomes a single line, so it’s less likely to break when pasted.

Tip: after you paste, verify it by parsing it again in your target tool (or by running a quick JSON parse locally).

Real-world examples / use cases

API requests and webhooks

Background: You’re pasting a JSON body into a request builder.

Input: A prettified JSON payload copied from docs.

Result: one-line JSON string\text{one-line JSON string}

How you use it: The request body is compact, consistent, and easy to share in tickets.

Feature flags and remote config

Background: Your dashboard expects a single-line JSON value.

Input: A multi-line object with nested flags.

Result: minified JSON\text{minified JSON}

How you use it: You avoid accidental line-break issues and reduce the chance of copy errors.

Git diffs and review comments

Background: You want to compare two payloads quickly.

Input: Two “pretty” JSON blobs with different whitespace.

Result: normalized  (whitespace-free)\text{normalized} \; (\text{whitespace-free})

How you use it: Whitespace noise disappears; differences become easier to spot (and you can use our JSON diff tool next).

If you’re comparing two payloads, minify both first and then use JSON diff to see real structural changes.

Common scenarios / when to use

Copy/paste into forms

When a UI field doesn’t like line breaks.

Store in DB/text columns

When you want consistent, compact storage for small JSON blobs.

Reduce payload overhead

When whitespace makes a measurable difference for small requests.

Normalize for diffing

When formatting noise hides real changes.

Send as a single line

When you embed JSON in query params or logs (carefully).

When not to use

When humans need to review/edit it — prefer a formatter or YAML.

Tips & best practices

Avoid leaking secrets

JSON often contains tokens, cookies, email addresses, or internal IDs. Minifying makes it easier to share, so double-check before you paste it into public channels.

If it must stay readable, don’t minify

For docs and reviews, readability wins. Keep JSON formatted or convert it to YAML while editing, then minify at the last step.

Calculation method / formula explanation

Conceptually, minification is “parse then stringify with no indentation”. You can think of it like this:

minified=stringify(parse(raw), 0)\text{minified} = \operatorname{stringify}(\operatorname{parse}(\text{raw}),\ 0)

In JavaScript terms, it’s equivalent to parsing your JSON into an object and then serializing it back out with00 spaces.

output\text{output}==JSON.stringify\operatorname{JSON.stringify}((parse(input)\operatorname{parse}(\text{input}),, null\ \text{null},, 0\ 0))

Related concepts / background info

Minify vs compression

Minification removes whitespace. Compression (gzip/brotli) looks for repeated patterns and shrinks data further. They work together: you can minify for copy/paste friendliness and still rely on compression for network transfers.

Why parsing matters

Removing whitespace by hand is risky because you might delete characters that are actually part of a string. Parsing ensures the output represents the same data structure.

Frequently asked questions

Does minifying change the meaning of my JSON?

No. It removes whitespace outside strings. If the output appears, it’s valid JSON that represents the same parsed data.

Why do I see “Provided JSON is not valid”?

Most often it’s a missing comma, an unquoted key, a trailing comma in strict JSON, or a string quote mismatch. Fix the input and the output will appear.

Can I minify JSON with comments?

Comments are not part of standard JSON. If your source contains comments, the output will drop them because the result must be valid JSON.

Can I reverse the process?

Yes. Paste the minified JSON into a formatter or into our JSON-to-YAML tool if you want a cleaner editing experience.

Is this tool running on a server?

The conversion runs locally in your browser, similar to our other converters. Still, treat sensitive JSON carefully when sharing links.

Limitations / disclaimers

  • Minification is not encryption. Anyone who sees the JSON can read it.
  • It will not meaningfully compete with gzip/brotli compression for large payloads.
  • If your input is not parseable, no output is produced.

External references / sources

JSON minify | CalculatorVast