HTML to XML
HTML to XML turns loose HTML into well-formed XHTML that an XML parser will accept.
What HTML to XML does
HTML to XML turns loose HTML into well-formed XHTML that an XML parser will accept. Every tag gets closed, empty tags such as br and img become self-closing, and attribute values are quoted.
The tool reads your markup the same way your browser does, which also repairs common mistakes such as unclosed paragraphs. A full page that starts with an html tag gets an XML declaration on top. A fragment, such as a few paragraphs, comes back on its own without an added body wrapper. Copy the result or download it as page.xhtml.
How to use HTML to XML
- Paste your HTML
Use a whole page or just a snippet.
- Press Convert
The markup is parsed and written out as XML.
- Check and save
Edit the result if needed, then copy it or download page.xhtml.
Questions about HTML to XML
What is the difference between HTML and XHTML?
XHTML follows XML rules: tags must close, attributes need quotes and nesting must be correct. Browsers forgive mistakes in HTML; XML parsers do not.
Will scripts and styles be kept?
Yes. They stay in the output along with the rest of the markup. Nothing in your HTML is run while it is converted.
Why did some of my tags move?
The browser's parser fixes invalid nesting, for example a div inside a p, and the XML shows that corrected structure.