How the conversion works
The Preview tab shows the Markdown as it will look, so this page also works as a Markdown previewer (it replaces the former Markdown Previewer page). To see raw HTML in your text as plain text instead of running it, set the Raw HTML option to Show as text.
Markdown is read by a CommonMark-style parser: lines are grouped into block quotes, lists, code blocks, tables and paragraphs, link reference definitions are resolved, and the text inside each block is parsed for emphasis, links, images and code. The resulting tree is written out as HTML. In the other direction the HTML is read by a tolerant parser that understands void elements, optional end tags, comments and entities, and the tree is written out as Markdown with the escaping that keeps the result from being misread. Tables, task lists, strikethrough and bare web addresses follow GitHub Flavored Markdown.
What cannot be converted exactly
Markdown has no syntax for many HTML features. The converter never drops them without saying so: the Warnings tab lists each case. By default, elements with no Markdown form (such as details, kbd, sub, sup, or an image with a width) are kept as HTML, and content inside a kept wrapper is still converted. Tables with merged cells or lists inside cells stay HTML tables. Attributes such as class and id cannot be written in Markdown and are dropped, with a count. Scripts, styles, frames, forms and event handlers are removed and reported.
Limits
- This is not a byte-for-byte match of any one reference implementation. It follows CommonMark and GitHub Flavored Markdown, and unusual edge cases can differ from GitHub, a static-site generator or your own Markdown library.
- Markdown inside an HTML block is converted only when it follows a blank line, as CommonMark specifies. HTML to Markdown to HTML is lossless for ordinary documents, but formatting such as colours, inline styles and page layout cannot survive in Markdown.
- Named character references: the common HTML 4 and many HTML 5 names are recognised, plus every numeric reference. A name that is not recognised is left as written and reported.
- The sanitizer uses an allow-list. It removes scripts, event handlers,
javascript:and similar addresses, frames and forms from the generated HTML. It is a convenience, not a security guarantee: sanitize again on your server before publishing untrusted content. - The preview runs in a sandboxed frame without scripts, shows links without opening them and does not load remote images, because the preview never loads remote content. Images embedded as data: addresses are shown.
- Inputs up to 8 MiB are accepted. Large inputs are converted in a background worker, and the preview is skipped for very large documents.
Example
This Markdown:
# Title
| a | b |
|---|---|
| 1 | 2 |
~~old~~ **new** <script>alert(1)</script> [bad](javascript:alert(1)) [ok](https://example.com)
- [x] done
- [ ] todois converted to the HTML below with the default settings. The table, the strikethrough, bold text and the task list are converted, the <script> element is removed completely, and the link that starts with javascript: keeps its text but loses its address:
<h1>Title</h1>
<table>
<thead>
<tr>
<th>a</th>
<th>b</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>2</td>
</tr>
</tbody>
</table>
<p><del>old</del> <strong>new</strong> <a href="">bad</a> <a href="https://example.com">ok</a></p>
<ul>
<li><input type="checkbox" disabled="" checked=""> done</li>
<li><input type="checkbox" disabled=""> todo</li>
</ul>The sanitizing is on by default. Switch the raw-HTML option to “Show as text” if you want to see the tags in your Markdown instead of running or removing them.
Frequently asked questions
Is the generated HTML safe to publish?
Removing scripts and dangerous addresses is a strong default, but you remain responsible for what you publish. Review the output, and keep the sanitizer on for text that comes from other people.
Which Markdown does it understand?
A CommonMark-style parser with GitHub-style extensions: tables, strikethrough and task lists, as in the example.
How do I tidy the HTML afterwards?
Paste it into the HTML Formatter.
Is my text uploaded?
No. The conversion and the preview run in your browser.
Privacy
The text is converted in your browser. It is not uploaded, logged or stored, and the tool makes no network requests with it. When you send output to another tool, it is passed through your browser’s session storage and cleared after it is received.