Skip to content
cosmodev ~/tools/html-to-markdown

Conversor HTML → Markdown

Converters & Formatters

Converta fragmentos e artigos HTML em Markdown limpo: cabeçalhos, ênfase, links, imagens, listas, citações e blocos de código, tudo processado localmente no seu navegador com um link compartilhável.

Experimentar:

(Documentação em inglês)

What it does

Converts HTML into clean Markdown: headings, paragraphs, bold/italic/strikethrough, inline code, links (with optional titles), images, ordered and unordered lists with nesting, block quotes, horizontal rules and fenced code blocks (language detected from class="language-…"). It is forgiving by design: unclosed tags auto-close, stray closing tags are ignored, unknown tags pass their content through, and HTML entities are decoded. Literal Markdown characters in your text (*, _, [, ], `) are backslash-escaped so they cannot masquerade as formatting. Everything runs locally in your browser — no DOM needed, the parser is hand-rolled.

How to use it

  1. Paste HTML into HTML (left), or tap a chip — Fragment, Lists, Rich article. Sample loads a full article; Clear empties the box.
  2. The Markdown appears live in Markdown output (right).
  3. Copy takes the document.
  4. Copy share link encodes your input in the URL.

Examples

Inline marks:

<p>Some <strong>bold</strong> and <em>italic</em> with a <a href="https://x.dev">link</a>.</p> → Some **bold** and *italic* with a [link](https://x.dev).

Nested list:

<ul><li>a<ul><li>b</li></ul></li></ul> → - a + newline + - b

Code with a language:

<pre><code class="language-js">const a = 1;</code></pre> → a ```js fence.

Escaping: <p>3 * 4 [x]</p> → 3 \* 4 \[x\] — the characters survive as text.

How the conversion works

The parser builds a tree first (strings, comments and tags are told apart in one scan), then renders blocks — headings, quotes, lists, fences get blank-line separation, while inline marks nest inside. Two deliberate rules keep the output honest:

Input Behavior
Unclosed <p>a at EOF auto-closed, converted
Stray </b> with no opener ignored
<span>, unknown tags transparent — children converted
<h3> with text after it in one chunk heading, then the text as a paragraph
Empty <strong></strong> renders as nothing (empty emphasis is invalid Markdown)
< with no closing > the one error: “Unclosed tag”

For the other direction, use Markdown to HTML Converter.

Código-fonte14 idiomas

100% no cliente · seus dados nunca saem do navegador. Achou útil? Compartilhe com um colega.