IT Market
Tools/Code/Documents/XML Formatter Online — Pretty Print and Minify
XML FORMATTER

Форматируйте XML с отступами

Tool guide

XML Formatter Online — Pretty Print and Minify

XML from an integration, a marketplace feed or a SOAP response usually arrives as one endless line with no breaks in it. Finding the node you need by eye is hopeless. This page parses the document and prints it back indented by nesting level, and the opposite button folds it into a compact form again for transport. The browser's own parser does the work, so a file full of prices or orders stays on your machine. See also: parse this XML into a JSON object, generate XML from JSON data, the same pretty printing for JSON files.

How to use it

  1. Paste the document into «XML Input», declaration line included if the source has one.
  2. Press «Format» and «Formatted Output» fills with a tree indented by nesting level.
  3. Locate the node you need by its indentation and confirm the closing tags sit at the right depth.
  4. Press «Minify» to fold everything back into one line, for instance before posting it to an API.
  5. Take the output with «Copy» and paste it into your editor or a request body.

FAQ

How do I find the error when a marketplace rejects my feed?

Format the document first: an unclosed or stray tag breaks the indentation ladder immediately, and the line that jumped to the wrong depth points at the fault. Parsing stops at the first error, so fix one and format again. Usual suspects are a bare ampersand in a product name, a quote inside an attribute, and a file truncated during export.

Does formatting change the data?

Only whitespace and line breaks between nodes change; values, attributes and element order are preserved. For formats where whitespace inside a text node is significant, though, the added indentation is real content — send the recipient the minified version and keep the pretty one for reading.

Are CDATA sections and comments preserved?

The two buttons differ here, and it is worth knowing in advance. «Minify» keeps CDATA sections and comments as they were. «Format» rebuilds the document node by node: text inside CDATA stays text, but the CDATA wrapper is gone and the < and & characters in it come out escaped; comments do not reach the formatted output at all. So if you are editing a feed with HTML inside CDATA, use the formatted view for reading and send the recipient the original or the minified version.

How large a file can the page handle?

Snippets and files of a few thousand lines format quickly. A full marketplace feed weighing tens of megabytes does not belong in a textarea: the whole string lives in the tab's memory and the browser starts to stall. Use a desktop editor for that, and bring a single branch of the document here.

Why would I minify XML again?

Indentation is extra bytes on every request. A SOAP body, a transfer over a poor connection or long-term storage are all cheaper compact, and a machine does not need readability. The usual rhythm is: fold before sending, expand when you need to understand a response.

Who can see the document I paste?

Nobody but you. Parsing and printing happen in the page script inside your open tab, and no request carrying the file is made in this flow. That makes it fine to tidy up an export holding prices, stock levels or order details without handing it to a third-party service.

Examples

Feed item that arrived on one line
Before: Router4290
After: Router 4290
Folding it back before sending
Before: The formatted fragment above plus the minify button
After: Router4290