XML to Markdown Converter

Paste XML or upload an .xml file. Each element becomes a heading, with its attributes listed and its text kept.

Input — XML
Output — Markdown
Markdown output will appear here...

To convert XML to Markdown, paste the XML (or upload an .xml file) into the box above and copy the Markdown on the right. The root element becomes a # heading and each child goes one level deeper. Attributes are listed under their element as - **name:** `value`, and the element's text follows as a paragraph.

What does the output look like?

Attributes and text

XML in
<book id="bk101" lang="en">
  <title>XML Developer's Guide</title>
  <price currency="USD">44.95</price>
</book>
Markdown out
# <book>
- **id:** `bk101`
- **lang:** `en`

## <title>

XML Developer's Guide


## <price>
- **currency:** `USD`

44.95

Repeated elements

XML in
<order id="7">
  <item sku="A1">Coffee</item>
  <item sku="B2">Tea</item>
</order>
Markdown out
# <order>
- **id:** `7`

## <item>
- **sku:** `A1`

Coffee


## <item>
- **sku:** `B2`

Tea

Mixed text and inline elements

XML in
<p>Hello <b>world</b> again</p>
Markdown out
# <p>

Hello again


## <b>

world

Text directly inside an element is joined and placed before its children, so the sentence order is lost. This converter is built for data, not for marked-up prose.

An RSS item with a CDATA description

XML in
<rss version="2.0"><channel><item><title>Post</title><description><![CDATA[<p>Hello & welcome</p>]]></description></item></channel></rss>
Markdown out
# <rss>
- **version:** `2.0`

## <channel>

### <item>

#### <title>

Post


#### <description>

<p>Hello & welcome</p>

CDATA text is kept unescaped. The & needs no entity, and the <p> stays as raw HTML.

How are XML attributes shown?

As a bullet list right under the element's heading, one line per attribute, with the value in inline code so IDs and URLs are not reformatted. They keep the order they have in the tag. Namespace declarations such as xmlns:dc="..." count as attributes and are listed too, and prefixed names like dc:creator keep their prefix.

What happens to repeated elements?

Each one gets its own heading at the same level, in document order, as with the two <item> elements above. They are not merged into a table. If the XML is really a list of records and you want a table, export it as CSV and use CSV to Markdown, or rebuild it in the Table Generator.

Why does it say the XML is invalid?

The browser's XML parser is strict, unlike its HTML parser. A bare & (write &amp;), a tag that is never closed, mismatched case such as <Item>...</item>, or two root elements side by side all stop the conversion. The message after "Invalid XML:" is the start of the parser's own error, which usually names the line.

Can Pandoc convert XML to Markdown?

Only for XML formats it knows, such as DocBook and JATS: pandoc -f docbook book.xml -t gfm. For those, Pandoc is the better tool because it understands sections, lists and emphasis. For arbitrary XML (a config file, an API response, a feed) it has no reader, which is the case this page covers. For JSON payloads, use JSON to Markdown.

How are CDATA, namespaces, entities and other edge cases handled?

InputWhat you get
CDATA sectionsKept as text, exactly as written; HTML inside stays as raw HTML
Comments, processing instructions, <?xml ?> declarationLeft out
Entities (&amp; &lt; &#233;)Decoded to & < é
Empty or self-closing element (<debug/>)A heading with nothing under it
Whitespace and indentation between tagsIgnored; text is trimmed
Text mixed with child elementsText joined and placed before the children
Namespaced names (dc:creator)Prefix kept; xmlns declarations listed as attributes
Element names in headingsWritten as # <name> with literal angle brackets. Renderers that allow raw HTML may treat <name> as a tag and hide it
Backtick in an attribute valueBreaks the inline code span around the value
More than six levels of nestingHeadings stop at ######
Accents, CJK and emojiPassed through unchanged

How does this compare with Pandoc and XSLT?

MDConvert (this page)PandocXSLT (e.g. xsltproc)
Reads any XMLYesNo, only formats it knows (DocBook, JATS and others)Yes
Output shapeFixed: a heading per elementReal prose MarkdownWhatever your stylesheet writes
SetupNone, runs in the browserInstall PandocInstall a processor and write a stylesheet
Batch / scriptingNo, one file at a timeYesYes
Your data leaves your machineNoNoNo

For a repeatable conversion with a specific layout, an XSLT stylesheet is the better tool. This page is for reading or documenting an XML file without writing one.

Maintained by Ankit Aglawe. Last updated .

Related Tools

Need a different format? See every tool on the Markdown converter page, or go back to the MDConvert home page.

XML to Markdown questions

Can I upload an .xml file?
Yes. Click Upload above and choose the file, or paste the XML into the input box. The Markdown appears as soon as the XML parses.
Does it work on an RSS feed?
Yes, each <item> becomes a heading with its <title>, <link> and <pubDate> under it. Descriptions wrapped in CDATA are kept as written, so any HTML inside them comes through as raw HTML in the Markdown.
Does it work on a SOAP response?
Yes. The envelope, header and body each become headings, and prefixes such as soap: are kept in the element names. The xmlns declarations are listed as attributes on the element that declares them.
Should I use this for HTML or XHTML?
No. HTML is mostly prose with inline tags, and this converter would turn every <b> and <a> into a heading. Use the HTML to Markdown converter, which writes proper paragraphs, links and emphasis.
Is there a size limit?
There is no fixed limit. The whole file is parsed in your browser tab, so very large files (tens of megabytes) can be slow and produce a very long page.
Is my XML uploaded?
No. The browser's own XML parser reads it and the Markdown is built on your machine. Nothing is sent to a server.