Best on a larger screen. The editors have more room on desktop.

JSON Formatter & Beautifier

LiveIn-browser only
Ln 1, Col 11 line · 0 bytes
0 bytes
Help

Format with 2-space, 4-space, or tab indent, minify whitespace, sort object keys, and check byte size — 100% in-browser.

01-03 Guide

How to format JSON in 3 steps

Paste JSON to beautify it with 2-space, 4-space or tab indentation, minify it, or sort its keys recursively. Files up to 5 MB, formatted in your browser.

    raw.jsonPaste or Upload
    { "user": {
    "id": "usr_42",
    "name": "Ada"
    }}
    Drag & drop .jsonREADY · 100% IN-BROWSER
    01

    Paste or load JSON

    Paste your JSON into the left pane, or press Sample to load an example.

    auto-transform✓ Valid Syntax
    2 Spaces
    vs
    Minify
    vs
    4 Spaces
    Web Worker engineUp to 5 MB
    02

    Format & validate

    It formats as you paste. Press Format, or Minify to strip every byte of whitespace instead.

    result.jsonKeys Sorted [A-Z]
    CopyDownloadShare
    Share as a linkClient-side only
    03

    Sort, copy & export

    Set the indent width or Sort keys beside the result, then Copy or Download it.

Why JSON iGraph

Errors pinned, keys sorted, nothing uploaded

Exact error locations

Invalid syntax points to the exact line and column so you fix missing commas and brackets immediately.

100% private in-browser

Formatting happens in your browser, with parsing in a Web Worker. Your JSON is never uploaded or sent anywhere.

Recursive key sorting

Alphabetize object keys recursively all the way down for deterministic Git diffs while keeping arrays in order.

Live byte counters

Real-time size counters measure raw and minified text so you know exact bandwidth savings before transfer.

Technical Guide

What a JSON formatter actually does (and why whitespace matters)

JSON has no opinion about whitespace. {"a":1} and the same object spread across four indented lines are the identical document to a parser — the difference exists only for the person reading it. A JSON formatter, or beautifier, parses the text into abstract values and writes it back out with consistent indentation and line breaks. That is why it doubles as a validator: if it will not format, it will not parse, and the error names the exact line and column.

That matters most with JSON you did not write: a minified API response, a payload squeezed onto one log line, or a config file hand-edited until its nesting is unreadable. Sorting keys is the other half — objects are unordered by definition, so two equivalent payloads can produce chaotic Git diffs. Array order is left untouched, because arrays are ordered and sorting them would alter your data.

The output is standard JSON as defined by RFC 8259 and ECMA-404: formatting changes only whitespace and, if you ask, key order — never a value.

RFC 8259 TransformationLossless
Input Payload{"user":"Ada","roles":["admin"]}
Formatted Output{ "roles": ["admin"], "user": "Ada" }
Engine Specifications

Formatter Engine Standards

What the formatter does, and what it leaves alone.

  • ✓Standardized 2-space, 4-space, or tab indent
  • ✓Recursive alphabetical key reordering
  • ✓Lossless minification for network payloads
  • ✓Files up to 5 MB, parsed in a Web Worker
  • ✓Syntax error pinpointing (exact line & column)
IETF RFC 8259 & ECMA-404Standard JSON

Zero server uploads. Your JSON payloads are processed exclusively inside your browser sandbox.

Answers

Frequently asked questions

Formatting, minifying, key order and privacy, answered.

Is my JSON uploaded anywhere?
No. Formatting runs entirely in your browser — the JSON never reaches a server, and there is no request to log. You can confirm it by opening your network tab while you format.
Why did my file fail to parse?
The most common causes are a trailing comma after the last item, single quotes instead of double quotes, or an unquoted key. The error message names the line and column so you can go straight to it.
Does sorting keys change my data?
It reorders the keys of every object, which JSON treats as unordered, so the data is equivalent. Array order is never touched — that is meaningful and reordering it would change your data.
What is the difference between formatting and minifying?
Formatting adds indentation and newlines so a human can read the structure. Minifying removes every optional byte, which is what you want before sending JSON over a network.
Should I indent with 2 spaces, 4 spaces or tabs?
Two spaces is the most common convention for JSON and what most style guides assume. Four is easier to scan on deeply nested data. Tabs let each reader pick their own width, which matters for accessibility.
Can it handle comments or trailing commas?
Strict RFC 8259 JSON does not permit comments or trailing commas. If your payload contains them, click ⚡ Auto-Fix Syntax in the editor: it strips comments and trailing commas, and also repairs single quotes, unquoted keys, missing commas, unclosed brackets and Python literals such as True and None.
How do I pretty print JSON in code?
In JavaScript, JSON.stringify(value, null, 2) indents with two spaces. In Python, json.dumps(data, indent=2) does the same, and python -m json.tool file.json pretty prints a file from the terminal. With jq, jq . file.json prints formatted JSON. Paste the result here when you also want sorted keys or a tree view.

Related tools

More browser-based JSON utilities

Graph Visualizer — Live

Formatted it? Now see its shape.

Open the same JSON as a graph: every object becomes a node, an array of records collapses into one schema card, and clicking a node gives you its JSONPath.

GRAPH SCHEMA PREVIEWINTERACTIVE
Root: Object──►
├──user (Object)
└──roles [Array]
Node Graph Visualizer⚡ ZERO SERVER PROCESSING

Last updated