Free Developer Tool

JSON Minify: Compress JSON into a Single Line

Strip out spaces, tabs and line breaks to make your JSON smaller and faster to send. Your data stays exactly the same.

Minify JSON Data unchanged Syntax check Instant results Works on mobile One-click copy No signup

Minify JSON in One Click

Indented JSON is easy to read but full of characters machines don't need. This JSON minifier removes every space and line break that sits outside your strings, leaving one compact line. Paste, minify, copy, and you've got a lighter payload for your API, config or database field.

Read more
Formatted JSON object compared with its minified single-line version

What Does Minifying JSON Do?

Minifying removes whitespace that only exists for human readers. Here's a formatted object: { "id": 1042, "name": "Ayesha Khan", "active": true, "roles": ["editor", "admin"] } And the same JSON after you minify it: {"id":1042,"name":"Ayesha Khan","active":true,"roles":["editor","admin"]} That small example drops from 91 to 73 characters, roughly 20 percent smaller. Larger, deeply indented files often save even more.

Smaller JSON payload giving faster API responses and lower storage use

Why Compress JSON?

Smaller JSON means faster API responses, less bandwidth and lower storage costs. It matters most for mobile users on slow connections, busy APIs, JSON stored in database columns or local storage, and data embedded in HTML pages. When you compress JSON this way, any parser reads it exactly as before.

Minification and gzip or Brotli compression used together

Minifying vs Gzip Compression

Minifying and gzip work well together. Minification removes whitespace permanently, while gzip or Brotli shrinks the file during transfer and the browser unpacks it on arrival. Most servers already apply gzip, but minifying first still trims the result a little further, and minified JSON stays smaller in storage, where transfer compression doesn't help.

Minifying JSON with JavaScript, Python and jq

Minify JSON in JavaScript, Python or the Command Line

For automated builds, minify in code. In JavaScript, JSON.stringify(JSON.parse(text)) returns compact JSON. In Python, use json.dumps(data, separators=(",", ":")). On the command line, jq -c . file.json compresses a JSON file in one step. VS Code extensions can minify too, but pasting a file here is often quicker.

How to Use the JSON Minifier

1

Paste your JSON

Add formatted JSON from a file, an API or your code editor.
2

Click Minify

The JSON minify tool checks the syntax and removes all unnecessary whitespace.
3

Copy the compact JSON

Copy the single-line result into your code, request body or storage.
4

Format it again later

Need to read it again? Paste it into the JSON Formatter to expand it back out.

JSON Minify FAQs

Making JSON smaller, explained.

What does it mean to minify JSON?

To minify JSON means removing all the whitespace that isn't part of a value: spaces, tabs and line breaks between keys and values. The result is one compact line holding exactly the same data.

Does minifying JSON change the data?

No. Keys, values, their order and any spaces inside strings all stay the same. The minified and formatted versions parse to identical data.

How do I minify a JSON file?

Open the file, copy its contents, paste them here and click Minify. Then paste the result back into the file and save. For many files at once, use jq -c or a short script.

How much smaller does JSON get?

It depends on the indentation and how deeply the data is nested. Pretty-printed files commonly shrink by somewhere between 10 and 30 percent, and deeply nested files with wide indentation can shrink more. Try your own file and compare the sizes.

Can I minify invalid JSON?

No. The minifier has to parse your JSON first, so any syntax errors need fixing before it can compress anything. The JSON Validator will show you what's wrong.

Is minifying the same as compressing JSON?

They're related. Minifying is a simple form of compression that removes whitespace, and the result is still plain, readable JSON. Gzip or Brotli create a binary file that has to be decompressed first. Using both gives you the smallest transfer size.

Can I un-minify JSON?

Yes. Paste minified JSON into our JSON Formatter and it'll be indented and readable again. Nothing is lost along the way.

Is this JSON minifier free?

Yes. Minify JSON online as often as you like, free and with no signup.

Minifying the rest of your site?

Shrink your JavaScript files the same way.

Minify JavaScript

Raheel Jakhura

CEO / Co-Founder

Our goal is to provide online free tools so you don't have to install any software for basic usages. We are trying to add more tools and make these tools free forever.

cookies image
We care about your data and would love to use cookies to improve your experience.