JSON Formatter/Beautifier
CodePaste raw JSON and instantly beautify it with proper indentation, or minify it to save space. Runs entirely in your browser — nothing is uploaded anywhere.
What is a JSON?
A JSON Formatter takes raw JSON text — typically a minified API response, a single-line config export, or hand-typed data with inconsistent spacing — and reformats it with clean, consistent indentation so its structure is immediately readable. JSON itself doesn't care about whitespace; a formatter exists purely to make the nesting of objects and arrays visible to a human reader rather than a parser.
Most real-world JSON you encounter — from a browser's network tab, a curl response, or a deployed configuration file — is minified to save bandwidth, which collapses everything onto one line. The JSON Formatter reverses that, adding line breaks and indentation back in, or going the other direction with the minify option when you need the compact form again for production use.
How to use this JSON calculator
- Paste your raw JSON into the Raw JSON input box — replacing the example text shown by default.
- Choose your preferred Indent size (2 spaces, 4 spaces, or Tab) from the dropdown.
- Leave Minify instead of beautify off to get readable, indented output, or switch it on to get the compact single-line version.
- Review the formatted result, which updates instantly as you type or change options.
- Click the copy icon to copy the formatted JSON to your clipboard, then paste it wherever you need it.
Formula & Methodology
This tool uses the browser's built-in JSON engine rather than a hand-rolled parser, sinceJSON.parse/JSON.stringifyare both fast and fully spec-compliant: 1.JSON.parse(rawInput)converts your text into an in-memory JavaScript value, throwing a descriptive error if the syntax is invalid. 2. For beautify mode:JSON.stringify(value, null, indent)re-serialises that value with the chosen indent (a number of spaces, or"\t"for a tab). 3. For minify mode:JSON.stringify(value)(no indent argument) re-serialises it with no extra whitespace at all. Before (minified):{"name":"thecalcu.com","calculators":134,"converters":37}After (beautified, 2-space indent):{ "name": "thecalcu.com", "calculators": 134, "converters": 37 }