Loading Techie Utils…

JSON, XML & YAML Minifier

Strip formatting from JSON, XML, YAML, TOML or TOON. Free, and runs entirely in your browser — nothing you enter is uploaded, stored or sent to a server.

About Structure Minifier

Strips every byte a consumer does not need: whitespace between nodes, indentation, and comments in markup. JSON, XML, YAML, TOML, TOON, INI, .env, .properties and HCL are parsed first, so the compact output is guaranteed to carry the same data.

YAML is the interesting case. It has no minified form of its own, so the compact output is flow style — which is valid YAML, since YAML is a superset of JSON, and is what a size-constrained field wants.

Where it helps

  • Parses before compacting, so the output cannot be silently corrupted.
  • Reports the size before, after and the percentage saved.
  • Comments and whitespace-only nodes are removed from markup, or kept when a licence header has to survive.
  • Non-ASCII characters can be escaped as \uXXXX, for a pipeline that does not carry UTF-8 safely.
  • Sorting keys produces a canonical form, which is what you want before hashing or comparing two payloads.
  • Works on every format, including YAML's flow-style equivalent.

Limits

  • Minified documents are hard to read; keep the formatted original in version control.
  • Gzip or Brotli on the server already removes most of this redundancy, so the real-world saving is smaller than the raw numbers suggest.
  • Removing whitespace from XML changes mixed content, where the spacing between elements is part of the text.
  • XML comments are dropped, which matters if a downstream tool reads them.

Frequently asked questions

Why does minified YAML look like JSON?

Because flow style is JSON-shaped, and YAML parsers accept it. It is the compact form of the same document.

Is minifying safe for XML?

For data documents, yes — whitespace between elements is not significant. It is not safe where mixed content relies on spacing, such as prose marked up inline.

How much will I actually save?

The size rows tell you exactly. Over a compressed transport, expect the marginal gain to be a few percent rather than the headline figure.

Can I get the document back?

Run the result through Structure Formatter. The data is identical, though the original comments and layout are gone.

Related tools

  • Structure Formatter — Pretty-print JSON, XML, YAML, TOML, TOON or HCL with a chosen indent
  • Minifier — Shrink CSS, HTML or JavaScript
  • Storage Units — Convert between decimal and binary data units
  • Structure Validator — Check JSON, XML, YAML, TOML, TOON or HCL and report structural problems
  • Structure Converter — Convert between JSON, XML, YAML, TOML, TOON, HCL and CSV
  • String Escaper — Escape a JSON, XML, YAML, TOML or TOON document for embedding, or read one back

More Structured Formats tools

  • Structure Converter — Convert between JSON, XML, YAML, TOML, TOON, HCL and CSV
  • String Escaper — Escape a JSON, XML, YAML, TOML or TOON document for embedding, or read one back
  • Structure Formatter — Pretty-print JSON, XML, YAML, TOML, TOON or HCL with a chosen indent
  • Structure Validator — Check JSON, XML, YAML, TOML, TOON or HCL and report structural problems
  • Tree Viewer — Explore JSON, XML, YAML, TOML, TOON or HCL as a collapsible tree
  • Code Generator — Turn a JSON, YAML, XML or other document into TypeScript, Go, C#, Python, Rust and more
  • Schema Generator — Write a JSON Schema, XSD, Avro schema or .proto from a document you already have
  • Schema Validator — Check a document against a JSON Schema, .proto, Avro schema, XSD or RELAX NG
  • Table Viewer — Show the records in a JSON, XML, YAML, TOML or TOON document as a table
  • Structure Compare — Diff two JSON, XML, YAML, TOML, TOON or HCL documents by path
  • Structure Repair — Fix broken JSON, YAML, XML, TOML, TOON, INI, .env, .properties and HCL, listing every repair
  • Path Finder — Select nodes with JSONPath or XPath
  • Protobuf & Avro Decoder — Read protobuf wire bytes and Avro container files without their schema
  • Expression Evaluator — Reduce a JSONPath or XPath match to a single answer