Markdown to HTML Converter

Convert Markdown to HTML with a live, sanitized preview, or turn HTML back into clean Markdown. GitHub-flavoured tables, task lists and strikethrough are supported.

Preview (sanitized)
Linecolumn

Convert Markdown to HTML and HTML to Markdown

Markdown is how READMEs, docs, notes and many CMS fields are written, but browsers, email templates and rich-text editors need HTML. This Markdown to HTML converter renders your text as you type and shows a live preview next to the generated code, with GitHub-flavoured tables, task lists, strikethrough and fenced code blocks.

Going the other way, paste HTML from a web page or editor and get clean Markdown with tables and checkboxes preserved. The preview is sanitized with DOMPurify, so pasted scripts never run, and all conversion uses the open-source marked and Turndown libraries in your browser.

Markdown heading converted to HTML# Title<h1>Markdown toHTML

How to convert Markdown to HTML

  1. Type or paste Markdown on the left, or open a .md file. The HTML and the preview update as you type.
  2. Choose the options: “Line breaks as <br>” turns single line breaks into <br>, as GitHub comments do; “Sanitize HTML output” removes scripts and event handlers from the code too.
  3. Check the preview below the boxes.
  4. Copy the HTML or download it as document.html.
  5. For HTML → Markdown, click the second direction button, paste HTML and pick heading, bullet and code block styles.

Markdown syntax and the HTML it produces

MarkdownHTML
# Heading … ###### Heading<h1> … <h6>
**bold**, *italic*<strong>, <em>
[text](https://example.com)<a href="https://example.com">text</a>
![alt](image.png)<img src="image.png" alt="alt">
- item / 1. item<ul> / <ol> with <li>
> quote<blockquote>
`code`<code>
```js fenced block<pre><code class="language-js">
--- on its own line<hr>
| a | b | table (GFM)<table> with <thead> and <tbody>
- [x] done (GFM)<li><input checked disabled type="checkbox"> done
~~old~~ (GFM)<del>old</del>

GitHub-flavoured Markdown details

  • Tables need a header row and a separator line. Colons set the alignment: :--- left, :---: center, ---: right, written as align attributes on the cells.
  • Task lists become disabled checkboxes, the same way GitHub renders them in READMEs.
  • Bare URLs such as https://example.com are turned into links automatically.
  • Line breaks: in standard Markdown a single line break is just a space, and you need a blank line for a new paragraph or two trailing spaces for <br>. GitHub issues and comments treat every line break as <br>, which the line-break option reproduces.
  • Raw HTML inside Markdown is allowed and passed through, which is why sanitizing matters.

Why the preview is sanitized

Markdown may contain any HTML, including <script> tags, onerror attributes and javascript: links. If you paste Markdown or HTML from an unknown source, rendering it as-is could run that code on the page. The preview is always cleaned with DOMPurify first, which removes scripts, event handlers, dangerous URLs and embedded style sheets while keeping normal formatting. Links in the preview open in a new tab. Keep “Sanitize HTML output” ticked when the HTML will be shown on a website, and only untick it for HTML you wrote yourself.

Converting HTML to Markdown

  • Headings use # (ATX) by default. Setext style underlines h1 and h2 with === and ---; smaller headings still use #.
  • Tables with a header row become GFM tables; tables without <th> cells stay as HTML, because Markdown tables always need a header.
  • Checkboxes inside list items become - [x] and - [ ].
  • Scripts, styles and page metadata are removed. Layout tags such as <div> and <span> are reduced to their text, and inline styles and classes are lost, since Markdown has no syntax for them.

Turning a page into a document instead? URL to PDF saves any web page as a PDF.

Frequently Asked Questions

Common questions about converting Markdown and HTML.

Paste or type Markdown into the left box. The HTML appears on the right and a rendered preview below; copy it or download it as an .html file.

Yes. Click HTML → Markdown and paste the HTML. Headings, lists, links, images, code blocks, tables and checkboxes are converted to Markdown.

Yes. Tables with alignment, task lists, strikethrough and automatic links work as on GitHub.

Yes. The preview is sanitized with DOMPurify, so scripts and event handlers are removed before anything is displayed.

Standard Markdown joins lines within a paragraph. Leave a blank line between paragraphs, end a line with two spaces, or tick “Line breaks as <br>”.

No. The output is an HTML fragment you can paste into a page, template, CMS or email. Wrap it in your own layout if you need a complete document.

Markdown tables require a header row. Tables without <th> cells cannot be expressed in Markdown, so they are kept as HTML, which Markdown allows.

No. The libraries are loaded from a CDN once, and all conversion happens in your browser.