Format, beautify, and validate JSON data with proper indentation.
The JSON Formatter beautifies or minifies JSON with your choice of 2 spaces, 4 spaces or tabs, and can sort keys alphabetically. Invalid JSON is reported with its line and column so you can fix it quickly. Everything runs in your browser.
Made for developers. Typical uses:
Paste a minified API response like {"user":{"id":42,"name":"Alex","roles":["admin","editor"]}} and Format instantly expands it into properly indented, nested lines with each key, value, and bracket on its own line — making it easy to spot that "roles" is an array of two strings instead of scanning one dense line of text.
Numbers with more than 15 to 16 significant digits lose precision, as in any JavaScript-based tool. It formats and checks syntax but does not validate against a schema.
Accuracy: Output is tested against known inputs. For production code, review the result and run your own tests.
Expert Tip
When debugging an "invalid JSON" error, check the reported error location first rather than re-reading the whole file — trailing commas and unescaped quotes inside strings are the two most common culprits.
JSON is the format most web APIs and configuration files use, and it is often delivered as one long line with no spaces. The JSON Formatter turns that line into an indented, readable structure, or does the opposite and removes all spaces to make it as small as possible. Take the compact text {"name":"Ada","tags":["a","b"],"address":{"zip":"E1 6AN","city":"London"},"active":true}. Beautified with two spaces it becomes a nested layout that is 133 characters long, and minified it is 88 characters. The data is identical in both.
Three settings control the output.
Real-world JSON often has small mistakes. The formatter reports each with its line and column and a hint, so you can fix it quickly.
JSON is stricter than JavaScript object syntax, which is why code that looks right is rejected. Names and strings must use double quotes. Trailing commas are not allowed. Comments are not part of the format. Values can be strings, numbers, true, false, null, arrays and objects, and the only way to show a missing value is null. If you need to check a document against these rules without changing it, the JSON Validator does that, and for a schema use the JSON Schema Validator.
The tool runs JavaScript in your browser, and JavaScript stores numbers as 64-bit floating point values, so integers with more than 15 or 16 significant digits lose precision. The number 12345678901234567890 comes back as 12345678901234567000. If you handle identifiers that long, keep them as strings in your JSON. The formatter checks syntax but does not check meaning.
To shrink JSON for production, the JSON Minifier parses first and reports errors. To compare two documents by key, use the JSON Diff Checker. To turn a list of records into a spreadsheet, use JSON to CSV. Everything runs in your browser, so API responses with private data are not uploaded.
A sensible routine is to format a response when you debug, minify the data you ship, and sort keys when you want a stable file that produces clean differences in version control. Keep a formatted copy of any configuration file you edit by hand, because the readable layout makes mistakes obvious before they reach production.
Why JSON that looks fine still fails to parse: trailing commas, single quotes, comments, NaN and oversized numbers, and how to validate, format and compare it fast.
Explore more in Developer Tools, read the guides and articles, or see how we test our tools.
Encode text and data to Base32 format.
Best for generating or inspecting a Base32-encoded TOTP secret key for two-factor authentication setup
Encode and decode Base64 strings instantly.
Best for encoding binary data for email and web transmission
Check color contrast ratios for WCAG compliance.
Best for checking that body text color meets WCAG AA contrast requirements before shipping a website
Parse and understand cron expressions with human-readable descriptions.
Best for confirming a scheduled job in a server crontab actually runs when you think it does before deploying it
Convert external CSS to inline styles for HTML emails.
Best for converting a designed HTML email template into inline-styled markup before sending a campaign
Format and beautify messy CSS code with proper indentation.
Best for beautifying minified CSS for editing
Format and beautify JavaScript code with proper indentation.
Best for making a minified third-party script readable enough to debug in dev tools
Format and beautify SQL queries with proper indentation.
Best for formatting complex SQL queries for readability