Content tends to be born in HTML and end up needing to live in Markdown. A team moves its documentation from an old CMS to a Git repository. A blog migrates to a static site generator. You want to keep a clean copy of an article in your notes app, or paste part of a web page into a README. Copying the visible text loses the headings, links and lists; copying the HTML brings along a mess of <div> wrappers and inline styles.
This guide explains what a good HTML-to-Markdown conversion keeps and what it has to drop, shows how to convert content step by step, and covers the clean-up work that makes a migration go smoothly.
Why convert HTML to Markdown at all
Markdown files are plain text, so they are easy to version in Git, review in pull requests, search with ordinary tools and edit in any editor. Many documentation platforms, wikis and static site generators store content as Markdown. HTML is more expressive, but that expressiveness is often noise: presentational classes, tracking attributes and nested wrappers that only made sense in the old design.
A conversion is therefore partly a clean-up. You keep the meaning of the content (headings, emphasis, links, lists, tables, code) and let go of the presentation.
What converts well and what does not
| HTML | Markdown result |
|---|---|
<h1> to <h6> |
# to ###### headings |
<strong>, <b> |
**bold** |
<em>, <i> |
*italic* |
<a href="…"> |
[text](url), including the title attribute |
<img> |
 |
<ul>, <ol> and nested lists |
- and 1. items with indentation |
<pre><code class="language-bash"> |
Fenced code block tagged bash |
<blockquote> |
> quoted lines |
<table> |
GitHub-style pipe table |
<hr> |
--- |
Some things have no Markdown equivalent at all:
- Layout and styling: colours, fonts, columns and CSS classes are dropped.
- Interactive elements: forms, buttons, scripts, iframes, canvases and embedded SVG are removed, because Markdown cannot represent them.
- Complex tables: merged cells (
colspan,rowspan) and block content such as lists inside cells do not fit the simple pipe table format. - Underline, superscript and subscript: Markdown has no syntax for
<u>,<sup>or<sub>. Because most Markdown renderers accept inline HTML, a converter can keep these tags as they are.
Convert HTML with our tool
The HTML to Markdown Converter parses your HTML in the browser and writes GitHub-style Markdown as you type.
- Open the HTML to Markdown Converter. A sample article with a nested list, a code block, a quote and a table shows what the output looks like.
- Paste your HTML into HTML input, or click Open file to load an
.htmlor.htmfile. - Set the options:
- Bullet marker: choose
-(dash),*(asterisk) or+(plus) to match your style guide. - Heading style: # ATX (hash) is the common style; Setext (underline H1/H2) underlines the top two heading levels with
===and---. - Keep
<sup>,<sub>,<u>: leave it on to preserve those tags as inline HTML, or turn it off to keep only their text.
- Bullet marker: choose
- Read the result in Markdown output. Table column alignment from
alignattributes ortext-alignstyles is carried over, and pipe characters inside cells are escaped. - Click Copy or Download to save a
.mdfile.
Getting HTML out of a web page
You rarely want the whole page. Navigation, footers, cookie banners and sidebars are all HTML too. To grab just the article:
- Open the page in a desktop browser.
- Right-click the start of the main content and choose Inspect.
- In the element panel, find the element that wraps the article, often
<article>or<main>. - Right-click it and choose Copy → Copy outerHTML (the wording varies slightly between browsers).
- Paste that into the converter.
This gives you a much cleaner starting point than saving the complete page. Respect copyright and site terms when you copy other people's content.
Other ways to convert
Pandoc
For many files at once, Pandoc is hard to beat:
pandoc article.html -f html -t gfm -o article.md
It handles large batches and offers fine control, though it needs installing and its output for messy real-world HTML may still need clean-up.
Libraries
JavaScript and Python both have HTML-to-Markdown libraries, such as Turndown for JavaScript. They are the right choice when conversion is part of an automated migration script, because you can add custom rules for your old CMS's quirks.
CMS export plugins
Some platforms have export plugins that write Markdown with front matter directly. If one exists for your CMS, it may also carry over dates, authors and tags, which a plain HTML conversion cannot know.
Clean-up tips after converting
Check relative links and images
Links like /about or images like ../img/chart.png pointed somewhere on the old site. After a migration they may need a new base path. Search the output for ](/ and ](../ to find them.
Review tables carefully
Pipe tables allow one line per cell. Line breaks inside cells become <br>, and merged cells are flattened. If a table is essential and complex, consider keeping it as HTML inside the Markdown file.
Remove leftover noise
Empty links, tracking parameters in URLs and "Share this" text often come along with the content. A quick read of the output catches most of it. For plain text with no formatting at all, HTML to Text is the simpler option.
Confirm it renders
Paste the result into Markdown Preview to see how it will look, and convert it back with Markdown to HTML if you want to compare with the original structure.
Frequently asked questions
Does the converter keep links and images?
Yes. Links become [text](url) with any title preserved, and images become . Relative paths are kept as they are, so check them after moving content to a new site.
What happens to scripts, forms and iframes?
They are removed. Markdown has no way to represent interactive elements, so only readable content is converted.
Can it convert HTML tables with merged cells?
Merged cells cannot be represented in a pipe table, so the output is flattened. For complex tables, keep the original HTML table inside your Markdown file.
Which heading style should I choose?
ATX headings with # are the most widely supported and work for all six levels. Setext underlines only exist for levels one and two.
Is my HTML uploaded anywhere?
No. The conversion runs in your browser using its built-in HTML parser, so the content stays on your device.