HTML to Markdown Converter Online Free

💻 Developer Tools ✔ Free Forever

HTML to Markdown Converter Online Free

Paste HTML and get clean Markdown instantly. Handles headings, lists, links, images, tables, code blocks, and inline formatting. Everything runs in your browser with no data sent anywhere.

✔ Tables to Markdown ✔ Code block support ✔ Link and image conversion ✔ GFM flavor option ✔ Live preview ✔ 100% browser based
Input HTML
Output Markdown
Choose a sample
About This Tool

Converting HTML to markdown by walking the actual DOM, not the source string

The reliable way to turn HTML into markdown is to stop treating it as text. This tool loads your markup into a detached div element using innerHTML, lets the browser’s own parser build a real DOM tree out of it, and then recurses through that tree node by node. That sidesteps the usual regex nightmare of matching nested tags, because the browser has already done the nesting for you.

Nothing leaves your machine during this process. There is no network request in the script at any point, and the conversion, the live preview, and the download all run against data sitting in your browser’s memory.

The recursive node walker

Every DOM node falls into one of two categories the walker cares about: a text node, whose content is returned directly with internal line breaks collapsed to spaces, or an element node, whose tag name decides what markdown syntax wraps its children.

Step 1 Parse into a real DOM A hidden div receives your HTML through innerHTML, which triggers the browser’s HTML parser and gives you a genuine element tree, error recovery included.
Step 2 Recurse and dispatch by tag name Each node’s tagName, lowercased, is checked against roughly twenty five branches: headings become # through ######, strong and b become double asterisks, em and i become single asterisks, s and del become double tildes.
Step 3 Handle links, images, and code specially Anchor tags read the href and optional title attribute directly off the element and build a proper [text](url "title") construct. Code fences read the language-xxx class on a nested code element to fill in the fence’s language tag.
Step 4 Tables get a dedicated converter Table rows are pulled with querySelectorAll('tr'), the first row becomes the header, and a separator row of triple dashes is generated to match the header column count exactly, including padding for rows with fewer cells.
// simplified from the actual node-to-markdown function if (tag === ‘a’) { var href = node.getAttribute(‘href’) || ; var title = node.getAttribute(‘title’) || ; var txt = childrenText().trim(); return title ? ‘[‘ + txt + ‘](‘ + href + ‘ “‘ + title + ‘”)’ : ‘[‘ + txt + ‘](‘ + href + ‘)’; } if (tag === ‘pre’) { var lang = (codeEl.className.match(/language-(\w+)/) || [])[1] || ; return ‘\n\n“`’ + lang + ‘\n’ + content.trim() + ‘\n“`\n\n’; }

Quote titles are inlined directly into the parenthesis, no escaping step. If your source HTML has a link title containing a double quote, the output markdown will look slightly malformed at that spot, since the converter does not currently escape quote characters inside the title string. Worth a manual check on link heavy documents pulled from a CMS.

What each tag becomes

HTMLMarkdown output
h1 to h6One to six hash marks, with a blank line on each side
strong, bWrapped in double asterisks
em, iWrapped in single asterisks
s, strike, delWrapped in double tildes (GFM strikethrough)
a[text](href) or [text](href "title") when a title attribute is present
img![alt](src)
ul / olBullet character of your choice, or a numbered list rebuilt from list position
blockquoteEach line prefixed with >
pre > codeFenced block with the language tag pulled from the language-xxx class
tablePipe-delimited GFM table with a generated header separator row
Block containers do not add markdown syntax. Tags like div, section, article, header, footer, nav, and aside are unwrapped: their children are converted and a single newline is added around the group, but no markdown construct is introduced. This means layout wrapper divs disappear cleanly instead of leaving stray characters in your output, which is the right call for content pulled out of a page template.

The two output views

Plain markdown

The raw converted text, ready to paste into a README, a static site generator, or a documentation platform that accepts standard or GitHub Flavored Markdown.

Rendered preview

A lightweight regex-based renderer turns the generated markdown back into HTML so you can sanity-check the result visually. It is intentionally simpler than the DOM-based converter and exists only for a quick visual check, not as a full markdown parser.

Three checkboxes change conversion behavior directly: GitHub Flavored Markdown extensions, table conversion, and code block conversion. Turning table conversion off leaves table markup to fall through to the generic block handler, which strips the tags but keeps the cell text running together, so leave it on for anything with real tabular data. A fourth option controls whether list markers use asterisks or hyphens, which matters only for personal or team style preference since both render identically in any markdown processor.

DOM tree recursion GFM table support Fenced code with language tags Live regex-based preview

Converters and Markdown specs

Migration jobs this solves

Pulling a blog post out of a CMS export into a Markdown based static site, converting scraped documentation pages into README friendly text, turning an HTML email template into a plain markdown draft for editing, and stripping a page down to structured text before feeding it into a note taking app that stores everything as markdown.

Common Questions

FAQ: HTML to Markdown Converter Online Free

Yes. No signup, no payment, and no usage limits. The tool is free permanently.

No. All conversion happens inside your browser. Nothing leaves your device.

GFM is a Markdown extension used by GitHub, GitLab, and many documentation tools. It adds support for tables, strikethrough, task lists, and fenced code blocks with syntax highlighting.

Yes. Enable the Convert tables option to get GFM pipe table syntax with header separators and aligned columns.

Structural tags like div and section are flattened. Enable Strip remaining HTML to remove any unsupported tags and keep only plain Markdown content.

Yes. Click the Preview tab in the output panel to see a rendered version of the Markdown before downloading.

Privacy Overview

Cookies let this site remember your preferences and show us which tools people actually use. Full detail sits in our Privacy Policy.