Skip to content
ToolHive

JSON Formatter

Beautify, minify and validate JSON online. Choose 2 spaces, 4 spaces or tabs, get the exact line and column of any syntax error, and copy or download the result. Runs entirely in your browser.

JSON Tools

How to use JSON Formatter

  1. Paste or type JSON into the input panel.
  2. The document is parsed as you type; the output panel shows the formatted result immediately — side by side on a desktop, stacked on a phone.
  3. Pick Beautify or Minify, and choose 2 spaces, 4 spaces or tabs for the indentation.
  4. If the JSON is invalid, read the diagnostic below the panels and use Jump to error to put the cursor on the exact character.
  5. Copy the output to the clipboard, or download it as data.json.

Examples

Minified input

Paste a single-line API response and it becomes readable immediately.

{"id":7,"name":"ToolHive","tags":["json","free"],"active":true}

The same document beautified

Two-space indentation, one value per line.

{
  "id": 7,
  "name": "ToolHive",
  "tags": [
      "json",
      "free"
  ],
  "active": true
}

An array at the root

A JSON document does not have to be an object. Arrays, strings, numbers, booleans and null are all valid roots.

[
  { "id": 1, "sku": "TN-001" },
  { "id": 2, "sku": "TN-002" }
]

Features

  • Live formatting as you type, with no Format button to remember
  • Beautify with 2 spaces, 4 spaces or tab indentation, or minify to a single line
  • Precise errors: message, line, column and a caret under the offending character
  • Jump to error moves the cursor straight to the problem
  • Status bar shows validity, line and character counts, root type and key or item count
  • Minify reports how much smaller the result is
  • Autosaves your draft to this browser and restores it next time
  • Copy to clipboard or download a ready-to-use data.json file
  • Runs fully client-side: your JSON is never uploaded

Frequently asked questions

Is my JSON sent to a server?
No. Parsing, formatting and minifying all happen in your browser using the native JSON parser. Nothing leaves the tab, which makes the tool safe for API responses containing real data.
What is the difference between beautifying and minifying?
Beautifying adds newlines and indentation so a human can read the structure. Minifying removes every optional space and newline to make the payload as small as possible. Both produce exactly the same data.
Which indentation should I use?
Two spaces is the most common convention in JavaScript and TypeScript projects and is the default here. Four spaces is common in Python and Java ecosystems, and tabs suit teams that let each developer choose a display width.
Does formatting change my data?
No. The document is parsed into values and re-serialised, so only whitespace changes. Key order is preserved, and numbers keep their value — though a number written as 1.50 is re-serialised as 1.5, because JSON has no concept of trailing zeros.
Why does my JSON with comments fail?
JSON has no comments. Formats such as JSONC and JSON5 add them, but they are not JSON and the standard parser rejects them. Remove the comments, or convert the file first.
Can it handle large files?
Yes. Parsing uses the browser's native parser, the editor avoids per-line DOM work above a few thousand lines, and syntax colouring switches off above roughly 150 KB of output so very large documents stay responsive.
Does it support Unicode and escape sequences?
Yes. Emoji, accents and CJK text pass through unchanged, and escape sequences such as \n, \t and \uXXXX are handled by the native parser exactly as any other JSON consumer would handle them.
Where is my work saved?
In this browser's local storage, about half a second after you stop typing, and restored on your next visit. It never leaves your device, and Clear removes it.

Related tools

About JSON Formatter

JSON Formatter is part of JSON Tools on ToolHive, a growing collection of small, focused utilities for developers, designers and students. Format, validate, minify and convert JSON with instant feedback as you type. Everything runs client-side, so your data never leaves the browser tab — which makes these tools safe to use with work-in-progress code and private content.