HTML to Markdown
Paste HTML — or copy any web page, Google Doc, or email and paste it as rich text — and get clean GitHub-flavored Markdown with tables, code blocks, and links intact.
Paste HTML above (or hit "Try a sample") — the Markdown appears here as you type.
Convert HTML to Markdown online — three ways in
This HTML to Markdown converter takes whatever you have and returns clean, GitHub-flavored Markdown, live as you paste:
- HTML source— paste markup (a fragment or a whole page from "view source") or drop a .html file.
- Paste rich text — copy formatted content from any web page, Google Docs, Word, Outlook, Gmail, or Notion and paste it; the formatting becomes Markdown.
- From a URL — convert a live web page to Markdown, main content only, with links made absolute.
Before converting, the HTML is cleaned: scripts, styles, SVG icons, forms, and hidden elements are dropped; lazy-loaded images get their real source; highlighted code blocks keep their language for the fence; empty permalink anchors next to headings disappear. Then Turndown with the GFM plugin writes the Markdown — tables, strikethrough, and task lists included. The preview tab renders the result so you can check it before you copy.
Rich text to Markdown: Google Docs, Word, and web pages
When you copy from a document or a web page, your clipboard holds HTML, not just text. The rich-text box reads that HTML, which is why formatting survives. Each source has its quirks, and the converter knows them:
- Google Docs to Markdown — Docs wraps everything in a
<b id="docs-internal-guid…">and expresses bold and italic as inline styles on<span>s, which naive converters turn into one big bold blob or lose entirely. Here they become**bold**and_italic_, strikethrough becomes~~text~~, Google redirect links are unwrapped to the real URL, monospace text becomes`code`, runs of monospace paragraphs become a fenced code block, and tables get a proper header row. - Microsoft Word— Word's clipboard HTML fakes lists with indented paragraphs and
mso-liststyles. Those are rebuilt into real, nested Markdown lists (numbered or bulleted), and the office-specific junk (<o:p>, conditional comments) is dropped. - Web pages, email, Notion— select any part of a page, copy, paste. The result is the same Markdown you'd get from its HTML source, without having to open dev tools.
- Plain text to Markdown — pasting text with no formatting still works: paragraphs become Markdown paragraphs and single line breaks are kept.
For a whole Google Doc, Docs' own File → Download → Markdown (.md) is also handy; the paste route is quicker for a section, keeps working in docs you can only view, and lets you choose the Markdown style.
Web page to Markdown for LLMs and notes
Markdown is the format language models read best: it keeps the structure of a page — headings, lists, tables, code — at a fraction of the tokens HTML needs. Enter a URL and the page is fetched, reduced to its main content (the <article> or <main> element, or the densest block of text when a page has neither), and converted. With "Add title + source link" on, the Markdown starts with the page title and its URL, ready to paste into ChatGPT, Claude, a notes app, or a RAG pipeline.
The fetch goes through a small server-side proxy (browsers can't read other sites directly); it only fetches public pages, caps them at 2 MB, and stores nothing. Pages that build their content with JavaScript after loading may come back thin — for those, open the page, select the content, and use the rich-text paste instead.
HTML table to Markdown
HTML tables become GitHub-flavored Markdown tables, with align and text-align turned into :---, :---:, and ---: column alignment and pipes inside cells escaped. Markdown's table syntax is simpler than HTML's, so a few rules apply:
- A Markdown table always has a header row. If the HTML table has no
<thead>or<th>cells (common in Google Docs and Word), the first row is used as the header. - Line breaks inside a cell become
<br>, since a Markdown table row must stay on one line. colspanis padded with empty cells;rowspanhas no Markdown equivalent.- Tables containing lists, headings, block quotes, or code blocks are kept as HTML (valid in GitHub Markdown) instead of being mangled; layout tables nested inside other tables are flattened to their content.
Markdown style options explained
- Headings — ATX (
# title) works for all six levels; setext underlines (===/---) only exist for h1 and h2, so deeper levels still use#. - Code blocks — fenced blocks keep the language (
```python) for syntax highlighting; indented blocks (four spaces) are the original Markdown style. Fences grow automatically when the code itself contains backticks. - Link style — inline
[text](url), or reference style[text][1]with the URLs collected at the end, which reads much better in link-heavy documents. - Keep images / keep links — turn them off to get text-only Markdown (links keep their text), useful for LLM prompts and word counts.
- Main content only — for whole pages: drops navigation, headers, footers, sidebars, cookie banners, and share widgets before converting.
HTML to Markdown in Python, JavaScript, and pandoc
Converting in bulk or in a pipeline? These are the standard tools.
Python — markdownify(the usual answer to "Python HTML to Markdown"):
# pip install markdownify from markdownify import markdownify as md markdown = md(html, heading_style="ATX", bullets="-", strip=["script", "style"])
Python — html2text, older and very configurable:
# pip install html2text import html2text h = html2text.HTML2Text() h.body_width = 0 # don't hard-wrap lines h.ignore_images = False markdown = h.handle(html)
JavaScript — Turndown, the library this page uses, in the browser or in Node (with a DOM like jsdom or linkedom). A few lines turn it into your own HTML to Markdown API:
// npm i turndown @joplin/turndown-plugin-gfm
import TurndownService from "turndown";
import { gfm } from "@joplin/turndown-plugin-gfm";
const td = new TurndownService({ headingStyle: "atx", codeBlockStyle: "fenced" });
td.use(gfm);
td.remove(["script", "style"]);
const markdown = td.turndown(html);Pandoc — from the command line, for files or URLs:
pandoc page.html -f html -t gfm --wrap=none -o page.md pandoc https://example.com/post -f html -t gfm --wrap=none -o post.md
Frequently asked questions
How do I convert HTML to Markdown?
Paste the HTML into the "HTML source" box (or open a .html file) and the Markdown appears instantly below. Pick your preferred style — heading format, bullet marker, code fences, link style — then copy it or download a .md file. Nothing is uploaded.
How do I convert rich text to Markdown?
Switch to "Paste rich text", click into the white box, and paste. The formatted HTML your browser puts on the clipboard is converted, so headings, bold, italics, lists, links, tables, and code come through as Markdown instead of being flattened to plain text.
How do I convert Google Docs to Markdown?
Select the content in your Google Doc, copy it, and paste it into the "Paste rich text" box. The converter understands Google Docs' clipboard format — styled spans for bold and italic, redirect-wrapped links, monospace paragraphs for code, header-less tables — and turns it into clean Markdown. Google Docs can also export a whole document via File → Download → Markdown.
How do I convert a web page to Markdown?
Use "From a URL": enter the address and the page is fetched, stripped down to its main content (navigation, headers, footers, and sidebars removed), and converted to Markdown with relative links and images made absolute. It's a quick way to feed an article into ChatGPT, Claude, or any LLM prompt.
How do I convert an HTML table to Markdown?
Paste the table's HTML (or copy the rendered table from a page and use rich-text mode). It becomes a GitHub-flavored Markdown table with column alignment preserved. A Markdown table needs a header row, so if the HTML has none the first row is promoted. Tables that contain lists, headings, or other tables are kept as HTML because Markdown can't express them.
How do I convert HTML to Markdown in Python?
The most popular option is markdownify (pip install markdownify; from markdownify import markdownify as md; md(html, heading_style="ATX")). html2text is another long-standing choice, and pandoc handles it from the command line with pandoc -f html -t gfm. Examples are further up this page.
How do I convert HTML to Markdown with pandoc?
Run pandoc page.html -f html -t gfm -o page.md. Use -t gfm for GitHub-flavored Markdown (tables and strikethrough), add --wrap=none to keep each paragraph on one line, and -t commonmark if you need strict CommonMark.
What does this HTML to Markdown converter use under the hood?
Turndown, the widely used JavaScript HTML-to-Markdown library, with the GitHub-flavored Markdown plugin for tables, strikethrough, and task lists — plus a cleanup pass that handles Google Docs, Microsoft Word, and messy real-world pages before Turndown runs.
Why are some images or links missing?
Images pasted from Word often point at temporary files on your computer, which don't work anywhere else, so they're dropped (a note says how many). Links without text, javascript: links, and anything inside navigation (with "Main content only" on) are removed on purpose. Turn off "Keep images" or "Keep links" to strip them all.
Is my HTML uploaded?
Pasted HTML, rich text, and opened files are converted entirely in your browser and never leave your device. Only the URL mode goes through our server, because browsers can't read other sites directly — the page is fetched, handed back to your browser, and not stored.
Related free tools
See all free tools →Built something? Put it online in seconds
host0 is the cloud for small software: bring any coding agent, build the tool only you need — like this one — and say "deploy to host0". Live at a shareable URL, no servers to run.