HTML to Markdown Converter
Operator: Abdulla Al Fahad. How tools are built and checked
HTML is what the web stores; Markdown is what documentation repositories, wikis, note apps and chat assistants want. Between the two sits markup nobody wants to carry: wrapper divs, class attributes, tracking scripts, inline styles left behind by a CMS editor. The HTML to Markdown Converter reads the markup and writes GitHub-flavoured Markdown that keeps the meaning and sheds the rest: # headings, **bold** and *italic*, ~~strikethrough~~, `code`, [links](url), nested lists, > quotes, fenced code and pipe tables.
Drop a .html, .htm or .xhtml file, or paste markup into the Paste HTML box and press Convert text; a brief quarterly update sits under Try a sample. The preview shows the Markdown, Copy puts it on the clipboard and Download .md saves the same text; a pasted page is named after its <title>, or its first heading when there is no title.
Key features
- Writes GitHub-flavoured Markdown: ATX headings, emphasis, strikethrough, code spans, fenced blocks, links, block quotes, nested lists and pipe tables.
- Indents nested items by the parent marker's width and writes an empty header row when a table has none, so the output renders in GitHub and CommonMark tools alike.
- Escapes pipes inside cells, turns cell line breaks into <br> and pads spanned cells so every row keeps its column count.
- Accepts pasted markup or an uploaded file, names a pasted document after its <title>, and offers Copy alongside the .md download.
How tags become Markdown
The markup is read by the same HTML reader as the HTML to Word converter, whose page explains it in full: which elements are skipped, how inline style attributes are interpreted and how merged cells are kept on a grid. Here the subject is the Markdown writer. h1 becomes #, h2 becomes ##, and h3 to h6 all become ###. Paragraphs are separated by a blank line, a br within a paragraph becomes a trailing backslash (the CommonMark hard break), quoted and indented paragraphs become > lines, and a horizontal rule produces nothing. A pre block of more than one line becomes a fenced code block; a single-line pre becomes inline code in a paragraph of its own.
Bold, italic and strikethrough, whether they come from tags or from inline styles, are written as **, * and ~~, with *** for bold italic; monospace text from code, kbd, samp, tt or a Courier font becomes a code span. Links are written as [text](url) only for http, https and mailto addresses, with spaces and parentheses in the address percent-encoded; relative paths, in-page anchors and javascript: links keep only their text. Underline, colour, background, highlight, font family, font size and alignment are discarded, and a checkbox input becomes a ☐ or ☑ character rather than the - [ ] task syntax.
A nested list is indented under its parent by the width of the parent's marker, two spaces beneath - and three beneath 1., and every ordered list is numbered from 1 regardless of its start attribute. Tables become pipe tables; the header row is taken from thead or from a first row consisting of th cells, and without either an empty header row is written so renderers still draw the table. Pipes inside cells are escaped as \|, line breaks inside cells become <br>, and a cell that spans columns is followed by empty cells so every row has the same number of pipes. In ordinary text, backslashes, asterisks, underscores, backticks, square brackets, tildes, a < before a letter and anything at the start of a line that could open a heading, quote or list are escaped.
How it works
Parsing is shared with the HTML to Word converter, whose page describes the browser-based reader, its whitespace rules and its table grid. The Markdown writer is what is specific here: runs that share the same marks are joined, and a space just inside a bold or italic run is pushed outside the asterisks, because CommonMark refuses emphasis that opens or closes next to whitespace.
Text is escaped, list indentation is computed from the parent markers, tables are written with their divider row, and blocks are separated by blank lines with consecutive list items a single line apart. The preview shows the first 20,000 characters; Copy and Download .md carry the whole document.
Common use cases
- A developer migrates a help-centre export, one HTML file per article, into a docs-as-code repository.
- A writer recovers old blog posts from a CMS export as Markdown for a static site generator.
- A researcher saves web articles as Markdown notes in Obsidian or Logseq.
- A team leaving Confluence converts the HTML export of a space into Markdown pages for a Git-backed wiki.
How to use this tool
- Paste the article's outer HTML into the Paste HTML box and press Convert text; a dropped .html file converts the moment it lands.
- Scan the preview for an empty header row above a table and for ☐ or ☑ characters, and decide whether to fix the source or the Markdown.
- Check that links kept their addresses; a link that is now plain text had a relative or non-web address.
- Copy the Markdown into your editor or wiki, or save it with Download .md; Edit in Word editor opens the parsed document if you also want a Word copy.
Example
HTML input (pasted)
<h1>Resetting your password</h1>
<p>Open <strong>Settings</strong>, then choose <em>Security</em>.
You will need the code we <a href="https://example.com/help/codes">email you</a>.</p>
<ol>
<li>Choose Forgot password</li>
<li>Enter the code
<ul><li>Codes expire after 10 minutes</li></ul>
</li>
</ol>
<table>
<tr><th>Plan</th><th>Reset limit</th></tr>
<tr><td>Free</td><td>3 per day</td></tr>
</table>Markdown output (saved as Resetting your password.md)
# Resetting your password
Open **Settings**, then choose *Security*. You will need the code we [email you](https://example.com/help/codes).
1. Choose Forgot password
2. Enter the code
- Codes expire after 10 minutes
| Plan | Reset limit |
| --- | --- |
| Free | 3 per day |Tips for best results
- Convert the article, not the page. Open the developer tools, right-click the element that holds the article and choose Copy outerHTML; the header, sidebar and cookie banner never enter the conversion.
- Links on a saved page are usually relative, such as /docs/install, and relative links are reduced to their text; replace href="/ with href="https://your-site/ in a text editor first if the links matter.
- If a table in the preview starts with an empty header row, the page used td cells in its first row. Change them to th, or wrap the row in a thead, and convert again.
- For GitHub task lists, replace the ☐ and ☑ characters with - [ ] and - [x] after converting.
Edge cases to watch
Relative URLs and anchors disappear. A link to /pricing or #section-2 keeps its words but loses its destination, because only absolute web and mail addresses are written.
Underline, colour, highlight and font size have no Markdown form and vanish silently, so a page that signals meaning with red text or a yellow highlight loses it.
Headings below h3 are flattened to ###, and a numbered list that started at 5 restarts at 1.
The charset declared in a meta tag is not consulted: files are decoded as UTF-8 with a Windows-1252 fallback, so a page in Shift JIS or another legacy encoding shows wrong characters until it is re-saved as UTF-8.
Common errors and how to fix them
- Paste some HTML first.
- Convert text was pressed while the box was empty. Paste the markup, or press Try a sample.
- No text was found in the pasted HTML.
- The markup parsed but contained nothing writable, such as only an img tag, a script or hidden elements. Paste the element that holds the article text.
- This converter accepts HTML files (.html, .htm), up to 25MB. "article.webarchive" has a different extension.
- Safari's .webarchive and Chrome's .mhtml bundle a page with its images in a container that is not HTML, and a PDF is not HTML either. Save the page again as HTML only, or paste its markup.
- This file is larger than 25MB. Split it into smaller files and try again.
- A single page that large almost always embeds its images as base64 data. Remove the img elements in a text editor, which the converter would skip anyway, and the file shrinks to the text that matters.
Best practices
- Paste the smallest element that contains what you want. Less markup means fewer leftovers to delete and no chance of a layout table wrapping the article.
- Make links absolute before converting when the Markdown will live somewhere other than the original site.
- Read the first table and the first nested list in the preview; those two constructs most often need a small fix in the source.
Saved pages, CMS exports and pasted fragments
A page saved with Save as Webpage, complete contains everything the site sent: navigation, sidebars, footer, cookie notices and script blocks. Most of that is skipped by the reader, but header, aside and footer text is kept, so after converting a whole page check the beginning and end of the preview and delete what belongs to the site rather than the article. Pages built with JavaScript have an empty body on disk; only the rendered markup from the developer tools contains the text.
CMS and help-centre exports are cleaner but have habits of their own: a span styled bold by a rich-text editor still becomes **bold**, but classes such as callout or note carry nothing into Markdown, and their meaning has to be added back by hand. Email HTML is the hardest input, because its layout is one table inside another; the outer tables flatten into pipe tables around the content, so paste just the inner content block.
Frequently asked questions
Can I give it a link instead of the HTML?
No. The converter makes no network requests, and a browser page cannot fetch another site's HTML anyway. Save the page to disk, or copy the article's outerHTML in the developer tools, and paste that.
Why are some links now plain text?
Only absolute http, https and mailto addresses are written as Markdown links; relative paths, anchors and javascript: links are reduced to their text.
Why do checkboxes become ☐ and ☑ instead of - [ ]?
Task-list syntax only renders on GitHub and a few compatible tools, while the characters render everywhere. For GitHub, replace them with - [ ] and - [x].