XML Formatter / Viewer
Enter an XML string to validate it and see it laid out as an indented, syntax-highlighted tree. Your input is never sent to a server — everything happens in your browser.
Tip. When you stop typing, the input is validated and, if valid, the view switches automatically to the "Output" tab. The dot on the Output tab shows the current validity status. The ▾/▸ buttons for collapsing/expanding elements sit next to the line numbers (left margin) for easy clicking. The search box is focused automatically when the Output tab opens, and you can choose a search mode (Contains/Exact/Regex) to find tag names, attribute names/values, and text content the way you want. Line numbers on the output are renumbered to match only the visible lines, so you can still tell where you are even when parts of the tree are collapsed. The input panel has the same kind of search (Contains/Exact/Regex) so you can locate and highlight text directly in the original input. Press Enter (next) / Shift+Enter (previous) to move between matches.
How to use this tool
- Paste an XML string into the input box on the left and it's validated automatically, with the result rendered right away.
- If the XML isn't valid, you'll get an approximate line/column for where the problem is.
- Clicking "Format" also reformats the input box's content using the selected indent size.
- When the output is long, use "Collapse all" to get an overview of the structure first, then expand only the elements you need with the ▾/▸ buttons next to the line numbers.
- Everything happens in your browser — the data you enter is never sent to a server.
- Once your input is confirmed valid, the view switches automatically to the "Output" tab and focus moves to the search box so you can start typing right away.
- Choose a search mode: "Contains" (partial match), "Exact" (exact match), or "Regex" (regular expression).
- The input panel has the same search feature (Contains/Exact/Regex, previous/next navigation, highlighting) so you can search directly in the original text.
- Elements, attributes, text nodes, comments, and CDATA sections are all recognized and color-coded in the tree view.
Related tips
- Use Collapse all to get a bird's-eye view of a deeply nested document (like an RSS feed or a SOAP response) before drilling into a specific branch.
- The Regex search mode can match attribute values across many elements at once — handy for auditing IDs, dates, or namespaces in a large document.
- If your XML starts with an declaration, it's kept automatically whenever you use Format, Copy, or Download.
- CDATA sections are useful for embedding markup or special characters inside text without escaping them — the formatter preserves them as-is.