How the converter works
Markdown is converted with marked, a widely used open-source parser that follows the CommonMark spec and supports GitHub-flavoured Markdown (GFM). The HTML it produces is then cleaned with DOMPurify before it is shown or copied. Both libraries are bundled with this page, so the converter works offline once loaded and conversion happens locally. Images in the preview can still make requests to their source servers.
The preview updates as you type. Switch to HTML source to see exactly what you will copy or download. Tick Full HTML document to wrap the output in a complete page with <!doctype html>, a UTF-8 charset, a viewport tag and a <title> taken from your first heading. Leave it off when you are pasting into a CMS, an email template or an existing page.
Markdown to HTML cheat sheet
Here is what common Markdown becomes, produced by the same parser the tool uses:
# Heading → <h1>Heading</h1>**bold** and _italic_ → <p><strong>bold</strong> and <em>italic</em></p>[link](https://example.com) → <p><a href="https://example.com">link</a></p>`inline code` → <p><code>inline code</code></p>~~deleted~~ → <p><del>deleted</del></p> (GFM)- [x] done → <ul><li><input checked="" disabled="" type="checkbox"> done</li></ul> (GFM)
Headings, paragraphs, lists, block quotes, fenced code blocks and images are supported. Strikethrough, tables, task lists and automatic links to bare URLs are GFM extensions.
GFM and line breaks: what the options change
GitHub-flavoured Markdown is on by default because it is what GitHub, GitLab and most documentation tools use. Turn it off to disable GFM extensions: the table | a | b | is then left as a plain paragraph of pipes and dashes instead of becoming a <table>.
Line breaks. In standard Markdown a single new line inside a paragraph is just a space, so “line one⏎line two” becomes <p>line one
line two</p>. To force a line break you end the line with two spaces or a backslash. GitHub comments (but not README files) treat every new line as a break; tick Line breaks to get the same result: <p>line one<br>line two</p>.
Why the HTML is sanitised
Markdown allows raw HTML, so a Markdown file can contain <script> tags, onerror attributes or javascript: links. If you paste output like that into a website, it runs in your visitors' browsers. This is a classic cross-site scripting (XSS) hole, and marked itself does not filter it.
This converter always runs the HTML through DOMPurify. Scripts, event handlers, unsafe links, iframes, styles, forms, SVG and MathML are removed. Normal formatting, links, images and tables are kept. Review links and image sources before publishing, and sanitise untrusted content on the server too.
Tips for clean HTML
Use one H1. Start the document with a single # heading and use ## for sections. The first heading also becomes the page title and the download file name.
Label code blocks. Write ```js rather than just ```. The output gets class="language-js", which syntax highlighters such as Prism and highlight.js pick up.
Add alt text.  becomes an image with a useful alt attribute for screen readers and search engines.
Escape special characters. Put a backslash before characters you want to show literally, for example \*not italic\*. If you need to find and fix a pattern across a long file first, try our regex tester. Converting config files rather than prose? Use the YAML to JSON converter.