Free online tool

Markdown to HTML Converter

Paste Markdown and this Markdown to HTML converter gives you clean, indented HTML and a safe live preview, with GitHub tables, task lists and code blocks.

GitHub Flavored Markdown

Tables with column alignment, task lists, strikethrough, bare URLs and fenced code with language-* classes convert the way GitHub renders them, and each heading gets a GitHub-style ID for anchor links.

Safe preview, optional sanitizing

The preview runs in a sandboxed frame where scripts cannot run, and it fetches nothing from other sites unless you allow images. Keep raw HTML as written, show it as text and drop javascript: and other unsafe link and image addresses, or sanitize the output to remove scripts, event handlers and unsafe links.

A fragment or a full page

Copy an indented or compact HTML fragment for a CMS or template, or download a complete HTML5 page with a title, charset, viewport and an optional readable stylesheet.

How to convert Markdown to HTML

  1. 1

    Paste or type Markdown in the editor, open a .md, .markdown or .txt file, or drop the file onto the editor.

  2. 2

    Choose an HTML fragment or a complete HTML document, the indentation, and whether raw HTML is kept, escaped or sanitized.

  3. 3

    Check the result in the sandboxed preview and the HTML source beside it; both update as you type.

  4. 4

    Copy the HTML, or download it as an .html file.

What people use this tool for

  • Turn a README or documentation page into HTML for a website, wiki or help center.
  • Write a blog post in Markdown and paste the HTML into a CMS or a static site template.
  • Build a table of contents with anchor links from GitHub-style heading IDs.
  • Check Markdown written by someone else: preview it in a sandbox and sanitize the HTML before publishing it.

Frequently Asked Questions

How do I convert Markdown to HTML?

Paste or type Markdown in the editor, open a .md, .markdown or .txt file, or drop one on the editor. The HTML and the preview update as you type. Choose HTML fragment to paste into a page or CMS, or Complete HTML document for a file that opens on its own, then press Copy HTML or Download .html. Options add heading IDs, turn single line breaks into <br> tags or make external links open in a new tab.

Does this Markdown to HTML converter support GitHub Flavored Markdown?

Yes: tables with left, center and right alignment, task lists (- [x] becomes a disabled checkbox), ~~strikethrough~~, bare www. and https:// links and e-mail addresses, and fenced code blocks. The first word of a code fence becomes a class such as language-python, which highlighters like Prism and highlight.js read. Footnotes and emoji shortcodes such as :smile: are not converted.

How are heading IDs created?

The way GitHub creates them: each character of the heading text is lower-cased, everything except letters, digits, accents, underscores, hyphens, spaces and zero-width joiners is removed, and each space becomes a hyphen, so ## Getting Started gets id="getting-started" and a link such as [Install](#install) jumps to its heading. A repeated heading gets -1, -2 and so on, and no ID is used twice. Headings written in raw HTML are numbered too, and one without an id of its own gets the ID GitHub would give it; a heading with nothing left, such as one made only of emoji, gets no ID. Turn off Add heading IDs to leave them out.

What happens to HTML inside my Markdown?

By default it is kept exactly as written, as CommonMark specifies, so tags such as <kbd>, <details> or <img width="200"> reach the output. Choose Escape it to show raw HTML as text instead. Escape also removes the address from any Markdown link or image that could run code, such as [x](javascript:alert(1)), even when the scheme is disguised with character references or tabs; the link text stays, and the line under the HTML counts what was removed. Links keep relative, http, https, mailto and tel addresses, and images keep relative, http and https addresses and data: PNG, GIF, JPEG, WebP and AVIF pictures. Any other address goes too, even one that cannot run code, such as an ftp:// link or an app's own scheme; the check is also stricter than a browser's, so a few harmless relative addresses with an encoded space or control character lose theirs. With Keep, a <script> or a javascript: link in your Markdown is copied into the HTML you download. Either way the preview is a sandboxed frame with scripts disabled, so nothing in the document can run on this page.

What does Sanitize remove?

It parses the HTML and keeps only a list of formatting elements and attributes. Scripts, styles, iframes, embedded objects and SVG are removed with their contents; other tags such as <form> or <font> go but their text stays. Event handlers such as onclick and style attributes are removed, links and images lose any address that uses javascript:, data: or a scheme other than http and https (plus mailto and tel for links), and the result is parsed again until it no longer changes.

Can I get a complete HTML page with CSS?

Yes. Complete HTML document adds <!DOCTYPE html>, a lang attribute, <meta charset="utf-8">, a viewport tag and a <title> taken from the Page title field, else the first # heading, else the name of the file you opened, plus an optional short stylesheet that reads well in light and dark mode. Indent the HTML with 2 spaces, 4 spaces or tabs, or choose Compact for no line breaks between tags.

Why does one line break in Markdown not become a <br>?

In Markdown a single line break inside a paragraph is treated as a space, so the lines join when the HTML is displayed. Turn on Line breaks become <br> to keep every line break, as GitHub comments do. Ending a line with two spaces or a backslash always makes a <br>, and a blank line starts a new paragraph.

Is there a size limit, and is my Markdown uploaded?

Documents up to 2 MiB (2,097,152 bytes of UTF-8 text) convert. Conversion runs in a background worker, so the page keeps responding while you type, and a conversion that takes longer than 10 seconds is stopped with a message. Nothing is uploaded, and the preview does not fetch images, stylesheets or fonts from other sites unless you turn on Load remote images in the preview, which loads images only; the preview also leaves out <link>, <meta> and frame elements. The draft stays in this tab's session storage until you close it, and only your options are saved, in local storage under zutilium:markdown-to-html.