Skip to content
FormatKit

Free online JSON formatter and validator

JSON formatter that points at the typo

This JSON formatter is free, needs no signup, and re-indents a document the moment you paste it — 2 spaces, 4 spaces or a tab, with optional A–Z key sorting and a Minify switch that puts it all back on one line. It handles documents up to 5 MB, and when the JSON does not parse it names the line, the column and the reason rather than throwing “unexpected token” at you. Number literals, key order and duplicate keys come out exactly as they went in, because the parser works on the source text instead of converting it to JavaScript values first.

  • 100% free
  • No signup
  • Up to 5 MB
  • Sort keys A–Z
  • Exact error line
Formatted JSON

The formatted result appears here.

Paste JSON, drop a file, or press Ctrl+V anywhere on this page.

All 65 tools

65 browser tools for the formats developers actually paste: JSON, XML, YAML, CSV, SQL, Markdown and base64. Formatting, validation, conversion, diffing, encoding and minification — every one of them free and open in one tab.

Format & beautify · 7 tools

Encode & decode · 9 tools

Dev utilities · 10 tools

Markdown · 7 tools

Convert · 10 tools

How to format JSON

Three steps, a couple of seconds, no signup and nothing to install.

  1. Paste or drop your JSON

    Paste the document into the left panel, hit Ctrl+V — ⌘V on a Mac — without clicking into it first to pull a .json file off the clipboard, or drag one onto the editor. Anything up to 5 MB loads, including .geojson exports, .har network captures and lock files.

  2. Pick an indent, or switch to Minify

    Choose 2 spaces, 4 spaces or a tab and the right panel re-indents as you type. Tick “Sort keys A–Z” to order every object by key, recursively, so two payloads become comparable line by line. Minify does the reverse and returns the whole document on one line.

  3. Copy or download the result

    Copy puts the entire document on the clipboard even when the preview stops at 5,000 lines, and Download saves it as .json — or .min.json in minify mode. If the JSON does not parse, the bar underneath prints the line, the column, and a caret under the character at fault.

Technical specifications

Accepted inputAny RFC 8259 document — an object, an array, or a bare string, number, true, false or null at the top level; .json, .geojson, .har, .webmanifest, .map and .txt files
OutputIndented with 2 spaces, 4 spaces or a tab, or minified onto a single line
Maximum document size5 MB (5,242,880 bytes) — a 5 MB array of 36,000 records re-indents in about 0.3 seconds and minifies in about 0.2
Error reportingLine, column, the cause in plain English, and a caret under the offending character
Kept exactly as writtenNumber literals including 20-digit IDs, duplicate keys, key order, and \uXXXX escapes inside strings
Key sortingOptional and recursive, by UTF-16 code point — the ordering jq -S produces
Nesting limit500 levels, past which no mainstream JSON parser will accept the document
Processing locationYour browser — the document is never uploaded to a server
PriceFree, no signup, no limit on the number of documents

Frequently asked questions

How do I format JSON online?

Paste the document into the left panel and the indented version appears on the right straight away. Pick 2-space, 4-space or tab indentation in the toolbar, then press Copy or Download. There is nothing to install and no account to create.

Is this JSON formatter free?

Yes, and there is no paid tier to run into: no signup, no daily quota, no cap on how many documents you format, and nothing appended to the output. The only limit is 5 MB per document.

What does “Unexpected token” in JSON mean?

It means the parser hit a character that cannot legally appear where it found it, and the usual culprits are five: a trailing comma before } or ], single quotes instead of double quotes, an unquoted property name copied out of JavaScript, a // or /* comment, and NaN or undefined where a value belongs. This page names the cause instead — “Trailing comma: JSON does not allow a comma before the closing }” — with the line, the column and a caret under the character.

Why do other formatters change my large ID numbers?

Because they run the document through JSON.parse, where every number becomes a 64-bit float, and integers above 9,007,199,254,740,991 cannot be represented exactly — 9007199254740993 comes back as ...92, and 1.500 comes back as 1.5. This formatter keeps every number as the text you typed, so Twitter-style snowflake IDs, order numbers and fixed-decimal prices come out byte for byte the way they went in.

Can I sort JSON keys alphabetically?

Yes — tick “Sort keys A–Z” and every object in the document is sorted, not just the top level. Sorting compares UTF-16 code points, the same ordering jq -S uses, which puts uppercase letters before lowercase ones and digits before both. Sorting two payloads the same way before diffing them removes the false differences that come from key order alone.

What is the largest JSON file this can format?

5 MB per document, which is roughly 36,000 records of typical API shape. A 5 MB array re-indents in about 0.3 seconds on an average laptop, and the preview pane stops drawing at 5,000 lines while Copy and Download still hand you the whole thing. Above 5 MB the tool asks you to split the array rather than freezing the tab.

Is my JSON uploaded to a server?

No. The parser and the printer are JavaScript running inside your own tab, so the document never leaves the machine. A side effect worth knowing: once this page has loaded, formatting keeps working with the network switched off.

About formatting JSON

Formatting JSON looks like a whitespace problem and is really a parsing problem. A tool that indents with regular expressions will happily pretty-print a document that no parser accepts, which is the worst possible outcome: the payload now looks correct and still breaks in production. Everything here goes through a real parser first, so a document that renders on the right is a document that will parse anywhere — the same check the JSON checker performs when validation is all you need.

The reason this page keeps the source text of every value is that the obvious implementation, JSON.parse followed by JSON.stringify, quietly rewrites three things. Numbers become 64-bit floats, so a 19-digit ID loses its last digits and 1.500 becomes 1.5. Duplicate keys collapse to the last one, even though RFC 8259 only says names should be unique. And any key that looks like a non-negative integer jumps to the front in numeric order, because that is how JavaScript objects store properties — feed {"10":"a","2":"b"} through that round trip and the keys come back swapped. Members are held in an array here, in the order you wrote them, so re-indenting a document changes its layout and nothing else.

In practice formatting is the first half of a job and something else is the second. Indent a webhook payload to read it, then sort both sides before you compare two JSON documents so that re-ordered properties stop registering as changes. Paste a config file, fix the comma the caret is pointing at, then minify it — a document indented with two spaces is around 35% larger than the same data on one line, which is worth reclaiming in a request body or an environment variable.

Where your JSON is processed

Everything happens in the browser tab you are reading this in. The document you paste is parsed and re-printed by JavaScript on your own machine and is never uploaded, logged or stored — which is also why the formatter keeps working after you disconnect from the internet, and why closing the tab is enough to be rid of the payload.