HTML to Markdown Converter
Paste HTML source and get clean Markdown back: headings become #, lists become dashes, tables become GFM tables. Scripts, styles and comments are dropped, and Markdown special characters in the text are escaped so they render literally.
Moving formatted web content into a Markdown document — a README, a docs site, a note-taking app — is where deleting tags by hand gets slow: headings want hashes, lists want hyphens, tables want a bare separator row. This tool parses the HTML structure and re-emits it as Markdown: headings become hashes, lists become dashes, tables become GFM tables, and asterisks and underscores in the prose are escaped so they are not read as formatting.
Two expectations. Script, style, HTML comments and the doctype are dropped whole, contents included — pasting CSS or JavaScript into Markdown only produces noise. And merged cells (colspan, rowspan) and complex nested layouts have no Markdown equivalent, so they degrade to ordinary cells and need finishing by hand.
Did this tool solve your problem?
Submitting sends the tool name, your input and the current result to the server. Please do not include ID numbers, phone numbers or other private data.
AI assistant It answers using your current input and result
Asking again sends your current input and result to the server once more. Please do not include private data.
How to use
- Paste the HTML.
- Read the converted Markdown.
- Check headings, lists, links and tables came through.
- Fix up merged cells and complex nesting by hand — Markdown cannot express them.
How it works
Supported tags and their Markdown forms
Block tags: h1–h6 become 1–6 #; p and div become paragraphs separated by blank lines; ul/ol li become - and numbers (nested lists indent two spaces); blockquote prefixes each line with >; pre becomes a triple-backtick code block (language-xx in the class carries over as the language); hr becomes ---; br becomes "two trailing spaces + newline". Inline tags: strong/b become two asterisks, em/i one asterisk, del/s/strike two tildes, a square brackets plus parentheses, img an exclamation mark plus brackets, code backticks.
Why some content disappears
script, style, HTML comments and DOCTYPE are dropped whole (content included) because they aren't body text — pasting CSS rules or JavaScript into Markdown only creates noise. If you truly need the script text, strip the tags first with the HTML-tag remover and tidy it yourself.
Escaping and tables — two special notes
Two special notes. Escaping: asterisks, underscores, brackets, tildes, backticks and backslashes in body text get backslash prefixes so they aren't read as Markdown syntax — but markers generated from tags are not escaped, so bold stays bold. Tables: a Markdown table must have a header row, so even without th in the HTML the first row becomes the header — a GFM requirement, not a conversion bug.
Code example
JavaScript Converting in Node (turndown)
import TurndownService from 'turndown';
const td = new TurndownService({
headingStyle: 'atx', // use # instead of underline-style headings
codeBlockStyle: 'fenced', // use triple backticks
bulletListMarker: '-',
});
td.remove(['script', 'style']); // drop these blocks entirely to avoid noise
console.log(td.turndown('<h1>Title</h1><p>Body <b>bold</b></p>'));
// # Title
//
// Body **bold**
Shell Converting on the command line (Pandoc)
# HTML to Markdown (-t gfm emits GitHub-flavored Markdown)
pandoc -f html -t gfm --no-highlight in.html -o out.md
# Conveniently rewrite remote image links to local relative paths (once the images are local)
sed -i "" "s#https://example.com/assets/##g" out.md
# Note: back up before batch edits, then confirm with a quick diff
FAQ
Bold turned into two asterisks but my editor shows them literally?
First confirm the editor is in Markdown mode, not rich-text — many WYSIWYG editors display the asterisks as-is. Then check for stray spaces around them (Markdown requires ** to hug the text). The output is the standard **text** form, rendering correctly on GitHub, Typora, VS Code, Yuque and friends.
Why did the script and style contents vanish?
Deliberate. Scripts and styles aren't body text — pasting them into Markdown yields unreadable noise, and the braces and semicolons easily break the document. They're dropped whole with their tags. If you need that text, strip it out with the HTML-tag remover first and tidy by hand.
Can merged table cells be recovered?
No — they degrade to plain cells. Markdown (GFM included) has no rowspan/colspan in its table syntax, so any converter must downgrade: merged content lands in the first cell and the covered positions stay empty. To keep merges, use an HTML table or an image in the target document.
Are event attributes (onclick) and inline styles kept?
All dropped. The conversion extracts only tag kinds, text content and link/image URLs; class, id, style, onclick and data-* have no Markdown counterpart and serve no purpose. This is also why the tool is safe to run on untrusted HTML.
The nested list indentation looks too wide — is that wrong?
No. Each nesting level indents exactly two spaces in Markdown — the most portable form; three levels means six spaces. Some renderers parse loose lists (blank lines + indentation) slightly differently; if the target platform misrenders, remove the blank lines for a tight list, which is usually more stable.
Can I paste a whole page's "view source" HTML?
You can, but copy just the body section. Full-page source includes navigation, footers and tracking scripts — you'd get a long Markdown full of ad-copy text, costing more cleanup than copying by hand. Use the browser's "copy element" or reader mode to grab the body region for best results.
Asterisks in my text got backslashes — is that a bug?
Deliberate escaping. In Markdown, asterisks and underscores are format markers; without escaping, text like 2*3 could open an italic run and scramble everything after. The backslash (\*) makes renderers output the asterisk literally. If your destination doesn't need it, turn off "escape special characters".
Will the result render correctly on GitHub?
The common structures — headings, lists, quotes, code blocks, tables, links and images, strikethrough — all follow GFM and work in GitHub and GitLab READMEs directly. One caveat: hard line breaks use "two trailing spaces", the CommonMark standard, but editors that trim trailing whitespace will break them — use blank lines between paragraphs instead.