Markdown to HTML Converter with Live Preview

Convert Markdown to HTML instantly: clean, sanitised code with a live preview, as a fragment or a full page. Free, and your text never leaves your browser.

Options
–

Output is always sanitised: scripts, event handlers and javascript: links are removed.

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. ![Sales chart for 2026](chart.png) 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.

Markdown to HTML Converter: frequently asked questions

Is this Markdown to HTML converter free and without sign-up?

Yes. It is completely free, there is no account or sign-up, and there are no limits. The conversion runs in your browser, so your Markdown is not uploaded for conversion. Preview images can request remote URLs.

Does it support GitHub-flavoured Markdown?

Yes. GitHub-flavoured Markdown (GFM) is on by default, so tables, strikethrough, task lists and automatic links work. Untick the GFM option to disable these extensions.

Why are my line breaks ignored?

In standard Markdown a single new line inside a paragraph is treated as a space. End a line with two spaces or a backslash to force a break, leave a blank line to start a new paragraph, or tick the Line breaks option to turn every new line into a br tag.

Is the generated HTML safe to put on my website?

The output is sanitised with DOMPurify, which removes script tags, event handler attributes such as onerror, javascript: links, iframes, style blocks and forms. Review the result and its links before publishing. If your site renders Markdown written by other users, sanitise it on your server as well.

Can I get a complete HTML file instead of a fragment?

Yes. Tick Full HTML document to wrap the output in a complete page with a doctype, UTF-8 charset, viewport tag and a title taken from your first heading. Download .html always saves a complete page you can open directly in a browser.

What is the difference between Markdown and HTML?

Markdown is a lightweight way to write formatted text with plain symbols, such as # for a heading and ** for bold, so it stays easy to read and type. HTML is the markup language browsers display, with tags such as h1 for a heading and strong for bold text. Markdown is converted to HTML before it is shown on a web page, which is exactly what this converter does.

Why was some of my HTML removed?

Anything that could run code or change the page around the content is stripped for safety: scripts, inline event handlers, javascript: URLs, iframes, style tags, inline style attributes, forms and inline SVG or MathML. Normal tags such as headings, lists, links, images, tables and code blocks are kept.