Strip whitespace from JSON for production
Runs in your browser. Nothing you type is sent anywhere. Updated on 24 Oct 2026.Minified JSON is the same data with every space, tab and line break between tokens removed, which is what belongs in an API response, a config baked into a build, or a value stored in a database column. Paste formatted JSON and the compact version appears, with the size of what went in and what came out. Keys, order and values are untouched.
Paste formatted JSON into the Input pane.
Make sure Minify is selected on the options bar, so the right pane is headed Minified.
Compare the size shown above the Input pane with the smaller size shown above the result.
Click Copy, or the download icon to save the result as data.min.json.
This JSON formatter turns compact or messy JSON into a clean, indented document you can read, and tells you exactly where it breaks if it is not valid. Choose two spaces, four spaces or tabs, sort keys alphabetically, or minify back to a single line for production.
People use it when an API response arrives on one line, when a config file stops loading and the error message only says "unexpected token", or when two teams need the same file diffed with keys in the same order. Paste, press Ctrl+Enter, copy the result.
If validation fails you get the line and column plus a plain-English fix, such as "Remove the trailing comma" or "Property names must be wrapped in double quotes". For structured browsing, switch to the tree view and collapse what you do not need. Related tools: JSON to TypeScript, YAML to JSON, CSV to JSON.
The rest of the article, and all 6 questions about JSON Formatter & Validator, are on the JSON Formatter & Validator page.
No. Formatting, validation and minifying all run in your browser with JavaScript, so nothing you paste leaves your device and no copy is kept on a server. API responses holding access tokens, customer names or bank details are safe to paste here.
Paste the text and press Format. The error message shows the line and column, highlights the line, and suggests the most likely fix, for example removing a trailing comma or replacing single quotes with double quotes.
Yes. Choose 2 spaces, 4 spaces or Tab in the options bar and the output reindents as you change it. The choice is remembered on this device, so the next file comes back in the same style. Minify removes the indentation altogether for a production payload.
No. Sorting rewrites the order in which keys appear, and a JSON object has no defined key order, so the parsed value is identical. Arrays keep their original order, because position is part of the data in an array. Sorting both sides first makes a diff far shorter.
Still stuck? Ask about JSON Formatter & Validator and anybody who knows can answer. No account needed.
Same job, other tools: HTML Minifier – Strip comments and spare whitespace from HTML and see the saving · CSS Minifier – Compress a stylesheet and see exactly how many bytes you saved · JS Minifier – Shrink a JavaScript file with terser and see the size saved · Remove Tracking Parameters – Strip utm, fbclid and gclid from a link before you share it.
On the related tools: GraphQL Validator – Check a GraphQL query or schema for errors, optionally against your own SDL.
In the collections JSON Tools · Code Formatters and Minifiers.