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

Konwerter HTML → Markdown

Converters & Formatters

Konwertuje fragmenty HTML i artykuły na czysty Markdown: nagłówki, wyróżnienia, linki, obrazy, listy, cytaty i bloki kodu — wszystko przetwarzane lokalnie w przeglądarce, z linkiem do udostępnienia.

Wypróbuj:

(Dokumentacja po angielsku)

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.

Kod źródłowy14 języków

100% po stronie klienta · Twoje dane nigdy nie opuszczają przeglądarki. Okazało się przydatne? Podziel się nim z zespołem.