Skip to main content
smnify.

Minify JSON

Paste JSON and this page opens in Minify mode: it parses your text, then writes it back on one line with no spaces, tabs or line breaks. Values, key order and string contents stay exactly as they were, and if the JSON is invalid you get the error instead of a broken result. Parsing happens in your browser.

Runs in your browser

Free, no sign-up. Parsing, formatting and downloads all run in your browser. The JSON you paste is never uploaded, logged or sent to analytics.

JSON Formatter / Validator / Minifier

Validate strict JSON, format it for reading, or minify it for production use.

JSON input

Output

Formatted or minified JSON will appear here.

Status

Checking...

Output Chars

0

Keys

0

Depth

0

How to use the JSON Formatter

  1. Paste your JSON into the JSON input box, or press Sample to load an example. Clear empties the box.
  2. Choose Format to indent the output, or Minify to remove all whitespace.
  3. For Format, pick an indent of 2 spaces, 4 spaces or a tab. Tick Sort keys (A-Z) to order object keys alphabetically.
  4. Read the Status panel: Valid JSON shows the output with key count and nesting depth; Invalid JSON shows the error with its line, column and a caret under the problem.
  5. Press Copy to put the full output on your clipboard, or Download to save it as formatted.json or minified.json.

Worked example

Sample data

Input
{
  "name": "Sample item",
  "tags": ["a", "b"],
  "price": 12.5
}
Output
{"name":"Sample item","tags":["a","b"],"price":12.5}

The space inside the string Sample item is kept: only whitespace between tokens is removed.

Good to know

Minified JSON is smaller to send and store, but harder to read. Keep a formatted copy for editing and minify only the version you ship. Gzip or Brotli on your server shrinks formatted JSON a lot too, so measure before assuming minifying matters for your case.

How it works

What counts as valid JSON

JSON (RFC 8259) allows objects, arrays, double-quoted strings, numbers, true, false and null. Keys must be double-quoted strings.

Things many editors accept but JSON does not: single quotes, trailing commas, comments, unquoted keys, NaN, Infinity and leading zeros such as 007. This tool rejects all of them, so output that passes here will parse in any standards-compliant JSON parser.

Format vs minify

Format adds line breaks and indentation so nesting is easy to read in reviews, logs and documentation.

Minify removes every optional space and line break. The data is identical; only the size changes, which helps for payloads, config embedded in code, and storage.

Large numbers and precision

JavaScript stores numbers as 64-bit floats, so integers above 9,007,199,254,740,991 and long decimals are rounded by JSON.parse. Many formatters silently change such values.

This tool keeps the digits exactly as you wrote them and warns you when a number cannot be represented exactly by JavaScript, so you can send it as a string instead.

Number.MAX_SAFE_INTEGER = 2^53 - 1 = 9007199254740991

Duplicate keys and byte-order marks

JSON allows the same key twice in one object, but JSON.parse keeps only the last value. The tool keeps every occurrence in the output and lists the duplicates in a warning.

A UTF-8 byte-order mark at the very start of the input is removed and reported, because strict parsers reject it.

Inputs, outputs and limits

Inputs

  • JSON text, pasted or typed
  • Mode: Format or Minify
  • Indent: 2 spaces, 4 spaces or tab
  • Sort keys (A-Z) on or off

Outputs

  • Formatted or minified JSON
  • Validation status with line, column and caret for errors
  • Output character count, key count and maximum nesting depth
  • Warnings for precision loss, duplicate keys and a removed byte-order mark
  • Copy to clipboard and download as .json

Limits

  • Strict JSON only: no comments, trailing commas or single quotes (JSON5 and JSONC are rejected).
  • Nesting deeper than 1,000 levels is rejected.
  • The on-screen preview shows the first 200,000 characters; Copy and Download always include the full output.
  • Inputs over 500,000 characters re-validate after a short pause so typing stays responsive.

Processing

  • Parsing, formatting and downloads all run in your browser. The JSON you paste is never uploaded, logged or sent to analytics.

Frequently asked questions

Does minifying change my data?

No. Only insignificant whitespace between tokens is removed. Strings, numbers, booleans, null and the order of keys are written back unchanged.

Why do I get an error instead of output?

Minify needs valid JSON. Trailing commas, single quotes, comments and unquoted keys are not JSON, so the tool reports where parsing failed and leaves the output empty.

Can I switch back to a readable layout?

Yes. Switch the mode to Format to indent the same text again with the spaces or tabs you choose.

Is my JSON sent to a server?

No. It is parsed and re-written by JavaScript in your browser tab.

Need a custom internal tool or integration?

We build internal tools, APIs and integrations that fit your team's workflow, from a single admin screen to a full backend.