How to convert Markdown to HTML
- Paste Markdown into the editor, open a
.mdfile, or drop one anywhere on this page. - Check the preview. It is drawn from the HTML you will get.
- Choose how you want it:
- Download HTML saves one complete
.htmlfile with its styles inside and no script. It opens in any browser, attaches to an email, and can go straight onto a web server. - Copy HTML puts the markup on the clipboard, without a stylesheet, for the HTML view of a CMS, a static site or an email builder.
- Download HTML saves one complete
Which HTML you get
| In the Markdown | In the HTML |
|---|---|
# Release notes | <h1 id="release-notes">, with the id GitHub would give it |
| Paragraphs | <p> |
**bold**, *italic*, ~~struck~~ | <strong>, <em>, <del> |
- item, 1. item | <ul> or <ol> with <li> items |
- [x] done | <li> starting with a ticked, disabled <input type="checkbox"> |
| Tables | <table> with <thead> and <tbody> |
| Fenced code with a language | <pre><code class="hljs language-bash">, highlighted with <span class="hljs-…"> |
> quote | <blockquote> |
[text](https://…) | <a href> that opens in a new tab, with rel="noopener noreferrer" |
 | <img> with its alt, loaded lazily and without a referrer |
A bare https:// address | A link |
YAML front matter is kept as a folded <details class="front-matter"> box at the top; delete that block if you do not want it.
Heading ids follow GitHub's rule: lower case, punctuation dropped, spaces turned into hyphens, and a number added when two headings match. Links such as #installation that work on GitHub keep working in the HTML.
Clean HTML, safe to paste
Raw HTML in a Markdown file is passed through to the output, which is how a Markdown file can carry a script. This converter cleans every document with DOMPurify before it is shown or exported:
- Scripts,
<style>,<iframe>, forms,on…event attributes,styleattributes andjavascript:links are removed. - Harmless tags stay:
<details>,<kbd>,<sup>,<sub>and similar.
Check the result like any HTML you publish, but a file cannot run code through this page.
Converting Markdown to HTML in code
In JavaScript, marked is the library this page uses. Its README warns that it does not sanitize its output, so run the result through a sanitizer such as DOMPurify before showing Markdown that someone else wrote.
import { marked } from "marked";
import DOMPurify from "dompurify";
const html = DOMPurify.sanitize(marked.parse(markdown));
From the command line, Pandoc writes an HTML fragment by default; -s makes a complete page with <head> and <body>:
pandoc -s notes.md -o notes.html
Your text stays on your device
The converter is JavaScript that does all of its work in this browser tab.
- The HTML is made in your browser from the text in the editor. No request carries your text, which you can confirm in the browser's network panel. Like every page on this site, the page records an anonymous visit, which sends its own address and nothing you open.
- The text is kept in this browser's local storage, so it is still there when you come back, here or in the Markdown viewer. Clear removes it.
- Images with a full
https://address load from their own servers, as they would in any viewer.