๐Ÿ—œ๏ธ Developer toolMinify ยท Beautify ยท Validate

JSON & XML Minifier

Shrink JSON and XML for APIs, config files and feeds โ€” or beautify them again โ€” with validation, error positions and the exact bytes saved.

โ€”
โ€”Original
โ€”Result
โ€”Saved
โ† All Free Tools ๐Ÿ’ป Developer Tools

About the JSON & XML Minifier

The JSON & XML Minifier removes every unnecessary space, line break and comment from JSON and XML, so API responses, config files, sitemaps and product feeds load and transfer faster. The same tool beautifies minified data back into readable, indented text.

Input is checked with a real parser first, so the output is always valid. Errors show the line and column, and broken JSON links straight to our JSON Repair tool. JSON keys can be sorted for stable diffs, and XML keeps CDATA, namespaces and, if you want, comments and the XML declaration. Everything runs in your browser.

How to use it

  1. 1Paste JSON or XML, open a file, or load a sample. The format is detected automatically.
  2. 2Choose Minify to shrink it or Beautify to make it readable, and pick an indent.
  3. 3Check the badge and the bytes saved, or read the error message if the input is invalid.
  4. 4Copy the result or download it as a .json or .xml file.

What it can do

โšก
Real size savings

See the original size, the result size and the percentage saved.

โœ…
Validated output

Uses a strict parser, with line and column for JSON errors.

๐Ÿงฉ
XML-aware

Keeps CDATA, namespaces and processing instructions; comments are optional.

๐Ÿ”ค
Sort JSON keys

Alphabetical keys make JSON easy to compare in Git or a diff tool.

Frequently Asked Questions

What does minifying JSON or XML do?

It removes spaces, tabs, line breaks and comments that people need but computers do not. The data stays exactly the same, but the file gets smaller and faster to send.

How much smaller will my file get?

Usually 10โ€“40% for indented JSON or XML. The tool shows the exact saving for your file.

Will minifying change my data?

No. Values, attributes, CDATA sections and text content are preserved. Only whitespace between elements and, optionally, XML comments are removed.

Can it beautify minified JSON or XML?

Yes. Switch to Beautify and choose 2 spaces, 4 spaces or tabs.

My JSON is invalid. What now?

The error message shows the line and column. For common problems like trailing commas or single quotes, use the JSON Repair tool, which fixes them automatically.