Free tool
Markdown to HTML converter
Paste Markdown and get clean HTML as you type, with a live preview next to it. GitHub-flavored tables, task lists and strikethrough are supported, headings get the same #anchor ids as on GitHub, and scripts are stripped before you copy.
Free · no sign-up · runs in your browser, nothing is uploaded
Loading the converter…
What each Markdown element becomes
| Markdown | HTML | Note |
|---|---|---|
| # Title | <h1 id="title">Title</h1> | The id is added when Heading ids is on. |
| **bold** _em_ | <strong>bold</strong> <em>em</em> | Asterisks and underscores both work. |
| [text](https://x.dev) | <a href="https://x.dev">text</a> | Bare URLs become links too in GFM. |
|  | <img src="img.png" alt="alt"> | |
| - item | <ul><li>item</li></ul> | 1. starts an <ol>. |
| - [x] done | <li><input checked disabled type="checkbox"> done</li> | GFM task list. |
| ~~old~~ | <del>old</del> | GFM strikethrough. |
| `code` | <code>code</code> | |
| ```js | <pre><code class="language-js"> | The language becomes a class for highlighters such as Prism or highlight.js. |
| > quote | <blockquote><p>quote</p></blockquote> | |
| | a | b | | <table><thead>… | GFM table. Colons in the delimiter row become align attributes. |
| --- | <hr> | Also *** and ___. |
Sanitizing: why the HTML needs cleaning
Markdown is a superset of HTML in practice: any raw tag in the source goes straight into the output. That is useful for <details> or <kbd>, and dangerous for anything users write, because <img src=x onerror="…"> runs JavaScript in every browser that shows it.
The marked library, which this tool uses, does not sanitize its output, and its docs say to run a sanitizer afterwards. With Sanitize on, the HTML goes through DOMPurify, which removes scripts, event handler attributes and javascript: URLs and keeps ordinary formatting. The tool lists what it removed. GitHub goes a step further and filters <title>, <textarea>, <style>, <xmp>, <iframe>, <noembed>, <noframes>, <script> and <plaintext> as part of the GFM spec.
If you convert Markdown on a server, sanitize there too. Cleaning only in the browser does not protect other places the HTML ends up, such as emails or RSS feeds.
Convert Markdown to HTML in code
JavaScript with marked, sanitized with DOMPurify. On Node.js, DOMPurify needs a DOM such as jsdom:
import { marked } from 'marked';
import DOMPurify from 'dompurify';
const html = DOMPurify.sanitize(marked.parse(markdown, { gfm: true }));Command line with pandoc. Add -s for a full page with <head>:
pandoc -f gfm -t html README.md -o README.html pandoc -s -f gfm -t html README.md -o page.html --metadata title="README"
Python with Python-Markdown. It follows the original Markdown rules, so tables and fenced code come from extensions:
import markdown html = markdown.markdown(text, extensions=["tables", "fenced_code", "toc"])
Go with goldmark and its GFM extension:
var buf bytes.Buffer
md := goldmark.New(goldmark.WithExtensions(extension.GFM))
if err := md.Convert(source, &buf); err != nil { panic(err) }Things that trip people up
- Lists right after a paragraph. In CommonMark a list can interrupt a paragraph, but an ordered list can only do so when it starts at 1. Leave a blank line before lists to be safe across renderers.
- Indentation inside lists. A nested list or a code block inside a list item must be indented to line up with the item’s text, not just by one space.
- Underscores in words.
snake_case_namestays as text in CommonMark, because underscores inside a word do not start emphasis. Asterisks do:a*b*cmakes the b italic. - Going back. To turn HTML into Markdown, use the HTML to Markdown converter. To build a table first, use the Markdown table generator. To tidy the HTML, use the HTML formatter.
Picking a docs tool or a CMS? Browse documentation tools and CMS tools on DevHunt.
More free developer tools
FAQ
How do I convert Markdown to HTML?+
Paste the Markdown into the box above. The HTML appears as you type, and you can switch between the rendered preview and the HTML source, then copy it or download an .html file. On the command line, pandoc -f gfm -t html input.md -o output.html does the same.
Can I use HTML inside Markdown?+
Yes. CommonMark passes raw HTML blocks and inline tags through to the output, so <details>, <kbd> or a <table> with merged cells work. GitHub then filters a few tags such as <script>, <style> and <iframe>. With Sanitize on, this tool removes scripts and event handlers the same way.
Is converting Markdown to HTML safe?+
Not on its own. Markdown allows raw HTML, so a file can contain <script> or <img onerror=...>. Libraries like marked do not clean their output, and their docs say to run a sanitizer such as DOMPurify. This tool does that by default and lists what it removed. The preview is always sanitized.
Why does a single line break not show up in the HTML?+
In CommonMark a single newline inside a paragraph is a soft break and renders as a space. End the line with two spaces or a backslash for a hard break, leave a blank line for a new paragraph, or tick "Line break = <br>" above.
How do heading links (#anchors) work?+
GitHub gives each heading an id: lower case, spaces become hyphens, punctuation is removed, and a repeated heading gets -1, -2 and so on. With Heading ids on, this tool writes the same ids, so links like #installation from your README keep working. It also builds a table of contents you can copy.
What is GitHub-flavored Markdown?+
GFM is GitHub’s superset of CommonMark. It adds tables, task lists (- [x]), strikethrough (~~text~~), autolinks for bare URLs and www. addresses, and a filter for unsafe raw HTML tags. Untick the GFM option to convert with plain CommonMark-style rules.
Can I get a complete HTML page instead of a fragment?+
Yes. Tick Full HTML page to wrap the result in <!doctype html>, a <head> with charset, viewport and the first H1 as the title, and a small readable stylesheet. Download it as document.html and open it in any browser.
Sources: CommonMark spec · GitHub Flavored Markdown spec · GitHub Docs: section links · marked documentation · DOMPurify · Pandoc user guide · Python-Markdown extensions · goldmark. Checked October 2026.