Format JSON Online

Free Online JSON Formatter

Free online JSON formatter. Paste JSON or add a .json or .txt file, select a 2 or 4 space indent, press Format and copy or download the result. Minify, Sort Keys, Remove Nulls, Escape and Unescape sit in the same bar.

Developer tools by OnlinePCApps since 2013

No upload Beautify or minify Validate Free
0
Bytes uploaded
6
JSON data types
0
Files stored
$0
Free, always
Why format JSON

Online JSON Formatter for Payloads and Configs

A minified API response is one long line, and a broken payload fails without saying where. The free online JSON formatter makes it readable and flags it when it will not parse.

Make a Payload Readable

An API response or a webhook body often arrives minified, one dense line with no spacing. The online JSON formatter adds indentation and line breaks, so the nesting and the shape of the data become clear at a glance.

A dense line turned readable.

Find the Exact Error

A trailing comma or a missing quote breaks an entire payload, and a plain parser only says it failed. A status light turns red with Invalid JSON and the parser message shows under the Input box, so the one bad character is found sooner.

The error spotted, not hunted.

Measure a Payload

Once the JSON is valid, six tiles show its Depth, Keys, Arrays, Characters, Minified size and Formatted size. The online JSON formatter shows how deep a payload nests and how many bytes minifying saves before it goes anywhere.

A payload measured, not guessed.
How it works

Format JSON Online in Three Steps

1

Paste the JSON

Paste the JSON into the Input box of the online JSON formatter, or select Upload to add a .json or .txt file. An API response, a config, a webhook body or any JSON text works as input.

{…} FORMAT indent
2

Select the Indent and Format

Select a 2 or 4 space indent, then press Format to beautify or Minify for one compact line. A status light shows Valid JSON or Invalid JSON as you type, and Sort Keys, Remove Nulls, Escape and Unescape sit in the same bar.

valid ✓
3

Copy or Download

Select Copy for the Output, Copy Minified for one line or Download to save output.json. The online JSON formatter keeps the input as it was, so the same JSON can be formatted again with the other indent.

Formatted JSON Beautify or minify
Validate Live status light
One payload Download output.json
Need it faster?

Desktop JSON Formatter for Huge Files

The online JSON formatter takes one payload per run. A multi-gigabyte file belongs to the desktop edition or jq.

Get Desktop Version Free trial · Windows 7 to 11
What the free tool does

What the Online JSON Formatter Does

To format JSON is to tidy, validate or compact the same data. The online JSON formatter does all three from one bar.

Beautify With a 2 or 4 Space Indent

The online JSON formatter pretty-prints the JSON with a 2 or 4 space indent, so the nesting stays clear. Only the whitespace moves, since every key and value stays as it was. The panel has no tab option.

Minify to One Line

Minify strips every space and newline to the most compact valid JSON, the form a production payload ships in. Copy Minified puts that one line on the clipboard without touching the Output box.

Validate as You Type

A status light shows Valid JSON or Invalid JSON as you paste. On an error, the parser message shows under the Input box, like an unexpected token or a missing quote. A valid payload is confirmed at once.

Sort, Clean and Escape

Sort Keys puts the keys of every object in alphabetical order. Remove Nulls drops null members. Escape turns the JSON into one string, and Unescape turns a JSON string back into plain text.

To format JSON, to beautify a payload and to validate a config all name one task. A search for online JSON formatter or JSON validator reaches the online JSON formatter above, and the input stays as it is.

Reference

Online JSON Formatter Results, Case by Case

JSON has a strict grammar, and the online JSON formatter tidies without touching the data. The cases below run from clean to not on this page.

The caseResultWhat happens and why
Beautify2 or 4 spaceThe online JSON formatter pretty-prints with the chosen indent. There is no tab option.
Minifyone lineStrips every space and newline to the most compact valid JSON.
Validatestatus lightShows Valid JSON or Invalid JSON as you type, with the parser message under the Input box. There is no line pointer or repair.
Data typessix onlyString, number, boolean, null, object and array only.
Strict rulesRFC 8259Double-quoted keys, no trailing comma and no comments in standard JSON.
JSON5rejectedSingle quotes, trailing commas and comments are flagged, not accepted.
Big numbersprecisionAn integer beyond the safe range can lose precision as a 64-bit float.
Duplicate keysdeduplicatedA repeated key is collapsed to the last value on the parse round trip.
Sort Keysa to zThe online JSON formatter puts the keys of every object in alphabetical order. Format alone keeps the order that arrived.
Remove Nullsdrops nullRemoves every member whose value is null, at every level.
Escape and UnescapeJSON stringEscape wraps the text as one JSON string. Unescape expects a quoted string like "hello". For why escaping is not encryption, see Hashing vs encryption vs encoding and what each does.
Statssix tilesDepth, Keys, Arrays, Characters, Minified size and Formatted size, once the JSON is valid.
Source file.json .txtPaste the text or select Upload. For broken characters in a file, see Character encoding explained and why text arrives broken.
Outputoutput.jsonThe online JSON formatter offers Copy, Copy Minified and Download. A tree view is not on this page.
Where it runson the deviceThe JSON is formatted in the browser, so nothing is uploaded.

How JSON Formatting Works

JSON, short for JavaScript Object Notation, is a text format for data made of six building blocks: a string, a number, a boolean, null, an object and an array. It came out of work by Douglas Crockford and is now fixed by two standards that agree, RFC 8259 and ECMA-404. Formatting does not alter the data, only its shape on the page. The online JSON formatter parses the text and outputs it again, with an indent for a beautify or with none for a minify, so the same payload stays clear or ships compact. The strict grammar is where the honest points live. Standard JSON needs double-quoted keys, allows no trailing comma and permits no comment, which is exactly why a payload copied from JavaScript often fails to validate in an online JSON formatter. Those relaxed features belong to JSON5, a separate superset that shows as Invalid JSON here. Two more points are worth stating. A number beyond the safe integer range can lose precision, since JSON numbers ride on a 64-bit float, and a duplicate key is collapsed to its last value when the data round-trips through a parser. The references below define the standard.

Honest comparison

Online JSON Formatter vs the Command Line

Both the online JSON formatter and the command line format JSON. The trade is between a quick visual tidy and a scriptable query engine.

Point of comparison This tool Online JSON formatter On the device The command line A local terminal tool
Where the payload goes Stays in the browser Stays on the machine
Price and caps Free with no sign-up Free tier often capped
A multi-gigabyte file Built for one payload per run Streams from disk
Query and transform Format, sort and clean only jq filters and reshapes
A quick tidy or check Paste, press Format, done A filter to write first

jq on the command line wins for a multi-gigabyte file or a query that filters and reshapes the data in a script. The online JSON formatter wins for a fast beautify, minify or check with a status light and no install. Online file tools and whether yours uploads goes deeper on where a payload goes.

Why no upload

Online JSON Formatter Privacy and Data Handling

The JSON is parsed and re-serialized inside the browser by the native JSON.parse and JSON.stringify, so the work is client-side and the payload stays on the machine that opened it. Nothing is handed to a server to format it.

A JSON payload often carries an access token, an API key or real user records never meant for an outside server. A hosted formatter has to receive all of that on upload, needless exposure when the browser can tidy it locally.

1. Open the browser tools at the Network tab
2. Clear the log and let it record
3. Format some JSON with the online JSON formatter above
→ Nothing uploads. The JSON was formatted on the page itself.
0
Bytes uploaded
0
Files stored
0
Accounts required
0
Watermarks added
Alternatives

Online JSON Formatter Alternatives

All of these format JSON. They vary on reach, on effort and on where the payload goes.

jq

jq formats, filters and reshapes JSON from the terminal.
It handles a huge file and fits a script.
Limit: Needs a query language to learn first.

An Editor

VS Code formats an open JSON file with a shortcut.
It edits right where the file already lives.
Limit: Needs the file open in the editor first.

In Code

JSON.stringify pretty-prints in a console or a script.
It fits straight into the program using the data.
Limit: No Valid or Invalid status light.

python -m json.tool

Python pretty-prints and validates a file in one command.
It ships with Python and needs no extra install.
Limit: Lives in the terminal with no live view.

jq, an editor and a console all format JSON, yet every one needs a query language, an open file or the terminal. The online JSON formatter above needs only a browser and shows a live status light.

Before converting

Three Things to Know Before Using an Online JSON Formatter

Three pointers save a puzzling error in the online JSON formatter.

The Online JSON Formatter Needs Strict JSON

Standard JSON allows no trailing comma, no comment and no single quotes. Those are JSON5 features, and pasting them in will flag an error. Remove the non-standard syntax first, then format the strict JSON that is left.

Watch Large Numbers

A JSON number rides on a 64-bit float, so an integer beyond the safe range, like a long ID, can lose precision on a round trip through an online JSON formatter. Where an exact big number matters, carry it as a string rather than a number.

Duplicate Keys Are Merged

Standard JSON does not forbid a repeated key, but a parser keeps only the last one. So the online JSON formatter silently drops the earlier duplicate on a beautify, which is worth knowing if a payload was built with a key written twice.

The desktop edition

Desktop JSON Formatter for Large Payloads

The online JSON formatter takes one payload per run, which suits most debugging. A multi-gigabyte file, a folder of JSON or a query that filters the data belongs on jq or the desktop edition, and both work from disk.

On this pageone payload per run
On the command linean entire file in one pass
Huge Files

A multi-gigabyte file is streamed from disk and formatted, past what one paste on this page is built for.

Query and Filter

jq filters, maps and reshapes the data with a query, far past what a beautify or a minify does on its own.

In a Pipeline

A format or validate step runs inside a build or a hook, so a payload is checked automatically, ready for a repeated workflow.

Common questions

Online JSON Formatter Questions

Paste your JSON into the Input box or select Upload to add a .json or .txt file, select a 2 or 4 space indent, then press Format. The result shows in the Output box with Copy and Download buttons. A status light shows Valid JSON or Invalid JSON as you type. To turn a spreadsheet export into JSON first, use the online CSV to JSON converter.
Paste your payload, leave the indent on 2 or select 4, and press Format. The Output box shows your JSON with line breaks and indentation. Select Copy or Download to save output.json. Your original text stays in the Input box.
No. The JSON is parsed and re-serialized by the browser's native JSON.parse and JSON.stringify, so the payload never leaves the device. This matters, since a payload often carries an access token, an API key or real user records.
Format beautifies your JSON by adding indentation and line breaks so you can read the structure. Minify removes every space and newline for the most compact form a payload ships in. Both parse to exactly the same data, since only the whitespace moves. Copy Minified gives you the compact line without touching your Output box.
A status light under the toolbar shows Valid JSON or Invalid JSON as you type or paste. On an error, the parser message shows under the Input box, like an unexpected token or a missing quote. The panel has no line pointer and no auto-repair, so use the message to find the spot in your text.
The panel offers 2 spaces and 4 spaces, and 2 is selected first. It has no tab option. If you need tabs, press Format with either indent and swap the spaces for tabs in your editor.
Strict JSON, the standard, needs double-quoted keys, allows no trailing comma and permits no comment. JSON5 is a relaxed superset that adds single quotes, trailing commas, comments and unquoted keys. The online JSON formatter checks strict JSON, so your JSON5 syntax shows as Invalid JSON.
Because standard JSON does not allow a comma after the last item in an object or an array, even though JavaScript does. It is the most common mistake when copying a JavaScript object into JSON. Remove the trailing comma and it will validate.
Yes. Select Sort Keys and the keys of every object go into alphabetical order in your Output box, which helps when you compare two payloads. Format alone keeps your members in the order they arrived, since standard JSON needs no key order. To compare two payloads line by line, use the online text diff.
Remove Nulls drops every member whose value is null. Escape turns your JSON text into one escaped JSON string, and Unescape turns a JSON string back into plain text. Unescape expects a quoted string like "hello" and shows a message for anything else. Escape is encoding, not encryption, and Hashing vs encryption vs encoding and what each does explains the gap.
Once your JSON is valid, six tiles show Depth, Keys, Arrays, Characters, Minified size and Formatted size. They tell you how deep your nesting runs and how many bytes minifying saves.
No. The panel shows your result as indented text in the Output box and has no collapsible tree. For a deep object, format with a 2 space indent and fold the lines in your editor. To test a pattern against a value, use the online regex tester.
Yes. A JSON number rides on a 64-bit float, so an integer beyond the safe range, around nine quadrillion, can shift on a round trip. Where an exact long ID or a big integer matters, carry it as a string rather than a number.
No. Beautify and minify change only the whitespace, and the keys, values and structure stay the same. The two exceptions are a duplicate key that collapses to its last value and a huge number that can lose precision as a float.
Yes. Select Upload and add a .json or .txt file, and its text fills your Input box. A config or an API response saved to a file works. Download saves your result as output.json. If accents or symbols look broken, Character encoding explained and why text arrives broken covers the cause. To move a payload through a header or a token, try the online Base64 encoder.
Validation uses the same strict rules a browser and Node apply to JSON.parse, so a payload that shows Valid JSON here parses the same way in JavaScript. Other languages follow the same standard. Test a sample from your own code before you format a big one. For epoch values inside your payload, use the online timestamp converter.
Yes. The online JSON formatter runs in a mobile browser as well as on a desktop, so you can paste or add your JSON without an app. A large payload is steadier on a computer.
The page is cheap to host, and since the work happens on the device nothing is received or kept here. The wider suite of tools is what supports the site. There is no cap, no watermark and no sign-up.

OnlinePCApps Developer Group

Written and reviewed by Janos Kovac, who has worked on data formats and developer tools here since 2013

Last reviewed October 2026
13
Years on dev tools
0
Payloads uploaded
6
JSON data types
0
Watermarks

Most JSON trouble comes down to one thing, which is that standard JSON is stricter than the JavaScript it grew out of. A trailing comma, a single quote or a comment is fine in a JavaScript object and invalid in JSON, so a payload copied from code often fails to validate. The fix is to strip those JSON5 habits back to the strict form. That is why a good JSON formatter both tidies and validates, with a clear Valid JSON or Invalid JSON status rather than a bare failure. Format and Minify only move the whitespace, so the data is untouched, with two honest exceptions worth remembering. A duplicate key collapses to its last value on the parse, and a number beyond the safe integer range can drift because JSON numbers are 64-bit floats, which is why a long ID is safer as a string. The online JSON formatter takes a paste or a .json or .txt file, offers a 2 or 4 space indent and adds Sort Keys, Remove Nulls, Escape and Unescape to the same bar.

Standards followed

JSON · RFC 8259 ECMA-404 · Grammar JSON.parse · Native json.org · Crockford
Built on the same shared design system as every OnlinePCApps tool. onlinepcapps.com

Format JSON Online for Free

No sign-up and no cost. Paste JSON into the online JSON formatter, select an indent and press Format.

Format JSON Free, no account Try Desktop Edition For huge files and jq
Format JSON