Markdown to HTML converter

Convert Markdown to HTML with a live preview, or switch direction to turn HTML back into Markdown. GitHub-style tables, task lists, strikethrough and code blocks are supported, and the preview is cleaned so nothing you paste can run.

Markdown
Waiting for MarkdownThe preview is cleaned: scripts and unsafe links are removed, and outside images aren’t loaded

How to use it

Type or paste Markdown on the left. The right-hand side shows a Preview of how it will look; switch to HTML to see the code and copy it. To go the other way, pick HTML → Markdown and paste HTML: you get clean Markdown, with a preview of how that Markdown renders. Swap takes the output, makes it the input and flips the direction, which is a quick way to tidy up messy HTML.

A worked example

This Markdown:

## Shopping

- [x] **Bread**
- [ ] Milk, see [the list](https://example.com/list)

becomes this HTML:

<h2>Shopping</h2>
<ul>
<li><input checked="" disabled="" type="checkbox"> <strong>Bread</strong></li>
<li><input disabled="" type="checkbox"> Milk, see <a href="https://example.com/list">the list</a></li>
</ul>

Markdown cheat sheet

You typeYou get
# Heading, ## SmallerHeadings, levels 1 to 6
**bold**, *italic*bold, italic
[text](https://…)A link
![alt text](image.png)An image
- item or 1. itemBulleted or numbered list
- [ ] task, - [x] doneTask list (GitHub style)
`code`Inline code
```js … ```Code block, labelled with its language
> quoteBlock quote
---Horizontal rule
~~old~~Strikethrough (GitHub style)
| a | b | then | --- | --- |A table (GitHub style)

In a table, colons in the line under the header set the alignment: :--- left, ---: right and :---: centred.

HTML to Markdown

Pasting HTML is useful for moving content out of a CMS, an email or a web page into a README, a wiki or a static site. The converter uses # headings, - bullets, fenced code blocks (keeping the language from a language- class) and GitHub-style tables. Pipes inside table cells are escaped so they don’t break the table. Tables are written with their first row as the header, because Markdown tables need one.

Characters that mean something in Markdown, like * or _ in ordinary text, are escaped with a backslash so they show up as written.

Why the preview is cleaned

Markdown lets you mix in raw HTML, and HTML can carry scripts. A preview that showed pasted HTML as it is could run that code on this page. So the preview is rebuilt from scratch from an allowlist: headings, paragraphs, lists, tables, links, images, code and a few more. Anything else is dropped or turned into plain text. Links only keep http, https, mailto, tel and relative addresses, and open in a new tab. The site’s security policy also stops images from other websites loading, so you’ll see an outline instead of the picture.

The HTML output is your converted text, shown but never run. If you publish HTML made from Markdown that other people wrote, clean it on your server too.

Common mistakes

  • No blank line before a list or table. Many Markdown renderers need one, or the list is read as part of the paragraph above.
  • Indenting with tabs and spaces mixed. Nested lists need consistent indentation, usually 2 or 4 spaces.
  • Underscores in words. snake_case_name is safe in GitHub style, but some older renderers turn it italic. Put code in backticks.
  • Expecting styling to survive. HTML to Markdown keeps structure, not colours or fonts.

Checking a page’s HTML before it goes live? The meta tag checker previews its search result and share card. Comparing two versions of a document? Try the text diff. For links with odd characters, use URL encode and decode.

Questions people ask

Is the preview safe if I paste HTML from somewhere else?
Yes. The preview never runs what you paste. It’s rebuilt from a short list of allowed tags and attributes: scripts, styles, frames, forms, event handlers like onclick and javascript: links are all removed, and images from other websites aren’t loaded. The HTML output itself is shown as text, exactly as converted.
What is GitHub Flavoured Markdown?
The version of Markdown used on GitHub, and on many other sites. It adds tables, task lists (- [x]), strikethrough (~~text~~) and turns bare web addresses into links. Untick “GitHub style” to get plain CommonMark-style output instead.
Does raw HTML in my Markdown come through?
In the HTML output, yes: Markdown allows HTML inline, and it’s passed through unchanged. In the preview, only the safe parts are shown. If your Markdown is going onto a website, the site should clean it the same way before showing it to visitors.
Why do my line breaks disappear?
In Markdown, a single line break inside a paragraph is treated as a space. Leave a blank line to start a new paragraph, or end a line with two spaces or a backslash for a line break. Tick “Line breaks” to treat every line break as <br>, as GitHub comments do.
Will HTML to Markdown keep everything?
Not everything: Markdown has no way to write colours, fonts, classes or most layout. Headings, paragraphs, bold, italic, links, images, lists, code, quotes and tables convert well. Anything Markdown can’t express is turned into plain text, and scripts and styles are left out.
↑↓ move↵ openesc close