JSON, XML & YAML Formatter & Minifier – Free Online Pretty Print Tool

Format, minify, and validate JSON, XML, and YAML — all in one tool, entirely in your browser. Paste any structured data and the tool auto-detects the format. Pretty-print with configurable indentation (2 spaces, 4 spaces, or tabs), or minify to a compact single-line output with the exact size reduction shown. For JSON, optionally sort all keys alphabetically (useful for diffs). Includes a Convert tab for JSON → YAML and JSON → XML transformations. Instant syntax error detection with detailed error messages. Perfect for developers, DevOps engineers, and anyone working with APIs, config files, or data pipelines.

How to Use the JSON, XML & YAML Formatter

Format & Minify tab:

  • Auto-detect: Paste any content — the tool detects JSON, XML, or YAML automatically.
  • Pretty Print: Adds indentation and newlines for maximum readability.
  • Minify: Strips all unnecessary whitespace. Shows the exact size reduction (%).
  • Indent size: Choose 2 spaces, 4 spaces, or tabs to match your project's style.
  • Sort keys A–Z (JSON): Recursively alphabetizes all object keys — great for diffing.
  • Validation: A green/red banner shows whether the input is valid and highlights the error message.

Convert tab — JSON to YAML / XML:

  • JSON → YAML: Converts any valid JSON object into properly indented YAML — handling nested objects, arrays, strings with special characters, null values, and booleans.
  • JSON → XML: Wraps valid JSON in an XML document with a <root> element, recursively serializing all object keys as elements and arrays as repeated sibling elements.