📐

XML Formatter and Minifier

Pretty print or minify XML, with automatic indentation for reading or compact output for transfer
XML 📂 Text 👤 ToolWorld 🏷️ v1.2.2
Loading...
Input Paste or type text; it is processed locally
XML
Settings Choose how to process
Mode

Everything runs in the browser; your text is never uploaded

Enter text and press process. Everything runs locally; nothing is uploaded

Result Copy the result in one click

How to Use

📖 Tool Introduction


Switch XML between indented formatting and a single compact line, for reading it or for sending it.

XML that comes back from an interface is usually one long line, which nobody can read. Formatting it with indentation makes the structure obvious within a second, and that is most of the value. Going the other way matters for transfer and storage, where stripping the whitespace between tags makes a real difference to size, particularly on logs and configuration that get written repeatedly.

Indentation is driven by a depth counter rather than by matching opening tags against closing ones, and that choice is what keeps the output aligned. A naive matcher that looks for a closing tag by name is upset by self closing tags, by comments and by the declaration, and the result is a document where everything after the first such element sits one level too deep. Counting depth and treating a self closing tag as neither opening nor closing avoids that entirely.

Minifying removes the whitespace between tags and nowhere else. Space inside an attribute value is data, and stripping it would quietly change what the document says, so it is left precisely as it was.

The result reports the input and output size and how many tags were seen, so the saving is visible rather than assumed. Everything runs in the browser, so what you paste never leaves your device.

A practical note on where each direction fits. Formatting is for the moment you are reading a response you did not write, trying to see which element holds the value you need, and indentation does more for that than any amount of staring at a single line. Minifying is for everything afterwards: payloads on the wire, files on disk, logs written in volume, where the whitespace is pure overhead. Both are one click apart because the same document passes through both stages constantly. Line endings are normalised on the way through, so a file that arrived with mixed endings comes out consistent.

✨ Key Features


  • Formatting: indents by depth so the structure is obvious
  • Minifying: removes whitespace between tags to reduce size
  • Self closing tags and comments do not disturb the depth
  • Spaces inside attribute values are preserved when minifying
  • Reports input size, output size and the tag count
  • Runs locally: nothing is uploaded

🚀 How to Use


  1. Paste XML source on the left
  2. Pick formatting or minifying on the right
  3. Press process, or use Ctrl plus Enter
  4. The result box shows the output and the change in size
  5. Copy result puts it on your clipboard

⚠️ Things to Note


  • Data source: Based on XML tag structure; conversion runs in the browser
  • Not a validator: This tidies the layout and does not check whether the XML is well formed
  • Attribute spaces kept: Minifying removes whitespace between tags only; spaces inside attribute values are untouched
  • Very large documents: For a huge file it is better to work through it in sections rather than rendering it all at once
  • Privacy: Everything runs in the browser. What you paste is never sent to a server

Related

⏫︎