Markdown to HTML Converter
Write or paste Markdown and get clean, sanitised HTML as you type — a fragment for your CMS or a complete page. With a live preview, and nothing uploaded.
Or drop a .md file, or browse
HTML
Markdown in, HTML out
Markdown is the pleasant way to write; HTML is what browsers, email clients and most CMS editors actually take. This converter produces plain, semantic HTML — no wrapper divs, no inline styles, no framework classes — so it drops into any design and inherits its styling.
Why the output is sanitised
Markdown allows raw HTML, so a Markdown file from someone else can hide a <script> or an onerror handler. Pasting that into a CMS is a classic way to inject code into a site. Every conversion here goes through DOMPurify first, so what you copy is safe to publish.
How to convert Markdown to HTML
- Paste your Markdown into the editor, or drop a .md file on it.
- Check the live preview — it is the sanitised HTML, rendered.
- Choose a fragment for a CMS or email, or a complete page to open on its own.
- Copy the HTML, or download it as an .html file.
Doing it in code
For a build step rather than a one-off, the usual choices are the markdown package in Python (markdown.markdown(text, extensions=["tables"])), marked or markdown-it in JavaScript, and pandoc input.md -o output.html on the command line, which adds -s for a standalone page. None of them sanitise by default: if the Markdown can come from someone else, pass the result through a sanitiser (DOMPurify in the browser, nh3 or bleach in Python) before it reaches a page — the same step this converter always applies.
Other formats
Need a document rather than a web page? Markdown to PDF draws Mermaid diagrams and LaTeX math too. Starting from a page you already have? HTML to Markdown goes the other way. New to the syntax? Start with the cheat sheet.
Frequently asked questions
Still stuck? Ask us.
Fragment or complete page — which do I need?
A fragment (the default) is just the converted content: <h1>, <p>, <ul> and so on, ready to paste into a CMS, an email template or an existing page. A complete page wraps it in <!doctype html>, <head> and a little CSS so it opens nicely on its own in a browser; its <title> is taken from the first heading.
Which Markdown syntax is supported?
GitHub-flavored Markdown: headings, emphasis, links, images, lists, task lists, pipe tables with alignment, strikethrough, blockquotes and fenced code blocks, which keep their language as class="language-…" for any syntax highlighter. YAML front matter at the top of the file is left out of the HTML.
Is the output safe to put on my site?
The HTML is sanitised with DOMPurify: <script> tags, inline event handlers such as onclick and javascript: links are removed, even if they were written into the Markdown as raw HTML. Harmless raw HTML such as <details> or <kbd> is kept.
What about Mermaid diagrams and math?
They are exported as their source — a ```mermaid code block and $…$ expressions — which is what GitHub, GitLab and most documentation generators expect and render themselves. For a document with the diagrams and equations drawn, use Markdown to PDF.
How do I convert a Markdown file to HTML?
Drop the .md file on the converter (or paste its contents), choose a fragment or a complete page, then copy the HTML or download it as an .html file. The preview shows how it renders before you save it.
How do I convert Markdown to HTML in Python?
Install the markdown package (pip install markdown) and call markdown.markdown(text), adding extensions=["tables", "fenced_code"] for tables and fenced code blocks. The output is not sanitised: run it through a sanitiser such as nh3 or bleach before publishing Markdown you did not write.
Is my Markdown uploaded?
No. The conversion runs in your browser as you type. Nothing is sent to a server or stored.
Limitations
- Mermaid diagrams and math are exported as source, not drawn.
- Footnotes, definition lists and other extensions beyond GitHub-flavored Markdown are not converted.
Related tools
Guides
- Markdown vs HTML: What Each Is For, and When to ConvertMarkdown and HTML describe the same structure for different jobs. What each is for, what Markdown cannot express, and how to convert safely.
- Markdown Cheat Sheet PDF (Free Download)Free Markdown cheat sheet with every syntax element - headings, lists, links, tables, code - plus GFM extras. Download it as a printable PDF in one click.
- What Is Markdown? A Complete Beginner's GuideWhat is Markdown? Learn the history, core syntax with examples, flavors like CommonMark and GFM, the best tools, and why writers and developers rely on it.
- Markdown Frontmatter Explained (YAML Guide)What Markdown frontmatter is, how YAML metadata works, the fields Obsidian, Hugo, and Jekyll expect, common syntax errors, and how to avoid breaking your build.