About HTML to Markdown Converter
Paste a fragment or a whole page of HTML and the converter rewrites its structure as Markdown: h1 to h6 become # headings, strong and em become ** and *, anchors become [text](url), img becomes , ul and ol become lists with nesting preserved, pre becomes a fenced code block and a simple table becomes a pipe table. Everything that only matters to a browser is removed: scripts, styles, the head, classes, ids and inline styling. Where something has no Markdown form, such as an iframe or a merged table cell, the tool says so under the result instead of dropping it silently. Tables, strikethrough and task lists use GitHub Flavored Markdown syntax.
HTML tag to Markdown syntax chart
What this converter writes for each supported element. Every row is real output.
| HTML | Markdown output |
|---|---|
| <h2>Getting started</h2> | ## Getting started |
| <strong>bold</strong> or <b> | **bold** |
| <em>italic</em> or <i> | *italic* |
| <del>old</del>, <s> or <strike> | ~~old~~ |
| <a href="https://example.com/docs" title="Docs">the docs</a> | [the docs](https://example.com/docs "Docs") |
| <img src="/img/logo.png" alt="Company logo"> |  |
| <code>npm i</code> | `npm i` |
| <p>Line one<br>Line two</p> | Line one, two trailing spaces, then Line two on the next line |
| <hr> | --- |
| <blockquote><p>Quoted text</p></blockquote> | > Quoted text |
| <ul><li>One<ul><li>Nested</li></ul></li><li>Two</li></ul> | - One, then Nested indented two spaces as its own bullet, then - Two |
| <ol><li>First</li><li>Second</li></ol> | 1. First and 2. Second on separate lines |
| <pre><code class="language-js">let a = 1;</code></pre> | A fenced block opened with ```js |
| <li><input type="checkbox" checked> done</li> | - [x] done |
| x<sup>2</sup> (also <sub>) | x<sup>2</sup>, kept as inline HTML |
| <dl><dt>Term</dt><dd>Definition</dd></dl> | **Term** then Definition as a paragraph |
An ol with a start attribute keeps its numbering: start="9" produces 9. and 10.
Conversion examples, including awkward input
Results from running the tool on each input.
A table with right-aligned numbers
<table><tr><th>Name</th><th align="right">Qty</th></tr><tr><td>Pens</td><td>12</td></tr></table>
Three lines: | Name | Qty | then | --- | ---: | then | Pens | 12 |
The colon in ---: is the right-alignment marker.
Text that contains Markdown characters
<p>5 * 3 = 15</p>
5 \* 3 = 15
With escaping switched off the output is 5 * 3 = 15, which is easier to read but can turn into italics next to a second asterisk.
Bold and italic set with inline styles
<p><span style="font-weight:700">Bold</span> and <span style="font-style:italic">italic</span></p>
**Bold** and *italic*
This is how Google Docs and many rich text editors mark emphasis.
List items with no closing tags
<ul><li>one<li>two<li>three</ul>
- one, - two and - three on three lines
Unclosed li, p, td and tr are closed the way a browser closes them.
Classes, ids and styles
<h1 class="title" id="top">Hello</h1><div class="card"><p style="color:red">Text</p></div>
# Hello, a blank line, then Text
A full page with scripts and embeds
A document with a head, a style block, a script, one paragraph reading Visible, an iframe, an svg and a button
Visible
The note under the result reads: Left out because Markdown has no equivalent: 1 x <button>, 1 x <iframe>, 1 x <script>, 1 x <svg>.
The sample loaded on this page
700 characters of HTML: two headings, a nested list, a code block, a table and a quote
426 characters of Markdown: 2 headings, 1 link, 4 list items, 1 table, 1 code block
HTML that is not converted
Markdown has no syntax for these. This is what happens to each.
| HTML | What the converter does |
|---|---|
| script, style, head, noscript, template | Removed with their contents |
| iframe, video, audio, embed, object | Removed and counted in the note. Add a plain link by hand if you need one |
| svg, canvas, math | Removed and counted in the note |
| button, input, select, textarea | Removed, except a checkbox, which becomes [ ] or [x] |
| u, mark, small, abbr, span, font | Tag dropped, text kept |
| class, id, style, data attributes | Dropped. A few attributes are read for meaning: href, src, alt, title, start, align, and a language class on code |
| colspan and rowspan | colspan pads the row with empty cells; rowspan is ignored. A warning is shown |
| A table without th cells or a thead | First row is used as the header, with a note, because a pipe table must have one |
| A table inside a table cell | Not supported. The inner table comes out as broken text in the cell |
| div, section, article, header, footer, figure | Treated as containers: the content is kept, the wrapper disappears |
| HTML comments and the doctype | Removed |
Why some characters get a backslash
Markdown gives meaning to ordinary characters. An asterisk starts emphasis, a line that begins with # is a heading, a line that begins with 1. is a list, and square brackets start a link. When those characters appear in the text of your HTML as plain characters, copying them across unchanged would alter the document: a price list reading 2 * 3 * 4 would lose its asterisks and gain italics.
With Escape Markdown characters in text ticked, the converter puts a backslash before each such character: asterisks, backticks, square brackets, an underscore at the edge of a word, and a #, >, -, + or number-and-full-stop at the start of a line. An underscore inside a word, as in snake_case, is left alone because Markdown does not treat it as emphasis. A less-than sign followed by a letter is escaped too, so that text such as <div> shown on the page is not read back as a tag.
Untick the box when the destination is not a Markdown renderer, for example when you are feeding text to a language model or a plain-text search index and the backslashes would only be noise. Text inside code spans and code blocks is never escaped in either mode.
Known limits of this converter
- It converts source code, not a URL. It does not fetch pages, and it does not run JavaScript, so content that a page loads after opening is only there if you copy the HTML from the inspector.
- Relative links and image paths such as /pricing stay relative. They will only work in the Markdown if it lives on the same site.
- Two differently formatted runs with no space between them, such as an italic word glued to a bold one, can produce marker sequences that Markdown renderers read differently. Check those spots.
- Headings always use # style and code blocks always use backtick fences. There is no option for underlined headings or indented code.
- Two or more br tags in a row start a new paragraph; a single br becomes a hard line break.
- It is a hand-written parser that follows the common browser rules for unclosed tags, not the full HTML specification. Badly broken markup, such as formatting tags that overlap across paragraphs, may convert differently from how a browser shows it.
- Extremely deep nesting, thousands of levels, is refused with an error instead of a partial result.
Using HTML to Markdown Converter
- 1
Copy the HTML source you want to convert. From a live page, right-click the content, choose Inspect, then right-click the element and pick Copy outer HTML.
- 2
Paste it into the HTML box. The Markdown appears as soon as you paste.
- 3
Pick a Bullet character for unordered lists: hyphen, asterisk or plus.
- 4
Leave Escape Markdown characters in text ticked unless you want literal * and # left exactly as they are.
- 5
Read any Check these note under the result, then copy the Markdown or download it as converted.md.