Skip to content
Sealpaste

Delete all recent work?

This removes the 0 items saved in this browser. Your settings stay.

Stop saving recent work?

New work won't be saved in this browser. The 0 items already saved can stay or go.

JSON Minifier

Input

Paste JSON to minify, or

CtrlV paste · Ctrl↵ run now

Result
Ready
Ln 1, Col 1
Runs in your browser. Nothing you paste is uploaded unless you share it.

Minify JSON to one line and see the bytes saved

Take out the spaces and line breaks to make JSON as small as it gets. Every value stays the same, and the status bar shows the size before and after.

How to use it

  1. Paste formatted JSON, or open a file.
  2. The result appears as you paste; the status bar shows the size before, the size after and how much smaller it is.
  3. Copy the result, or download it as minified.json.
  4. Switch to Format to make it readable again.

Examples

Minify a config

Input
{
  "name": "web",
  "replicas": 3,
  "ports": [80, 443]
}
Result
{"name":"web","replicas":3,"ports":[80,443]}

Spaces inside strings stay

Input
{
  "greeting": "hello  world",
  "tags": [ "a", "b" ]
}
Result
{"greeting":"hello  world","tags":["a","b"]}

Only whitespace between values goes; the two spaces inside the string are data.

What minifying removes

Spaces, tabs and line breaks between keys and values. Nothing else changes: strings keep their spaces, keys keep their order and numbers keep their digits.

  • The minifier reads the JSON first, so text that isn’t valid JSON is not minified; you get the line and column of the error instead.
  • Numbers are copied as written, so 1.50 stays 1.50 and 64-bit IDs keep every digit.
  • A byte order mark at the start of a file is dropped.

Minifying in code

In JavaScript, JSON.stringify(JSON.parse(text)) minifies too, but it reads every number as a double: large IDs lose their last digits and trailing zeros go.

JSON.stringify(JSON.parse('{"id": 12345678901234567890, "price": 1.50}'))
// → {"id":12345678901234567000,"price":1.5}

When to minify JSON

Minified JSON is smaller to send and store: request bodies, environment variables, test fixtures, or a value for a single-line field.

If the JSON is served over HTTP with gzip or Brotli, compression already shrinks repeated whitespace a lot, so minifying saves the most where nothing is compressed.

Questions

Is my JSON uploaded?
No. Everything runs in your browser, so your JSON stays on your device. Nothing you paste is uploaded unless you share a result, which is locked with your password first.
Does minifying change my data?
No. Only whitespace outside strings is removed. Values, key order and duplicate keys stay as they were.
How much smaller will my JSON get?
It depends on the indent and the number of lines. The sample on this page goes from 128 to 95 bytes, 26% smaller; the status bar shows the numbers for your JSON.
Can it remove comments from my JSON?
Yes, with Repair on. Comments are not part of JSON, so without it the minifier stops at the first one and names its line; Repair removes them and lists each one.
Can I make minified JSON readable again?
Yes. Switch to Format, or paste it into the JSON formatter , which adds the line breaks and indent back.

Related tools