Skip to main content

Free Tool

Markdown to HTML Converter

Paste Markdown on the left and copy the HTML on the right, or download it as a complete .html page. GitHub Flavored Markdown, converted in your browser. Nothing is uploaded.

<h1>Hello Markdown</h1>
<p>This is a <strong>bold</strong> paragraph with a <a href="https://example.com">link</a>.</p>
<ul>
<li>Item one</li>
<li>Item two</li>
<li>Item three</li>
</ul>
<blockquote>
<p>A blockquote for good measure.</p>
</blockquote>
<h2>Code sample</h2>
<p>Use <code>inline code</code> or a fenced block:</p>
<pre><code class="language-js">function greet(name) {
  return `Hello, ${name}!`;
}
</code></pre>

Not sanitized: raw HTML in your Markdown, including <script> tags and onclick attributes, is copied through unchanged. Run untrusted input through a sanitizer such as DOMPurify first.

What each Markdown element becomes

Markdown is a shorthand for a small set of HTML tags. This is the exact output of the converter above for each piece of syntax:

Markdown syntax and the HTML it converts to
MarkdownHTML
# Heading<h1>Heading</h1>
**bold** and *italic*<strong>bold</strong> and <em>italic</em>
~~struck~~<del>struck</del>
`code`<code>code</code>
[text](https://example.com)<a href="https://example.com">text</a>
![alt](cat.png)<img src="cat.png" alt="alt">
- item<ul> <li>item</li> </ul>
1. item<ol> <li>item</li> </ol>
> quote<blockquote> <p>quote</p> </blockquote>
```js … ```<pre><code class="language-js">…</code></pre>
- [x] done<li><input checked="" disabled="" type="checkbox"> done</li>
---<hr>

Tables become <table> with a <thead>, and column alignment becomes an align attribute on each cell. The cheat sheet has the full syntax.

How close is it to GitHub?

The converter parses GitHub Flavored Markdown, so tables, task lists, strikethrough, fenced code, and bare URLs convert the way GitHub reads them. Four things differ from what you see on github.com:

  • Raw HTML is kept. GitHub strips scripts, inline styles, and many attributes from the HTML in a README. This converter passes everything through, so sanitize untrusted input yourself.
  • No heading anchors. GitHub gives every heading an id so you can link to it; this output has plain <h2> tags.
  • No syntax highlighting. A fenced block gets a language-js class for a highlighter such as Prism or highlight.js to pick up, but no colors of its own.
  • GitHub-only extensions are not converted: footnotes, > [!NOTE] alerts, math, and Mermaid diagrams.

Line breaks: a space or a <br>?

By default a single newline becomes a space, which is what GitHub does with a .md file and what Pandoc, static site generators, and CommonMark all do. Tick Turn every newline into <br> to convert text written for a GitHub comment, Discord, or Slack, where every newline shows. The line breaks guide explains both rules.

Convert Markdown to HTML from the command line

For a build step or a folder of files, one of these does the same job:

Pandoc

pandoc -f gfm README.md -o README.html

-f gfm reads GitHub Flavored Markdown; leave it off to use Pandoc's own extended Markdown. Output is a fragment unless you add -s for a complete page.

marked (Node)

npx marked -i README.md -o README.html

The same parser this converter runs, so the output matches what you see here.

Python

python -m markdown -x extra README.md > README.html

Python-Markdown, installed with pip install markdown. The extra extension adds tables, fenced code blocks, and footnotes; without it, none of those are converted. In code: markdown.markdown(text, extensions=["extra"]).

Want a PDF instead? Use the Markdown to PDF converter. Starting from a PDF? The PDF to Markdown converter gets the text out first.

Frequently asked questions

How do I convert Markdown to HTML?
Paste the Markdown into the converter above. The HTML tab shows the generated markup as you type; Copy HTML puts the fragment on your clipboard, and Download saves a complete .html page with basic styling. Nothing to install.
Which Markdown syntax does this converter support?
GitHub Flavored Markdown: headings, emphasis, links, images, lists, blockquotes, fenced code blocks, tables, task lists, strikethrough, and bare URLs turned into links. GitHub-only extras are not converted: footnotes, [!NOTE] alerts, math, and Mermaid diagrams.
Is the HTML output sanitized?
No. Raw HTML in your Markdown, including <script> tags and event attributes such as onclick, is copied into the output unchanged, as it is by most Markdown parsers. If the Markdown comes from someone you do not trust, run the HTML through a sanitizer such as DOMPurify before publishing it.
Is the preview safe to use with untrusted Markdown?
Yes. The preview renders inside a sandboxed iframe with no permissions, so scripts in the Markdown cannot run, submit forms, or touch this page. That protects the preview only; the copied HTML is still unsanitized.
Why are my line breaks missing from the HTML?
In standard Markdown a single newline is a space, so two lines typed one under the other become one paragraph. End a line with two spaces or a backslash for a <br>, leave a blank line for a new paragraph, or tick the newline option to convert every newline the way GitHub comments do.
How do I convert Markdown to HTML in Python?
Install Python-Markdown with pip install markdown, then call markdown.markdown(text, extensions=["extra"]), or run python -m markdown -x extra README.md > README.html. The extra extension is what adds tables and fenced code blocks.
Does this tool upload my Markdown?
No. The conversion runs in your browser, and the text you paste is never sent to a server. It keeps working with your network disconnected once the page has loaded.