DEVELOPER TOOL

HTML to Markdown Converter — clean, copyable output

Paste in raw HTML and instantly get clean, readable Markdown — headings, links, lists, code blocks, and more.

Markdown output
 
 
0
Elements converted
0
Elements stripped
0
Words out
0
Lines out
Tip: unsupported tags (like <table> or <div>) have their inner text kept but the tag itself is stripped, so the words survive. Simple tables are the exception: they become Markdown pipe tables.

The HTML to Markdown converter on this page takes raw HTML — copied from a web page, exported from a CMS, or pasted from a rich-text editor — and turns it into clean Markdown you can drop straight into a README, a static-site blog post, a GitHub issue, or a Notion doc.

It is deliberately a small converter. It handles the tags that make up most article and documentation content, and it reports how many wrapper elements it dropped so you know what to review before you publish.

What This HTML to Markdown Converter Does

Paste any HTML snippet into the input box and the converter walks the markup structurally — not with a blunt regex pass — mapping each recognized tag to its Markdown equivalent: headings become # through ######, <strong>/<b> become **bold**, <em>/<i> become *italic*, links become [text](url), images become ![alt](src), ordered and unordered lists (including nested lists) get correctly indented, blockquotes get a leading > on each line, and code becomes inline backticks or a fenced ``` block depending on whether it was inline <code> or a <pre> block. Anything the converter doesn't recognize is stripped down to its plain text so you never lose content — you just lose formatting it can't represent.

How to Use the HTML to Markdown Converter

  1. Copy your HTML from wherever it lives — browser dev tools, a CMS export, an email, or a rich text editor's "view source" option.
  2. Paste it into the input box on the left, replacing the example markup.
  3. Click "Convert to Markdown." The converter parses the structure and builds the Markdown output instantly.
  4. Review the output in the right-hand box — check that nested lists, links, and code blocks look right.
  5. Click "Copy Markdown" to copy the result to your clipboard.
  6. Paste it into your README, static site generator, CMS, or documentation tool of choice.

The Supported HTML Subset

This tool intentionally supports the tags that make up the overwhelming majority of real-world content markup rather than attempting a full, lossless HTML-to-Markdown round trip (which isn't fully possible anyway, since Markdown is a smaller language than HTML). Supported elements include: headings h1–h6, paragraphs, strong/b, em/i, links (a), images (img), ordered lists (ol), unordered lists (ul), nested lists at any depth, blockquotes (blockquote), inline code (code), fenced code blocks (pre), and horizontal rules (hr).

Line breaks (br) are converted to a Markdown hard line break (two trailing spaces and a newline). The output follows the basic syntax in John Gruber's original Markdown documentation. It does not produce extensions such as tables, task lists or strikethrough, and it does not escape characters like * or [ that appear in your text.

What Gets Stripped, and Why That's Honest Behavior

Markdown has no native form for data tables with colspans, embedded iframes, forms, custom web components, inline styling attributes or layout-heavy div structures. Rather than guess, this tool drops the wrapping tag and keeps the text inside it. The words survive; the structure does not. Simple tables are converted to Markdown pipe tables, one row per line with the first row as the header; merged cells (colspan, rowspan) and nested tables cannot be represented, so keep complex tables as HTML inside your Markdown file, which most renderers still accept. Text from neighbouring divs can still be joined with no separator.

Common Places You'll Use an HTML to Markdown Converter

  • Migrating a blog from a CMS to a static site generator like Jekyll, Hugo, Astro, or Eleventy, all of which expect Markdown content files.
  • Writing GitHub README files from content you first drafted or copied as HTML.
  • Pasting documentation into Notion, Obsidian, or another Markdown-native note tool without manually retyping formatting.
  • Cleaning up content copied from Word or Google Docs (which export bloated HTML) before it goes into a chat message, ticket, or wiki page that renders Markdown.
  • Preparing training or reference text for AI tools that read Markdown more reliably than raw HTML with inline styling noise.

Cleaning Up "Bloated" HTML Before You Convert

Content pasted from Word, Google Docs, or Outlook is notorious for producing enormous, deeply nested HTML full of empty <span> wrappers, inline style attributes for every font tweak, and Microsoft-specific conditional comments that have no meaning outside a Word document. This converter's structural walk handles that gracefully by descending into unrecognized wrapper tags and pulling out only the text and genuinely meaningful child elements — so a paragraph buried under four layers of styling <span> tags still comes out as a clean paragraph, not four layers of Markdown noise.

If your output still looks messier than expected, the usual cause is content that used visual formatting tricks instead of semantic tags in the first place — for instance, a "heading" that was actually just larger, bolded regular text rather than an <h2> element, which this tool (like any converter) has no reliable way to detect automatically since the underlying HTML gives no structural signal that it was meant to be a heading.

Round-Tripping: Converting Markdown Back to HTML

Content work is rarely one-directional — you might convert a page to Markdown to edit it more comfortably in a plain-text editor, then need to convert it back to HTML to publish it on a platform that only accepts markup.

Because Markdown is intentionally a smaller, simpler language than HTML, a clean round trip (HTML → Markdown → HTML) generally preserves everything this converter supports — headings, emphasis, links, images, lists, blockquotes, and code — but anything that was stripped on the way to Markdown (custom classes, inline styles, tables, embeds) obviously won't reappear on the way back, since that information was never captured in the first place. If your workflow depends on a lossless round trip for those richer elements, it's worth keeping the original HTML source alongside the Markdown copy rather than treating the conversion as fully reversible.

Nested Lists and Why They're Tricky

Nested lists are a common place for a naive conversion to break, because Markdown represents nesting purely through indentation. This converter tracks list depth as it walks the HTML tree, so a <ul> inside an <li> is indented by two spaces per nesting level in the output (some Markdown flavours want four, so adjust if your renderer flattens the inner list). Ordered lists number from 1 within each list, including when they sit inside a bulleted list.

If your output looks flat when you expected nesting, double-check that your source HTML actually nests the inner list inside the parent <li> rather than as a sibling — that's a common authoring mistake in hand-written or CMS-exported HTML, and no converter can recover structure the original markup never had.

Fenced Code Blocks vs Inline Code — Getting the Distinction Right

Markdown has two very different ways to represent code, and picking the right one matters for readability. Inline code — a variable name, a short snippet, a file path mentioned mid-sentence — becomes a single word wrapped in backticks, like const, and reads naturally inside a normal paragraph. A multi-line snippet, on the other hand, needs to be its own fenced block set off with triple backticks, so line breaks, indentation, and spacing are preserved exactly.

This converter distinguishes the two by checking whether a <code> tag sits directly inside a <pre> tag (it becomes a fenced block) or stands alone (it becomes single backticks). One honest limit: the converter collapses every run of whitespace, including newlines and indentation, to a single space. A multi-line snippet inside <pre><code> therefore comes out as a fenced block with all its lines joined into one (see the preset table below). Re-break the lines and restore the indentation by hand after converting.

Why a Structural Parser Beats a Regex-Based Converter

A number of quick "HTML to Markdown" scripts floating around the web work by chaining together regular expressions — replace every <strong> with **, every <a href="..."></a> with a bracket-paren pattern, and so on. That approach breaks the moment tags are nested, attributes appear in an unexpected order, or whitespace is formatted differently than the regex author assumed.

This tool instead parses your HTML into an actual DOM tree using the browser's built-in DOMParser, then walks that tree node by node the same way a browser itself understands the document's structure. That's why nested lists, links containing bold text, and blockquotes containing several paragraphs stay inside one quote (you may see a stray empty > line to tidy) — the tool understands parent/child relationships, not just surface-level text patterns.

How to Read the Result

  • Markdown output (the large box) holds the converted text. The headline above it shows only the first 60 characters.
  • Elements converted counts the tags the tool recognised and turned into Markdown, including every paragraph, bold, italic, link, list and heading.
  • Elements stripped counts only a fixed list of wrapper tags it removed (div, span, section, article, table parts, iframe, form, header, footer, nav, main). Other unknown tags pass their text through without being counted, so a 0 does not prove nothing was dropped.
  • Words out counts space-separated pieces of the output, including symbols such as - and the code fences. Lines out counts every line, blank or not.
HTML inMarkdown outConvertedStrippedWordsLinesWhat it shows
(default sample: heading, paragraph with bold, italic and link, nested list, quote, code)## Getting Started

This is a **bold** statement with an *italic* word and a [link](https://example.com).

- First item
- Second item
  - Nested item

> A short quote goes here.

```
const x = 1;
```
1003617Works as intended. The raw output also has lines holding a single space between blocks (they are part of the 17); they render like blank lines.
<ol><li>Plan<ul><li>Audit</li><li>Scope</li></ul></li><li>Build</li></ol>1. Plan
  - Audit
  - Scope
2. Build
2084Nested list indents two spaces per level.
<div><table><tr><td>Plan</td><td>Price</td></tr><tr><td>Basic</td><td>$10</td></tr></table></div>| Plan | Price |
| --- | --- |
| Basic | $10 |
15153A pipe table with the first row as header. The div and four cells count as stripped wrappers; pipes count as words.
<pre><code>line one
  indented
line three</code></pre>
```
line one
  indented
line three
```
2075Line breaks and indentation inside pre are kept.
<p>Read the <a href="/guide/">full <strong>guide</strong></a> now.<br>Next line</p><hr><img src="/a.png" alt="Chart">Read the [full **guide**](/guide/) now.
Next line

---

![Chart](/a.png)
6096Bold inside a link, hard line break, rule and image all convert; relative paths are copied as-is.
<p>Use *stars* and [brackets]</p>Use *stars* and [brackets]1041Literal symbols are not escaped, so a Markdown renderer will italicise the word.

What to Do Next

  1. Check converted tables and code blocks in your renderer, and keep complex tables (merged cells) as HTML.
  2. Put a backslash before any literal *, _ or [ that should not be formatting.
  3. Add a language after the opening fence (for example ```js) if your platform highlights code.
  4. Check link and image paths, especially relative ones, if the content is moving to a new domain.
  5. Paste into your real renderer (GitHub, your static site generator, Notion) and check the preview before publishing. Keep the original HTML in case you need anything the conversion dropped.
Migrating a whole site's content, not just one page?

A converter handles one page of content at a time. It does not map old URLs to new ones, move images or set up redirects. If you are moving a whole site, Arb Digital can talk through the web design and rebuild side; keep browsing the free tools below if you only need the conversion.

Our Web Design Services All Free Tools

Common Mistakes to Avoid

  • Pasting an entire HTML document instead of a fragment. Only the visible body content converts meaningfully — a full <html><head></head><body> wrapper adds noise the converter has to strip.
  • Expecting tables to convert perfectly. Markdown table syntax is limited (no colspans, no nested tables) — complex tables are better kept as HTML inside Markdown, which most renderers still allow.
  • Not checking link and image paths. Relative URLs (like /images/photo.jpg) copy through as-is; if you're moving the content to a new domain, you'll still need to update those paths.
  • Losing inline styling on purpose without realizing it. Font colors, custom CSS classes, and inline style attributes have no Markdown equivalent and are correctly dropped — if you need that formatting preserved, Markdown isn't the right target format.
  • Trusting multi-line code and literal symbols without checking. A literal *, _ or [ in your text is not escaped, so Markdown may later read it as formatting.
  • Forgetting to re-check code block language hints. This converter outputs a plain fenced code block; if your source used a class="language-js" hint, add the language tag manually after conversion for syntax highlighting on platforms like GitHub.

Related Free Tools From Arb Digital

Going the other direction? Try our Markdown to HTML Converter. To clean up or shrink the HTML you started with, use the HTML Minifier or the HTML Encoder Decoder. Browse everything in our free online tools hub.

Frequently Asked Questions

Does this tool send my HTML to a server?

No. All parsing and conversion happens locally in your browser using JavaScript — nothing you paste is uploaded or stored anywhere.

Which HTML tags does it support?

Headings (h1-h6), paragraphs, bold/italic, links, images, ordered and unordered lists (including nesting), blockquotes, inline code, fenced code blocks, and horizontal rules. Unsupported tags are stripped but their inner text is kept.

Can it convert HTML tables to Markdown tables?

Yes, simple ones. Each row becomes a pipe-table row, the first row is used as the header, and a | inside a cell is escaped. Markdown tables cannot express colspans, rowspans or nested tables, so keep complex tables as HTML.

Will it preserve inline CSS styling?

No, and this is intentional. Markdown has no mechanism for inline styles, custom colors, or CSS classes, so those are dropped while the actual text content is preserved.

Does it handle nested lists correctly?

Yes. The converter tracks list depth as it walks the HTML structure and indents nested list items accordingly, keeping ordered and unordered numbering/bullets correct at each level.

Does it keep line breaks in code blocks?

Yes. Text inside a pre block keeps its line breaks and indentation exactly, inside a fenced code block. Elsewhere, runs of whitespace in ordinary text are collapsed to one space.

What happens to line breaks and empty tags?

Line break tags convert to a Markdown hard line break, and empty or whitespace-only elements are skipped so your output doesn't fill up with blank Markdown lines.

This tool runs entirely in your browser — no HTML you paste is sent to any server.

Want this handled for you?

Want a fuller picture of your own site? Run the free AI Website Audit for a page-by-page report.