JSON Formatter
Format, validate and minify JSON in your browser. Errors are shown with the line, column and a plain explanation, and numbers are never altered.
Loading tool…
What is the JSON Formatter?
The JSON Formatter indents, minifies and validates JSON in your browser. Invalid JSON is reported with the line, column and a plain explanation, common mistakes can be repaired with one button, and numbers and strings are kept exactly as written.
Supported formats
- Input: JSON text, or a .json or .txt file up to 5 MB
- Output: formatted or minified JSON, as text or a .json download
- Strict JSON (RFC 8259): comments and trailing commas are reported as errors and can be repaired
Privacy and processing
Your JSON is processed in this browser tab and is not sent to ToolsWebPro servers. Files up to 5 MB can be opened, and nothing is kept after you leave the page.
How to use JSON Formatter
- 1Paste your JSON, open a file, or load the sample.
- 2Select Format to indent it or Minify to remove white space. Choose the indent and whether to sort keys.
- 3If the JSON is invalid, read the line, column and hint; use Repair common mistakes where it is offered.
- 4Copy the result or download it as a .json file.
What you can do
Format and minify
Indent with 2 spaces, 4 spaces or tabs, or strip all white space.
Validation with an exact position
The line and column of the first error, a snippet with a marker, and a hint for common mistakes.
Data kept exactly
Large numbers, 1.0, exponents and escaped characters come out as they went in.
Sort keys
Put object keys in order, by character code so capital letters come first, to compare two documents.
Repair common mistakes
Removes comments and trailing commas, and fixes single quotes, unquoted keys and Python-style True, False and None, listing each change.
Duplicate-key warning
Tells you when one object uses the same key twice.
When this tool helps
Reading API responses
Turn a one-line response into an indented document.
Finding a syntax error
Locate the comma or quote that stops a config file from loading.
Preparing data
Minify JSON for a request body, or sort keys before comparing two versions.
About JSON Formatter
JSON is a text format for data made of objects, arrays, strings, numbers, true, false and null. It is stricter than the JavaScript it came from: keys and strings need double quotes, a comma after the last item is not allowed, and comments are not part of the format. Those three rules cause most JSON errors, and this validator names them when it finds them. Many formatters work by reading the text into values and writing them out again, which quietly changes data: a number with more than about 16 digits is rounded, 1.0 becomes 1, and an escaped character can be rewritten. This formatter keeps the original text of every number and string and changes only the white space around them, so an ID such as 12345678901234567890 survives. If the same key appears twice in one object the JSON is still valid, but most programs keep only the last value, so the formatter warns you. The repair button handles a short list of mechanical mistakes and shows what it changed; it does not guess at missing brackets or values. To decode Base64 text found inside JSON, use the Base64 decoder.
Paste JSON to pretty-print it with 2 or 4 spaces or tabs, minify it, sort its keys, and check that it is valid. Errors point to the exact line and column and explain common mistakes such as trailing commas or single quotes, with a repair button for those. Unlike formatters that re-create the data, this one keeps every number and string exactly as written.
ToolsWebPro provides this tool free with no account required. Each tool explains its supported formats, processing limits and privacy behavior.
Frequently asked questions
- How do I format JSON?
- Paste it and select Format. Choose 2 spaces, 4 spaces or tabs for the indent. The formatted document appears in the output box, ready to copy or download.
- Why is my JSON invalid?
- The most common causes are a comma after the last item, single quotes instead of double quotes, keys without quotes, and comments. The validator shows the line and column of the first problem and explains it.
- Does formatting change my data?
- No. Only white space changes. Numbers, including very large ones, and strings are kept exactly as written, unlike tools that read the document and write it out again.
- Can it fix broken JSON automatically?
- It can repair a few common mistakes: comments, trailing commas, single-quoted strings, unquoted keys and Python-style True, False and None. It lists every change and leaves anything else for you to fix.
- Is my JSON uploaded to a server?
- No. Formatting and validation run in your browser, so API responses and config files stay on your device.
ToolsWebPro guides for JSON Formatter
Step-by-step tutorials and troubleshooting written for this tool.
View all guides →Related Utility Tools
More free tools on ToolsWebPro — including companions that pair well with JSON Formatter.
- Base64 Encoder & DecoderEncode text to Base64 or decode Base64 back to readable text. Handles UTF-8, emoji and URL-safe Base64URL. Converts as you type, nothing uploaded.
- CSV Delimiter Converter & Format FixerChange a CSV separator and review number or date changes column by column before downloading the result.
- SHA-256 Hash GeneratorGenerate SHA-256, SHA-1, SHA-384 and SHA-512 hashes of text or files and compare them with a published checksum. Local, instant, no upload.
- Word CounterPaste or type text to count words, characters, sentences and paragraphs as you write, with reading time, keyword density and character limits for posts.
- QR Code GeneratorCreate a free static QR code for a link, text, email, phone number or SMS. Pick colours and error correction, download PNG or SVG. No signup, no expiry.
- CSS clamp() CalculatorGenerate a fluid CSS size from two viewport endpoints, review the formula, and copy the px or rem expression into your layout.