Markdown to HTML Converter

Write or paste Markdown and get clean HTML with a live preview, or turn existing HTML back into tidy Markdown, all in your browser.

Runs entirely in your browser. Nothing you add is sent to us.

Create a free account to use the Markdown to HTML Converter

Free forever for this tool. Takes a few seconds — then you come straight back here.

  • All 150 free tools, one login
  • Free website audit with fixes
  • Search Console dashboard
  • Free keyword rank tracker

Already have an account? Sign in

Markdown to HTML Converter — markdown to html

Markdown is the quickest way to write structured text: a hash for a heading, asterisks for emphasis, a dash for a list. Sooner or later, though, you need the HTML, whether for a blog post, an email template, a CMS that does not accept Markdown or a page you are building by hand. Our free Markdown to HTML converter supports GitHub Flavoured Markdown, including tables, task lists, strikethrough, autolinks and fenced code blocks, and shows a live preview that is sanitised so scripts and unsafe links are removed. You can turn single line breaks into br tags, copy the HTML or download it as a file, and switch to the reverse mode to convert existing HTML back into clean Markdown.

How to use the Markdown to HTML

  1. 1 Choose a directionSelect Markdown to HTML to generate markup, or HTML to Markdown to turn an existing page or snippet back into Markdown you can edit.
  2. 2 Paste or type your contentWrite or paste into the input box. The output and the live preview update as you type, so you can see headings, lists and tables take shape straight away.
  3. 3 Set the line break optionLeave it off to follow standard Markdown, where a single line break joins lines into one paragraph. Turn it on if you want every line break to become a br tag, as in many chat and comment systems.
  4. 4 Check the previewThe preview shows the rendered result after sanitising. If something looks wrong, such as a table that will not form, check the source for a missing separator row or a stray space.
  5. 5 Copy or downloadCopy the HTML to your clipboard to paste into a CMS or template, or download it as an .html file. In reverse mode, copy the Markdown for your README, documentation or notes.

What Markdown is and why people convert it

Markdown is a lightweight plain text format created in 2004 so that people could write for the web without typing HTML tags. A line starting with a hash becomes a heading, text wrapped in asterisks becomes bold or italic, and lines starting with a dash become a bulleted list. The source stays readable even before it is converted, which is why Markdown is used for README files, documentation, wikis, notes apps, static site generators and many content management systems.

Converting Markdown to HTML is useful whenever the destination expects markup. You might draft a blog post in a notes app and need HTML for a CMS that only has a code view, prepare a newsletter section, write product descriptions for an online shop, or build a static page by hand. Going the other way, converting HTML to Markdown helps when you are moving content from an old website into a docs system, a Git repository or a static site generator.

GitHub Flavoured Markdown features supported

The original Markdown description left many details open, so different tools behaved differently. CommonMark later defined a precise specification, and GitHub Flavoured Markdown, often shortened to GFM, builds on CommonMark with several extensions that have become the de facto standard. The converter uses the open-source marked library with GFM switched on, so text written for GitHub, GitLab and many documentation tools converts the way you expect.

  • Tables: rows separated by pipe characters, with a separator row of dashes under the header. Colons in the separator row set left, centre or right alignment.
  • Task lists: list items starting with an empty or ticked pair of square brackets become checkboxes, which is handy for checklists and project notes.
  • Strikethrough: text wrapped in double tildes is shown crossed out using the del element.
  • Autolinks: web addresses starting with www or http become clickable links without the need for the full link syntax.
  • Fenced code blocks: code between lines of three backticks is kept exactly as written, and a language name after the opening backticks is added as a class so a syntax highlighter can colour it.

Sanitised preview: how unsafe HTML is handled

Markdown allows raw HTML to be mixed in with the text, which is powerful but also a risk. If you paste content from an unknown source, it could contain a script tag, an attribute such as onclick or onerror that runs JavaScript, or a link whose address starts with javascript: instead of https. Rendering that directly in a page is a classic route for cross-site scripting.

To prevent this, the preview and the HTML output are passed through DOMPurify, a widely used open-source sanitiser that runs in the browser. It removes script elements, strips event handler attributes, and drops links and images that use the javascript: scheme, while keeping ordinary formatting such as headings, lists, tables, emphasis, links and images. The result is HTML you can preview safely in this page.

Sanitising is a strong first line of defence, but it is not a replacement for the protections in the system where you publish. If you are building a site that accepts Markdown from users, sanitise on the server as well, keep your content security policy tight and keep your libraries up to date. If you only convert your own writing, the sanitised output is simply clean HTML.

Line breaks, paragraphs and spacing

Line breaks cause more confusion than any other part of Markdown. In standard Markdown a single line break inside a paragraph is treated as a space, so text that you typed on several short lines is joined into one paragraph in the HTML. To start a new paragraph you leave a blank line. To force a line break within a paragraph you end the line with two spaces or a backslash, which few people remember.

The line break option changes this behaviour. When it is on, every single line break becomes a br tag, which matches how GitHub comments, many chat apps and some forums behave. It suits addresses, poetry, lyrics and short notes where each line matters. For articles and documentation, leaving it off usually gives cleaner HTML, because paragraphs are marked up properly rather than held together with line break tags.

Lists and code blocks are also sensitive to spacing. A list usually needs a blank line before it when it follows a paragraph, nested list items must be indented to line up under the text of the parent item, and a table needs its separator row immediately after the header. If something does not render as expected, look at the blank lines and indentation first.

Converting HTML back to Markdown

Reverse mode takes HTML and produces Markdown. It converts headings into hash headings, paragraphs into plain text separated by blank lines, bulleted and numbered lists into dashes and numbers, including nested lists, links and images into Markdown link and image syntax, bold and italic into asterisks, strikethrough into double tildes, inline code into backticks and code blocks into fenced blocks. Blockquotes become lines starting with a greater-than sign, horizontal rules become three dashes, and simple tables become GFM pipe tables.

Script and style elements are ignored entirely, so code that powers a page does not end up in your document. Markdown has no equivalent for many HTML features, such as layout containers, classes, inline styles, forms or embedded video, so those are dropped or reduced to their text content. Tables with merged cells or several paragraphs in one cell cannot be represented in GFM tables and may need tidying by hand.

This makes reverse mode ideal for moving articles out of an old CMS, rescuing content from a page you no longer have the source for, or turning a formatted email into notes. Expect to review the result, especially for complex layouts, but most ordinary content converts cleanly in one step.

Using the HTML in a website, CMS or email

The output is a fragment of HTML rather than a complete web page, so it is ready to paste into the body of a post, a template or a component. The download option saves the result as an .html file, which is handy for keeping a copy, sharing it with a developer or using it as a starting point for a page. Styling comes from wherever you paste it: headings, tables and lists will pick up your site's own CSS.

Many content management systems, including WordPress, have a code or HTML editor view where you can paste the result. Email builders vary widely in what they accept, and many email clients ignore or strip certain elements and styles, so always send a test to yourself before a campaign. Everything is converted inside your browser, so drafts and unpublished content are never sent to a server.

Examples you can copy

Markdown and the HTML it produces

Markdown:
## Opening hours

We are open **Monday to Friday**.

- [x] Book a table
- [ ] Order online

HTML:
<h2>Opening hours</h2>
<p>We are open <strong>Monday to Friday</strong>.</p>
<ul>
<li><input checked="" disabled="" type="checkbox"> Book a table</li>
<li><input disabled="" type="checkbox"> Order online</li>
</ul>

A GFM table with alignment

| Service        | Price  |
| :------------- | -----: |
| Boiler service |   £85  |
| Gas safety     |   £70  |

Unsafe input and the sanitised result

Input:
<a href="javascript:alert(1)">Click</a>
<img src="x.png" onerror="alert(1)">
<script>alert(1)</script>

Sanitised output:
<a>Click</a>
<img src="x.png">

Common mistakes to avoid

Expecting single line breaks to show

Standard Markdown joins lines within a paragraph. Leave a blank line between paragraphs, or turn on the line break option.

Forgetting the table separator row

A GFM table needs a row of dashes directly under the header row. Without it, the pipes are shown as plain text.

Indenting nested lists inconsistently

Nested items must line up under the text of the parent item. Mixed indentation often turns a nested list into a flat one or a code block.

Pasting unsanitised HTML from elsewhere

HTML copied from unknown sources can carry scripts or tracking code. Use the sanitised output, and sanitise again on your server if users can submit content.

Expecting perfect round trips

HTML features with no Markdown equivalent, such as classes, layout and merged table cells, are lost in reverse mode. Review the Markdown before relying on it.

Frequently asked questions

The output is cleaned with DOMPurify, which removes scripts, event handler attributes such as onclick and javascript: links. Still review HTML from sources you do not trust before publishing it.

Yes. With GitHub Flavoured Markdown switched on, pipe tables, column alignment, task lists, strikethrough and bare web addresses are all converted.

Markdown is a simple plain text format designed to be easy to write and read. HTML is the markup language browsers display. Markdown is converted into HTML before it appears on a web page.

When it is on, each single line break becomes a br tag, as in GitHub comments. When it is off, lines within a paragraph are joined and only blank lines start new paragraphs.

Yes. Use HTML to Markdown mode and paste the HTML. Headings, lists, links, images, emphasis, code, quotes and simple tables are converted, while scripts and styles are ignored.

Fenced code blocks keep their language name as a class on the code element, which highlighters such as Prism or highlight.js use to colour the code on your site.

Yes. The output contains plain elements without inline styles, so headings, paragraphs, lists and tables pick up the CSS of the page where you paste them.

No. Both conversion directions and the sanitised preview run entirely in your browser, so drafts and unpublished content stay on your device.

Free website audit

See how your site scores, free

Speed, SEO, DNS, email (SPF/DKIM/DMARC) and security in one scan, with a prioritised fix list.