Format, beautify or minify JSON
Pretty-print or minify JSON with 2-space, 4-space or tab indentation and optional key sorting.
0 / 2,000,000 characters · Updates as you type.
Paste a JSON document, an API response or a config file and get it back indented consistently. The formatter uses the browser's own JSON parser, so what it accepts is exactly what JavaScript accepts: double-quoted keys, no trailing commas, no comments. If parsing fails, the error tells you the line and column and shows the offending line with a caret under it.
Use two spaces for most JavaScript and web projects, four for Python-style repositories, or tabs where your team's editor config asks for them. "Minify" strips all whitespace, which is what you want before embedding JSON in a URL, an environment variable or a data attribute. "Sort keys" orders every object alphabetically at every depth, which makes two documents diff cleanly.
The text never leaves this page. That matters for the things people usually paste into a formatter: tokens, customer records, cloud credentials. Nothing is logged and there is no server to log it.
How to use it
- Paste your JSON into the input box. The output updates as you type.
- Choose an indentation: 2 spaces, 4 spaces, tabs, or Minify.
- Turn on "Sort object keys" if you want a canonical order for diffing.
- If you see an error, use the line and column to find the problem; the caret line shows the exact character.
- Copy the result or download it as a .json file.
Frequently asked questions
Why does it reject JSON that works in my JavaScript code?
JavaScript object literals allow single quotes, unquoted keys, trailing commas and comments. JSON allows none of those. If you have JSON5 or a JS object, fix those four things and it will parse.
Are large numbers preserved?
Numbers are parsed as JavaScript doubles, so integers above 2^53 (about 9 quadrillion) lose precision, exactly as they would in any browser or Node.js. Keep IDs of that size as strings.
Does sorting keys change the meaning of the document?
No. JSON objects are unordered by specification, so any consumer that follows the spec treats the sorted and unsorted versions as equal. Arrays are never reordered.
How big a file can I format?
Up to 2 million characters (about 2 MB). Anything larger is better handled with a command-line tool such as jq, because rendering that much text in a browser text area becomes slow.
Is the JSON uploaded anywhere?
No. Parsing and formatting run in your browser tab. You can disconnect from the network after the page loads and the tool keeps working.
Related tools
- Validate JSON and locate the errorCheck whether text is valid JSON and see exactly where it breaks, with line, column and a caret.
- Convert JSON to CSVTurn a JSON array of objects into CSV for Excel or Google Sheets; nested objects become dot-separated columns.
- Decode a JWT (without sending it anywhere)Decode a JSON Web Token's header and payload and see whether it has expired. Signature is not verified; the token stays in your browser.
- Encode or decode Base64Encode text to Base64 or decode Base64 back to text, UTF-8 safe, with a URL-safe option.
- URL-encode or decode textPercent-encode text for URLs (encodeURIComponent or encodeURI) or decode an encoded string.