Skip to content
  • Image CompressorImage Tools · Make photos and graphics smaller by re-encoding them as JPG or WebP, with a quality slider and optional downscaling.
  • Image ResizerImage Tools · Change the width and height of an image in pixels or by percentage, with high-quality downscaling.
  • Image ConverterImage Tools · Change the format of one or many images to JPG, PNG or WebP, with control over quality and transparency.
  • Image CropperImage Tools · Cut out part of an image with a draggable selection, aspect ratio presets and exact pixel inputs.
  • Rotate & Flip ImageImage Tools · Turn a picture by 90° or 180° and mirror it horizontally or vertically, with a live preview.
  • Merge PDFPDF Tools · Combine several PDF files into one document, in the order you choose, with optional page ranges per file.
  • Split PDFPDF Tools · Extract pages into a new PDF or split a document into several files by page, range or fixed page count.
  • Reorder PDF PagesPDF Tools · Change the page order of a PDF with drag and drop, delete unwanted pages and save the result.
  • Rotate PDFPDF Tools · Turn individual pages or the whole document by 90° steps, preview the result and save the corrected PDF.
  • Images to PDFPDF Tools · Combine photos and scans into a single PDF, one image per page, with page size, orientation and margin options.
  • JSON Formatter & ValidatorDeveloper Tools · Validate JSON with precise error locations, then pretty-print, minify or sort keys without changing any value.
  • Base64 Encoder & DecoderDeveloper Tools · Encode text or files to Base64 (standard or URL-safe) and decode Base64 or data: URLs back to text or a downloadable file.

JSON Formatter & Validator

Validate JSON with precise error locations, then pretty-print, minify or sort keys without changing any value.

Runs locally in your browser – your data is not uploaded

Loading tool…

About the JSON Formatter & Validator

JSON is the everyday format of APIs, configuration files and logs, and a single missing comma or stray quote makes a whole document unreadable for a program. This tool checks JSON against the strict standard (RFC 8259), tells you exactly where the first problem is, and turns valid JSON into neatly indented text – or minifies it to the smallest form.

Many online formatters run your text through JSON.parse and JSON.stringify, which silently rounds large integers, shortens 1.10 to 1.1, rewrites escape sequences and keeps only the last of two duplicate keys. This tool uses its own parser instead: every number and string is written back exactly as it appeared, and duplicate keys are reported rather than dropped.

Everything runs locally in your browser. Text you paste and files you open are processed on your device and are not uploaded anywhere.

How to use it

  1. Paste your JSON into the JSON input box, click Load sample to try the tool, or use Open a file to load a .json or .txt file of up to 20 MB.
  2. Read the status message: Valid JSON with a summary of the contents, or Invalid JSON with the line, column and an excerpt that points at the problem. Click Go to error to select that spot in the input.
  3. Choose the Indentation (2 spaces, 4 spaces or Tab) and tick Sort keys A–Z if you want object keys in alphabetical order.
  4. Click Format for indented output or Minify to remove all optional whitespace. While the input is under 1 MB, the result follows your edits and option changes automatically.
  5. Use Copy result or Download .json to take the output with you.
  6. For inputs larger than 1 MB, click Validate, Format or Minify – such inputs are not checked while you type, to keep the page responsive.

Features

  • Error messages you can act on: The first syntax error is shown with its line, column and character offset plus a code excerpt with a caret. Common mistakes – trailing commas, single quotes, comments, unquoted keys, NaN, leading zeros, unescaped line breaks in strings – get a specific explanation.
  • Lossless formatting: Numbers keep every digit (12345678901234567890 stays exact, 1.10 keeps its trailing zero) and strings keep their escape sequences, so formatting never changes what the document means.
  • Duplicate key detection: Keys that appear twice in the same object are listed with their position. Both entries stay in the output, so nothing disappears without you noticing.
  • Format, minify and sort: Indent with 2 spaces, 4 spaces or tabs, or minify. Sorting orders object keys at every level; arrays keep their order.
  • Document statistics: See the size in bytes, the nesting depth, the number of keys and values, and how many objects, arrays, strings, numbers, booleans and nulls the document contains.

Examples

Finding a trailing comma in an API payload

Pasting {"name": "Ada", "tags": ["math", "poetry",]} reports "Trailing commas are not allowed in JSON" at line 1, column 42, with the caret under the extra comma. Remove it and the status changes to Valid JSON.

Keeping large IDs intact

In JavaScript, JSON.parse turns {"id": 9007199254740993} into 9007199254740992. Formatting it here keeps 9007199254740993 and adds a note that the number is beyond the range many parsers can represent exactly.

Comparing two configuration files

Format both files with Sort keys A–Z and the same indentation, then compare them with a diff tool. Differences in key order and whitespace disappear, so only real changes remain.

Shrinking a request body

Click Minify on pretty-printed JSON to remove indentation and line breaks. The Change tile shows how many bytes were saved compared with the input.

Limitations and notes

  • Only strict JSON is accepted. Comments, trailing commas, single-quoted strings, NaN, Infinity and other JSON5 or JSONC extensions are reported as errors; the tool does not repair them automatically.
  • Only the first syntax error is reported. After you fix it, the next one (if any) appears.
  • Nesting is limited to 10,000 levels of objects and arrays, and results are limited to 200 million characters.
  • Files must be UTF-8 encoded and at most 20 MB. Inputs over 1 MB are checked on demand, and very large results are shown as a preview in the box – Copy result and Download .json always use the full output.
  • Sort keys A–Z compares keys by their UTF-16 code units, the same order as JavaScript’s default sort: uppercase letters come before lowercase ones, and the order is not language-aware.
  • Column numbers count UTF-16 code units, so an emoji or another character outside the Basic Multilingual Plane counts as two columns, as in many code editors.

Frequently asked questions

Why is the error reported on the line after my actual mistake?

The parser reports the first place where the text can no longer be valid JSON. A missing comma, for example, is only detected when the next value starts, and a missing closing bracket is detected at the end of the input. The message says what was expected, which usually points to the real cause.

Does formatting change my numbers or strings?

No. The tool keeps the exact text of every number and string from your input, so big integers, trailing zeros, exponents such as 1E+2 and escape sequences such as \u00e9 come out exactly as they went in. Only whitespace (and the key order, if you choose Sort keys A–Z) changes.

Are duplicate keys allowed in JSON?

The JSON standard says names within an object should be unique, but does not forbid duplicates, and parsers handle them differently – most keep only the last value. This tool accepts them, warns you with the exact location, and keeps every entry in the formatted result.

Can it read JSON with comments (JSONC) or JSON5?

No. Those formats are extensions used by some editors and tools, and they are not valid JSON. The tool points out the comment, trailing comma or single quote so you can remove it.

Is my JSON uploaded to a server?

No. Parsing and formatting run in JavaScript on this page, and files are read directly from your device. Nothing you paste or open is sent over the network.

More free tools