Free tool
HTML to Markdown converter
Paste HTML source, or copy rich text from a web page, Google Docs or Word and paste it here, and get clean Markdown as you type. Tables become GitHub-flavored tables, code blocks keep their language, and scripts and page chrome are left out.
Free · no sign-up · runs in your browser, nothing is uploaded
Loading the converter…
How each HTML element is converted
| HTML | Markdown | Note |
|---|---|---|
| <h2>Setup</h2> | ## Setup | Setext style (underlined with --- or ===) works for h1 and h2 only. |
| <strong>, <b> | **bold** | Or __bold__. |
| <em>, <i> | _italic_ | Or *italic*. |
| <a href="/docs">Docs</a> | [Docs](/docs) | Reference style puts the URLs at the end. |
| <img src="a.png" alt="A"> |  | Untick Keep images to drop them. |
| <ul><li> | - item | Nested lists are indented to the item text. |
| <ol start="3"> | 3. item | The start number is kept. |
| <input type="checkbox" checked> | - [x] item | GFM task list. |
| <del>, <s> | ~~text~~ | GFM strikethrough. |
| <pre><code class="language-js"> | ```js | The language comes from language-*, lang-* or GitHub’s highlight-source-* classes. |
| <blockquote> | > quote | |
| <table> | | a | b | | GFM table with alignment. |
| <hr> | --- | |
| <br> | two spaces + newline | A hard line break in CommonMark. |
Pasting rich text versus pasting HTML
When you copy from a browser, Google Docs or Word, the clipboard holds two versions: plain text and HTML (text/html). The paste area reads the HTML version, so you do not need to open the page source first. The HTML it received appears in the box below it, where you can edit it and watch the Markdown update.
Office apps add a lot of markup. On Windows the copied HTML is wrapped in <!--StartFragment--> comments, which the tool strips. Word adds many styled spans; Google Docs puts the whole paste inside <b style="font-weight:normal" id="docs-internal-guid-…">. A plain converter turns all of that text bold. This one unwraps that tag and turns spans with font-weight: 700 or font-style: italic into **bold** and _italic_.
If only plain text is on the clipboard, for example after copying from a terminal, there is no formatting to keep, and the tool says so.
Convert HTML to Markdown in code
JavaScript with turndown, the library this tool uses. Tables and strikethrough come from the turndown-plugin-gfm plugin:
import TurndownService from 'turndown';
import { gfm } from 'turndown-plugin-gfm';
const td = new TurndownService({ headingStyle: 'atx', codeBlockStyle: 'fenced', bulletListMarker: '-' });
td.use(gfm);
td.remove(['script', 'style']);
const markdown = td.turndown(html);turndown’s defaults are setext headings, * bullets and indented code blocks, so set the options above if you want the style most READMEs use.
Python with markdownify. Its default heading style is also setext (UNDERLINED):
from markdownify import markdownify as md markdown = md(html, heading_style="ATX", strip=["script", "style"])
Command line with pandoc:
pandoc -f html -t gfm page.html -o page.md # Without the line wrapping pandoc adds by default: pandoc -f html -t gfm --wrap=none page.html -o page.md
Go with html-to-markdown v2. Tables need its table plugin (--plugin-table on the CLI):
import htmltomarkdown "github.com/JohannesKaufmann/html-to-markdown/v2"
markdown, err := htmltomarkdown.ConvertString(html)
if err != nil { log.Fatal(err) }What gets lost, and how to keep it
- Layout and styling. Colors, fonts, columns and classes have no Markdown form. If a block must keep them, leave it as raw HTML in the Markdown file; GFM renders most HTML tags.
- Merged table cells. Markdown tables have no colspan or rowspan. The converter keeps the columns lined up by adding empty cells, but the merge itself is gone. Keep complex tables as HTML.
- Relative links and images. A link like
/pricingstays relative. If the Markdown will live somewhere else, replace it with the full URL. - Characters that mean something in Markdown. Text such as
*not emphasis*or a line starting with1.is escaped with backslashes so it stays text. So is text that looks like a tag, such as<div>written in a sentence; unescaped, a Markdown renderer would read it as raw HTML and hide it.
To check the result, switch the output to Preview, or open it in the Markdown to HTML converter. To tidy the HTML before converting, use the HTML formatter. To build or fix a table, use the Markdown table generator. Moving content between systems? Browse CMS tools and documentation tools on DevHunt.
More free developer tools
FAQ
How do I convert HTML to Markdown?+
Paste the HTML source into the box above, or drop an .html file. The Markdown appears as you type, and you can copy it or download a .md file. On the command line, pandoc -f html -t gfm page.html -o page.md does the same.
How do I copy a web page as Markdown?+
Select the part of the page you want, copy it, click the orange paste area above and press Ctrl+V or ⌘+V. Browsers put the selection on the clipboard as HTML, so headings, links, lists and tables come through. For a whole saved page, tick "Main content only" to drop the menu, sidebars and site footer.
Can I convert a Google Doc or Word document to Markdown?+
Yes. Copy the text in Google Docs or Word and paste it into the paste area. Both apps mark bold and italic with inline styles instead of <strong> and <em>, and Google Docs wraps the whole paste in a <b> tag. The converter reads those styles, so only the text you made bold ends up bold. Word copies list items as paragraphs with the bullet or number typed in; they come back as Markdown lists.
Does the converter keep tables?+
Yes. HTML tables become GitHub-flavored Markdown tables with aligned columns. The align attribute or text-align style sets the colons in the delimiter row, pipes in cells are escaped, and a cell with colspan is padded with empty cells. Markdown tables have no merged cells or block content, so lists inside a cell are flattened to one line.
What happens to HTML that Markdown cannot express?+
Scripts, styles, forms, iframes and the <head> are removed. Tags with no Markdown equivalent, such as <div> or <span> with a class, are unwrapped and their text is kept. Classes, ids and inline styles are lost, apart from the bold, italic and alignment styles described above.
Why convert HTML to Markdown for an LLM or a RAG pipeline?+
Markdown keeps the structure a model needs, such as headings, lists, tables and code, without the tags, attributes and scripts of the HTML. The text is usually much shorter, so it costs fewer tokens and splits cleanly on headings. Use Main content only to leave out navigation and footers.
Is my HTML uploaded anywhere?+
No. The conversion runs in your browser with the turndown library. Nothing you paste or drop is sent to a server. Short inputs are kept in the page URL so you can share a result; long ones are not.
Sources: turndown · GitHub Flavored Markdown spec · CommonMark spec · Pandoc user guide · python-markdownify · JohannesKaufmann/html-to-markdown (Go) · MDN: Clipboard API. Checked October 2026.