Skip to content

HTML to Markdown Converter

Paste HTML source and get Markdown you can drop into a README, a docs site, a note app or an AI prompt. The conversion runs in your browser.

Runs in your browserFree, no sign-upLast reviewed

Settings

Paste HTML source code. A full page works: scripts, styles and the head are left out.

Results update automatically as you type.

Markdown

# Release notes

Version **2.4** is out. Read the [full documentation](https://example.com/docs) or see what changed below.

## What changed

- Faster *startup*
  - Config is cached
  - Plugins load on demand
- New `--watch` flag

```bash
npm install example@2.4
example --watch
```

| Command | Before | After |
| --- | --- | --- |
| build | 4.1 s | 2.3 s |
| test | 9.8 s | 7.0 s |

> Upgrade before 1 March to keep support.

Converted

Headings
2
Links
1
Images
0
List items
4
Tables
1
Code blocks
1
HTML size
700 characters
Markdown size
426 characters

Quick answers

How do I convert HTML to Markdown?
Paste the HTML source into the box above. Headings, paragraphs, bold, italic, links, images, lists, code, blockquotes and simple tables are rewritten in Markdown syntax, and the result can be copied or downloaded as a .md file. Nothing is uploaded.
Can I convert an HTML table to a Markdown table?
Yes, if it is a plain grid. Each tr becomes a row of cells separated by pipes, the first row becomes the header, and align or text-align on header cells becomes column alignment. Merged cells cannot be represented: colspan leaves empty cells and rowspan is ignored.
How do I turn a web page into Markdown?
Open the page, right-click the article or section you want, choose Inspect, and copy that element's outer HTML. Paste it here. Copying only the content element avoids menus, footers and cookie banners ending up in the Markdown.
Does Markdown support everything HTML does?
No. Markdown covers document structure: headings, emphasis, links, images, lists, quotes, code and, in GitHub's flavour, tables. It has nothing for colours, fonts, layout, forms, video or scripts, so those are discarded in any conversion.
What happens to scripts and styles?
They are removed with their contents. So are the head, iframes, video, audio, SVG, canvas, buttons and form fields. The tool lists the dropped elements and how many of each it found, for example 1 x <iframe>, so you can check nothing important went missing.
Can I paste formatted text copied from a page or a document?
Not directly. The input is a plain text box, so pasting formatted text keeps only the words. Paste HTML source instead. Bold, italic and strikethrough set with inline styles on a span, as rich text editors often write them, are recognised.

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 ![alt](src), 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.

HTMLMarkdown 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">![Company logo](/img/logo.png)
<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.

HTMLWhat the converter does
script, style, head, noscript, templateRemoved with their contents
iframe, video, audio, embed, objectRemoved and counted in the note. Add a plain link by hand if you need one
svg, canvas, mathRemoved and counted in the note
button, input, select, textareaRemoved, except a checkbox, which becomes [ ] or [x]
u, mark, small, abbr, span, fontTag dropped, text kept
class, id, style, data attributesDropped. A few attributes are read for meaning: href, src, alt, title, start, align, and a language class on code
colspan and rowspancolspan pads the row with empty cells; rowspan is ignored. A warning is shown
A table without th cells or a theadFirst row is used as the header, with a note, because a pipe table must have one
A table inside a table cellNot supported. The inner table comes out as broken text in the cell
div, section, article, header, footer, figureTreated as containers: the content is kept, the wrapper disappears
HTML comments and the doctypeRemoved

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. 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. 2

    Paste it into the HTML box. The Markdown appears as soon as you paste.

  3. 3

    Pick a Bullet character for unordered lists: hyphen, asterisk or plus.

  4. 4

    Leave Escape Markdown characters in text ticked unless you want literal * and # left exactly as they are.

  5. 5

    Read any Check these note under the result, then copy the Markdown or download it as converted.md.

Frequently asked questions

Is my HTML sent to a server?
No. The parser and converter are JavaScript that runs in your browser tab. The HTML you paste and the Markdown produced stay on your device, which matters for internal documentation, email templates and unpublished drafts.
Which Markdown flavour does it produce?
Standard Markdown syntax for headings, emphasis, links, images, lists, quotes and code, plus three GitHub Flavored Markdown features: pipe tables, ~~strikethrough~~ and task list checkboxes. The output suits GitHub and other renderers that accept those extensions. In a renderer without table support, a converted table shows as lines of text with pipes.
Are nested lists kept?
Yes. A list inside a list item is indented under its parent by the width of the parent's marker: two spaces under a bullet, three under 1. and four under 10. Mixed nesting, such as a numbered list inside a bulleted one, is preserved.
How is the code block language chosen?
From a class of the form language-xxx or lang-xxx on the pre or its code element, which is the convention used by most syntax highlighters. class="language-js" gives a block that opens with three backticks and js. Highlighting spans inside the block are removed and the text is kept exactly, including indentation.
Why are my images or links relative paths?
The converter copies href and src exactly as written. If the page used /img/logo.png, the Markdown does too. It does not know the address the HTML came from, so it cannot make the paths absolute. Use find and replace on the result to add the site's address.
Can it convert a Word or Google Docs document?
It can convert the HTML those programs export. In Google Docs use File, Download, Web Page, unzip the download and paste the contents of the .html file. Headings, lists, links and tables carry over. Bold and italic may not, because exported files usually apply them through stylesheet classes, which the converter ignores. Fonts, colours and page layout are always dropped.
What if my HTML is broken or incomplete?
Missing closing tags are handled: an unclosed li, p or td ends where the next one starts, and anything still open at the end is closed. Stray closing tags are ignored. A < that is not part of a tag, as in a < b, is kept as text.
Can I convert Markdown back to HTML?
Yes, with the Markdown to HTML converter on this site. A round trip returns clean structural HTML without the original classes and styles, which is a quick way to strip the formatting from a messy fragment.

Looking for something else? Browse all developer tools or see every tool.