JSON Minifier
Compact JSON onto a single line, and see how much smaller that made it.
What this tool does
JSON Minifier parses the document and writes it back out with no whitespace between tokens. Because it re-serialises a parsed value rather than deleting spaces with a regular expression, whitespace inside string values survives untouched — a description field containing line breaks keeps them — and input that is not valid JSON is refused with the line and column where parsing stopped instead of being turned into a broken one-liner.
Three optional passes run before the output is written. Drop properties whose value is null removes null-valued keys from objects, and deliberately leaves nulls that sit inside arrays alone, because deleting one would shift every index after it. Sort object keys reorders keys at every level, including objects nested inside arrays. Escape non-ASCII characters as \uXXXX rewrites accented letters, emoji and CJK text as escape sequences so the result survives a transport that is not UTF-8 clean — but it never shrinks anything: every escaped character costs six ASCII bytes, so an emoji or a run of kanji can grow the document by half again or more, and the summary then reports that growth as a negative saving.
Two things about compact JSON are worth knowing before you rely on it. An integer past the range a 64-bit float holds exactly — roughly sixteen digits, or anything above nine quadrillion — is rounded by the parser and the minified output carries the rounded number; the summary line names how many were affected and what the first one became, but it cannot recover the digits. Duplicate keys are also resolved silently — the last occurrence wins, as the JSON specification requires — so if you need those reported, run the document through JSON Validator first.
Minifying is not compression, and it is not a substitute for it. Whitespace is a small share of most payloads, and gzip or brotli on the connection already removes nearly all of it, so a server that compresses responses gains little from this step. Where it does earn its place is anywhere the bytes are counted before compression, or where the JSON has to be one line. Once the page itself has loaded, the minifying needs no network at all.
The parser here is strict, with no tolerant mode of the kind JSON Formatter offers: a .jsonc file or a tsconfig with comments has to be formatted there first, then minified here.
How to use it
- Paste the JSON. One complete document per run — a single object, array or value. Newline-delimited JSON is rejected as text after the end of the document; use JSONL Validator for that format.
- Choose the optional passes. Dropping null properties, sorting keys and escaping non-ASCII are all off by default, so leaving them alone gives a plain whitespace strip and nothing else.
- Read the saving, then copy the output. Sizes are measured in UTF-8 bytes on your own document. Anything under a kilobyte is reported as an exact byte count; above that the figures are rounded to KB or MB, while the percentage is worked out from the exact bytes either way.
Processing & privacy
Runs on your device. Your file is processed directly in this browser.
Common use cases
Putting JSON somewhere that allows one line
A data attribute, an environment variable, a log field or a single CSV cell cannot hold indented JSON. Compact JSON fits on the line these expect.
Fitting inside a size limit
QR codes, URL fragments and per-key storage quotas cap the payload before any compression happens, so removing the indentation is a real gain there.
Comparing or checksumming two documents
Minify both with Sort object keys enabled and formatting and key order stop mattering, so identical data produces an identical string to hash or diff.
Trimming a fixture before it is embedded
Test data pasted into source, a seed file or a config blob adds indentation nobody reads once it is inside another file.
Questions
Is the JSON I paste sent anywhere?
How much smaller will my file get?
Does minifying change my data?
Why is JSON rejected here when JavaScript accepts it?
Should I minify instead of enabling gzip?
Can I undo it and get the indented version back?
Related tools
- JSON Formatter — Pretty-print, collapse and inspect JSON instantly.
- Base64 Encoder Decoder — Encode and decode Base64 text and files.
- JWT Decoder — Inspect the header, payload and claims of a JWT.
- Hash Generator — Compute MD5, SHA-1, SHA-256 and SHA-512 digests.
- Regex Tester — Test patterns against sample text with live matches.
- Unix Timestamp Converter — Convert between epoch seconds and readable dates.