Markdown to HTML
Convert Markdown to HTML in your browser and copy clean code to paste into a site, or download a complete styled page, while your Markdown never leaves your device.
How to convert Markdown to HTML
Add your Markdown
Paste or type it in the Markdown box, or choose Open .md file.
Check the result
The preview shows the page, and the HTML pane shows the code made from it.
Copy or download
Copy HTML copies the clean code to paste into a site or an editor. Download HTML saves a complete page with its styles inside.
To make a PDF instead, use Markdown to PDF.
Clean HTML code or a styled page
Copy HTML gives you a fragment: the HTML elements of your content (headings, paragraphs, lists, tables, links, images and code blocks) with no page around them, no stylesheet and no scripts. The only styles left are short inline values the Markdown sets, such as a table column's alignment. Paste it into a content management system, a site template, a newsletter editor or anywhere else that adds its own design.
Download HTML gives you a complete page: one .html file with its stylesheet inside and math written as MathML. It opens in a browser on its own and can be sent as a single file.
In both, images from your device are embedded in the HTML as data: URLs, so no image file needs to go with it. Images on other websites are replaced by their alt text, unless you chose Load remote images: then they keep their web addresses.
What is removed from the HTML
Markdown lets you write raw HTML among the text. The CommonMark specification says that text that looks like an HTML tag "will be rendered in HTML without escaping", and that includes scripts. So before the HTML is shown, copied or downloaded, it is cleaned with DOMPurify. Only the elements Markdown makes are kept (headings, paragraphs, lists, links, images, tables, code, math, and a few more such as details, sub, sup and kbd); scripts, style elements, frames, forms, object and embed are removed. So are event handlers such as onclick, and any link that does not go to a web address, an email address or a heading on the page, such as a javascript: link or a link to another file: its text stays, without the link. Code you paste into your site cannot carry a script from a Markdown file someone sent you.
Links to web addresses are given target="_blank" and rel="noopener noreferrer", so they open in a new tab. The YAML front matter that some Markdown files start with, between two --- lines, is left out of the HTML.
Which Markdown it converts
CommonMark, the standard form of Markdown, with the GitHub Flavored Markdown tables, task lists, strikethrough and autolinks, and footnotes. Each heading gets an id made from its text, so you can link to a section, including a heading such as "Title" or "Images". An id written in raw HTML is removed when it is also a name the browser uses for itself, such as title or images.
Code blocks keep their language as a class (language-js, for example), and highlight.js marks each part of the code with a class name, with no inline styles, so your site's own stylesheet can color them; the downloaded page includes the colors. Math between $ signs, $$, \( \) or \[ \] is converted with KaTeX and written as MathML.
Paste into Word or Google Docs
Copy as rich text copies the document as formatted HTML, together with a plain-text copy, for pasting into Word or Google Docs. Microsoft's support page says that by default Word keeps the original formatting when you paste with Ctrl+V. We have not yet tested which formatting Word and Google Docs keep. There is no .docx download in this version.
Convert Markdown to HTML without uploading it
The HTML is made by your browser on your device. Your Markdown never leaves it, and the converter works with no internet connection once the page has loaded. How it works explains how the HTML is cleaned and how to check that nothing is uploaded.
To read a file rather than convert it, use the Markdown viewer. How to open an MD file lists the other ways to open one.
Frequently asked questions
How do I convert Markdown to HTML?
Paste the Markdown on this page or open the .md file, then choose Copy HTML for the code or Download HTML for a complete page. It is free and needs no account.
Does the HTML include CSS?
The copied fragment has no stylesheet, only the short inline values the Markdown sets (such as a table column's alignment), so it takes the styles of the page you paste it into. The downloaded page has its stylesheet inside.
Is the HTML safe to paste into my website?
Scripts, event handlers and javascript: links from the Markdown are removed first. Check the links and images as you would any content you publish.
Can I convert Markdown to Word?
Not to a .docx file. Choose Copy as rich text, which copies the document as formatted HTML, and paste it into Word or Google Docs. Microsoft says Word keeps the formatting of pasted text by default; we have not yet tested which parts each program keeps.
How are code blocks highlighted?
highlight.js marks each part of the code with a class name. The copied fragment has no colors, so add a highlight.js theme or your own CSS to your site. The downloaded page includes the colors.
What happens to math?
Math between $ signs, $$, \( \) or \[ \] is converted with KaTeX and written as MathML, in the copied code, in the copied rich text and in the downloaded page.
Is my Markdown uploaded?
No. The HTML is made in your browser, and your Markdown never leaves your device. The site counts visits with Google Analytics, which never receives your text, your files or their names.