HTML to Markdown Converter with GFM Tables and Code Blocks
Convert HTML to clean Markdown with GFM tables, fenced code with language, nested lists and links
Going the other way? Use the Markdown to HTML converter, or check how the result renders in the Markdown preview.
Convert HTML to Markdown for docs, READMEs and CMS migrations
Paste HTML on the left and get Markdown on the right, updated as you type. Typical uses are moving blog posts out of WordPress or another CMS into a static site generator, turning a rendered web page or email into notes, pasting documentation into a GitHub README or wiki, and cleaning up HTML that a rich-text editor produced so it can live in a Git repository as plain text.
The converter parses your input with the browser's DOMParser, the same HTML parser that renders web pages, so messy real-world markup — unclosed <p> and <li> tags, uppercase tag names, attributes without quotes — is understood the way a browser understands it. Parsing in this mode does not run scripts or load images, and <script>, <style>, <noscript>, <iframe> and form controls are dropped from the output entirely. Nothing is uploaded; the HTML to md conversion happens on your device.
What gets converted, and how
Headings h1 to h6 become # to ###### (ATX style), or, if you prefer, h1 and h2 can be written in Setext style with === and --- underlines. Paragraphs are separated by blank lines and <br> becomes a hard line break. <strong> and <b> become **bold**, <em> and <i> become *italic* (or _italic_), and <del> or <s> become ~~strikethrough~~.
Inline <code> becomes backtick code, using a longer run of backticks when the code itself contains one. <pre> blocks become fenced code blocks, and the language is kept when the markup carries it as class="language-js", class="lang-js" or a data-language attribute — the conventions used by Prism, highlight.js and most static site generators — so syntax highlighting survives the trip. Code inside <pre> is copied exactly as written, with its indentation and blank lines intact, and is never escaped, since Markdown does not interpret anything inside a fence. Links become [text](url "title") and images ; URLs containing spaces or parentheses are wrapped in angle brackets so they don't break.
Unordered and ordered lists are converted with correct nesting and indentation, ordered lists respect a start attribute, and you can choose -, * or + as the bullet. Blockquotes become > lines, including nested content. Tables become GitHub-flavored Markdown tables, with the first row as the header, column alignment taken from align or text-align, and pipes inside cells escaped. <hr> becomes ---. Characters that Markdown would otherwise treat as formatting, such as * and _ in ordinary text, are backslash-escaped so the rendered result reads the same as the original.
Limits worth knowing
Markdown is a smaller language than HTML, so some things cannot survive. Inline styles, classes, colors and layout (columns, floats) are discarded. Tables with merged cells (colspan or rowspan), or cells containing lists and multiple paragraphs, are flattened to one line per cell because GFM tables cannot hold block content. Elements with no Markdown equivalent — <span>, <div>, <section> — are unwrapped and their contents kept.
To go the other way, use the Markdown to HTML converter, and use the Markdown preview tool to see how the converted Markdown renders before you commit it.
How to use the HTML to Markdown Converter with GFM Tables and Code Blocks tool
- 1
Paste your HTML
A full page, an article body or a fragment all work.
- 2
Pick heading and bullet style
Choose ATX (#) or Setext headings, the bullet character and the italic delimiter.
- 3
Review the Markdown
Output updates as you type; scripts, styles and form elements are removed.
- 4
Copy or download
Copy the Markdown or download it as a .md file, then check it in the Markdown preview tool.
Frequently asked questions
Does it convert HTML tables to Markdown?
Yes, into GitHub-flavored Markdown tables. The first row is the header, alignment comes from align or text-align, and pipes in cells are escaped. Merged cells are not supported by GFM and are flattened.
Are code block languages preserved?
Yes, when the <pre> or its <code> carries class="language-x", class="lang-x" or a data-language attribute. The language is written after the opening fence, for example ```js.
Is it safe to paste HTML with scripts?
Yes. The HTML is parsed with DOMParser, which does not execute scripts, and script, style and iframe elements are removed from the output.
Why are some characters escaped with backslashes?
Characters like * and _ would otherwise be read as formatting. Escaping them keeps the rendered Markdown identical to the original text.
Can I convert Markdown back to HTML?
Yes, use the Markdown to HTML converter on this site.
Related on TechLogHub
Related Markdown Tools
Markdown to HTML Converter with Preview and Source View
Convert Markdown text to HTML with live preview
Markdown Table Generator with Excel and CSV Paste
Build GitHub Markdown tables in an editable grid, paste from Excel or CSV, set alignment and copy aligned output
JSON Formatter with Parse Error Positions
Format, validate, and beautify JSON with syntax highlighting
Get the next tool before you need it
One email a week: new and trending developer tools, fresh comparisons, and what shipped. Unsubscribe in one click.

