About Markdown to HTML
This page is for when the HTML is the thing you need. You wrote a post, a changelog or a set of docs in Markdown, and now a CMS, an email template or a static page wants markup. Paste the text on the left and the source appears on the right, ready to copy into a code editor or a CMS source view.
The output is deliberately plain. There are no wrapper divs, generated class names or tracking attributes, and links are not given rel values you did not ask for. The only classes added are language-js style hints on code blocks and task-list-item on checkbox items, which your own stylesheet or a highlighter can pick up.
If you would rather write and watch the formatting as you go, the Markdown Previewer is built for that. A Preview tab exists here too, but it is there to check the result before you take the source away.
How it works
The text goes through two passes, the way CommonMark describes parsing. The first pass finds the block structure: headings, quotes, lists by their indentation, tables and code fences. That is why a reference link can be defined at the bottom of the file and still resolve at the top. The second pass reads the inline content of each block. Code spans are matched before emphasis, so *.md inside backticks keeps its asterisk, and link addresses can contain balanced parentheses, as Wikipedia URLs often do.
Tables follow the GitHub rules and the divider row sets alignment, written as an align attribute on each cell. Task items become disabled checkboxes. Two trailing spaces or a trailing backslash make a <br>, and a YAML front matter block at the very top of the file is dropped, since it is metadata and not content.
Safety is handled twice. Raw HTML in your Markdown is escaped unless you turn on Keep raw HTML, and link and image addresses are checked after entities are decoded, so javascript: is caught as well. Only http, https, mailto and tel links pass, plus relative paths and PNG, JPEG, GIF or WebP data images. Anything else becomes #. The Preview tab also runs through a sanitizer that strips scripts and event attributes.
How to use Markdown to HTML
- Paste Markdown into the left pane, use Open file for a
.mdfile, or press Try an example. - Read the generated source on the right. Switch to the Preview tab to check how it renders.
- Open Options to choose HTML fragment or Full document, add heading ids, or keep raw HTML.
- Press Copy result, or use Download .html to save a file named after the one you opened.
A list, a link with parentheses and an aligned table
## Deploy steps
1. Build it
- Run `npm run build`
2. Ship it
See [the wiki](https://example.com/Deploy_(prod)).
| Env | Port |
|:----|-----:|
| dev | 3000 |<h2>Deploy steps</h2>
<ol>
<li>Build it
<ul>
<li>Run <code>npm run build</code></li>
</ul>
</li>
<li>Ship it<br>
See <a href="https://example.com/Deploy_(prod)">the wiki</a>.</li>
</ol>
<table>
<thead>
<tr><th align="left">Env</th><th align="right">Port</th></tr>
</thead>
<tbody>
<tr><td align="left">dev</td><td align="right">3000</td></tr>
</tbody>
</table>The bullet nests inside item 1 because it is indented to the text of that item. The two spaces after "Ship it" produce the <br>, and the closing parenthesis of the URL stays part of the link.
When it helps
- Pasting a post drafted in Markdown into the source view of a CMS that only accepts HTML.
- Turning a project's
CHANGELOG.mdinto a standalone page with Full document, which takes its title from the first heading. - Building a table of contents, by adding heading ids and linking to
#what-changedstyle anchors.
Tips for a better result
- Indent a nested list to the text of its parent, not just by a tab stop. Under
1.that means three spaces. With two, the inner list becomes a separate list at the top level, and this is what the CommonMark rules specify. - Leave Keep raw HTML off for text you did not write. With it on, the preview stays sanitized, but the source and the download contain exactly what was pasted, including any script tags.
- A code block only gets a class, not colors. Add a highlighter to the page that will show it, or use the Full document styles for a plain readable block.
Good to know
- Footnotes, definition lists, math, emoji shortcodes and bare email addresses are not supported, and they stay in the output as ordinary text. Write
<[email protected]>with angle brackets to link an address. - A link reference definition must fit on one line.
- Remote images named in your Markdown are requested from their host when the Preview tab shows them. Your text stays on your device, but that host sees the request.
Questions people ask
What is the difference between a fragment and a full document?
A fragment is only the content, starting at your first heading or paragraph, for placing inside a page that already has a head and body. A full document adds the doctype, a title from your first heading and, unless you switch it off, a short style block, so the file opens properly by itself.
Why did my HTML tags show up as text?
Raw HTML is escaped by default so that pasted content cannot carry a script into your page. Turn on Keep raw HTML under Options if the Markdown is yours and the tags are intentional, such as a <details> block in a README.
Why did my link turn into a # sign?
The address used a scheme outside the allowed list of http, https, mailto and tel. This blocks "javascript:" and "data:" links, even when they are disguised with entities or odd capitalization. Relative paths such as "../guide.html" are left alone.
Does the output match what GitHub shows?
The structure will usually match, as tables, task lists, strikethrough and bare URLs follow the GitHub rules. GitHub also adds its own styling, heading anchors, footnotes and diagrams, so a page that depends on those will differ.
What to use next
- HTML Minifier: if the HTML is going into a template and you want it on one line
- Markdown Previewer: if you are still writing and want to see the formatting as you type
- Markdown to PDF: if the reader needs a document to keep, not markup
- HTML to Markdown: to go the other way when you inherit HTML you want to maintain as text
Last reviewed . Read our editorial policy.