XML Formatter and Validator
Check XML syntax, find errors and tidy its markup. Preview a separate result while keeping the original text and its spacing.
Your XML stays in browser memory. No upload, login, storage or external resource fetching.Check and tidy your XML
Paste XML or choose a file. Format XML tidies the markup and puts a separate result below. Validate XML checks for syntax errors; Minify markup reduces spacing inside tags.
Up to 2 MiB. XML 1.0 in UTF-8 or BOM-marked UTF-16 files. DTDs and custom entity declarations are not supported.
Default Format only lays out attributes inside tags; it never adds or removes text spacing. Optional element indentation adds whitespace text nodes to containers with no existing text. Without a schema, that can change application meaning: enable it only when appropriate. Existing text (including blank separators), CDATA, mixed-content subtrees and xml:space="preserve" subtrees stay untouched. Minify markup compresses tag syntax only, not text.
Inspect the tree, namespaces and source outline; preview formatting or comment removal; run separate XPath queries and local XSD validation.
How to use XML Formatter and Validator
The original formatter keeps XML syntax checking, line and column errors, error-position focus, conservative attribute formatting, optional child indentation in safe text-free contexts, markup minification, CDATA and text preservation, copy and complete UTF-8 download. Enable additional XML document review for a separate workspace.
Choose Tree, namespaces, outline and statistics, add XML and Run additional XML review. Expand the element tree one branch at a time. Child groups page by fifty so large sibling lists remain usable. Attributes show decoded values and namespace identities. The structural outline lists every element in document order, pages by fifty and can filter names or URIs. Select an outline or tree element to select its complete original source span. Source selection accounts for textarea normalization of CRLF and CR line endings.
Namespace inspection lists each declaration, its prefix, URI, declaring element and inherited previous binding. A default element namespace does not apply to unprefixed attributes. Namespace strings are identifiers rather than addresses to fetch. Statistics show bytes, UTF-16 units, elements, attributes, namespace declarations, text callback segments, CDATA, comments, processing instructions and maximum element depth. A warning begins at depth 64; the parser still enforces its 128-level limit.
Choose Formatting or Markup minification for an exact output preview. Advanced controls indentation, safe-context child indentation and attribute ordering. Keep source order, sort by QName code points, sort by expanded namespace URI and local name, or supply one QName priority per line. Remaining custom-order attributes use QName order. Namespace declarations stay first in their relative order. Attribute quotes and raw values are retained before conservative formatting. These operations are unsuitable for preserving signed XML byte identity.
The change preview compares text gaps at corresponding markup positions and changed markup tokens. Every span has before/after text, original and output offsets and a non-whitespace comparison. XML whitespace here means space, tab, CR and LF. This is an exact aligned-span report rather than a minimal line edit script. Attribute reordering appears as markup changes. Full JSON/TXT reports include every span.
Choose Dedicated comment-removal preview to remove only real XML comment tokens. CDATA containing comment-like text, attribute text and processing instructions remain unchanged. Read the exact output before downloading: removing a comment can join surrounding text. The report retains every removed comment and its original offset. Source input is never replaced automatically.
Choose XPath for a separate XPath 1.0 query. Enter an expression and optional prefix=URI lines. Bind a prefix for a default namespace, such as b=urn:books, then query //b:book/b:title. Unprefixed names match no-namespace elements. The context is the document. Node results include serialized elements or decoded scalar node values, and scalar expressions retain string, number or boolean kind. Results page by twenty-five while the full report contains all matches. External functions are unavailable.
Choose Local XSD validation and supply one self-contained XSD 1.0 schema, pasted or read from your device. The local engine validates types, content models, namespace identities, identity constraints and other supported XSD 1.0 rules. Validation errors retain available line, column and path information; select a diagnostic line to inspect the source. Schema include, import, redefine and override are refused before compilation. XML XSD 1.1 assertions and alternatives are outside the engine’s scope.
Batch validation checks up to ten files, 2 MiB each and 8 MiB combined. Choose well-formedness alone or enable the supplied local XSD for every file. The report includes every original file name, SHA-256, well-formedness, validity, statistics, warnings and all returned schema diagnostics. Malformed files retain their syntax failure. A failed schema compilation is recorded as an error, never a successful validation.
Downloads include complete XML output or complete JSON/TXT review reports. Copy XML offers a selected manual-copy fallback. Reports can contain private values, schema text, source fragments, file names and hashes. Everything stays in memory; nothing is saved automatically. Edits invalidate old exports and terminate pending work. Clear resets the additional workspace and returns focus to the source. Cancel prevents stale results from appearing.
Example: inspect books and check a quantity
Use the additional book example, inspect its tree, then select a title in the outline to see its exact source span. Choose Formatting, enable safe child indentation and QName attribute order in Advanced, and review whitespace and markup changes before downloading.
Choose XPath with b=urn:books and sum(//b:quantity); the result is the number 5. For XSD, use the supplied book schema example. It requires positive integer quantities and unique required IDs. Change a quantity to zero to inspect the validation error, then restore it and validate again.
About XML validation and local processing
XML well-formedness, schema validity and application meaning are different checks. The original parser enforces XML 1.0 syntax and conservative formatting limits. XSD 1.0 adds constraints from the schema you supplied; a successful check is scoped to that schema and the engine’s supported version. It cannot certify business meaning or future compatibility.
XPath and XSD run in a disposable worker with pinned libxml2-wasm. The engine loads from this site when needed. DTDs and external entities remain disabled, external resources are refused and no schema location is fetched. See the W3C XML Schema structures specification and XPath 1.0 specification for the underlying formats.
Limits include 128 XML levels, 50,000 original parser nodes, 64 KiB markup/text tokens, 128 attributes per element, 512 KiB local XSD, 5,000 XPath matches and 8 MiB total node-result values. Complete tree, query and batch reports have a 16 MiB bound; complete reviews have a 32 MiB bound. Excessive results are refused rather than silently truncated. Every operation has an eight-second parent deadline and file reading has a five-second deadline.
Stars and feedback
Loading…
What should we improve next?
Help shape the next update to XML formatter validator. Tell us what would make it better for you.
Prefer email? feedback@tooltulip.com
Tool reference #171