JSON Formatter

A JSON formatter turns raw or minified JSON into indented, readable text and checks that it is valid. Paste JSON or open a .json file and this free tool formats it instantly with 2 spaces, 4 spaces or tabs, can minify it or sort keys alphabetically, and reports syntax errors with the line and column. Everything runs locally in your browser.

Free, no signup. Runs entirely in your browser; files and text are not uploaded.

How to use the JSON Formatter

  1. Paste JSON into the JSON input box, or click Open file to load a .json file.
  2. Choose Beautify or Minify and pick an indent of 2 spaces, 4 spaces or Tab.
  3. Tick Sort keys A–Z if you want object keys in alphabetical order.
  4. If an error appears, click Go to error or Auto-fix common issues.
  5. Click Copy or Download to save the formatted JSON.

Features

  • Beautifies JSON with 2-space, 4-space or tab indentation
  • Minifies JSON and shows how much smaller it is
  • Validates as you type and reports the error line and column
  • Auto-fixes trailing commas, comments, single quotes and unquoted keys
  • Sorts object keys alphabetically at every level
  • Opens .json files and downloads the result

Frequently asked questions

How do I know if my JSON is valid?

Paste it into the input. Valid JSON shows a green "Valid JSON" message; invalid JSON shows the parser error with the line and column, plus a plain-English hint about the likely cause.

Why is my JSON invalid when it works in JavaScript?

JSON is stricter than JavaScript object literals: keys and strings need double quotes, and comments, trailing commas, single quotes, undefined and NaN are not allowed. The Auto-fix button repairs the most common of these.

What is the difference between beautify and minify?

Beautify adds line breaks and indentation so people can read the data. Minify removes all unnecessary whitespace so the file is as small as possible for APIs and storage. Both contain exactly the same data.

Is my JSON uploaded to a server?

No. Parsing and formatting use your browser's built-in JSON engine, so the data never leaves your device. Files you open are read locally.

Related tools

  • SQL Formatter – Beautify or minify SQL for MySQL, PostgreSQL, SQL Server, Oracle, BigQuery and more
  • JWT Decoder – Decode JWT header, payload and claims with expiry status – signatures are not verified
  • Base64 Encoder – Encode text or files to Base64 and decode it back, with UTF-8 and URL-safe support
  • HTML Formatter – Indent or minify HTML, keep pre/script content safe and flag unclosed tags

Built and reviewed by Naqash Thaheem, Technical Project Manager. Last reviewed 2026-09-24.