Markdown to HTML
Markdown · HTML · Live preview
Result
Type Markdown in the first box.

Markdown cheat sheet

Markdown is plain text with a few marks for formatting. This table shows what to type and what you get. The last rows are GitHub Flavored Markdown (GFM), which this page supports by default.

You typeYou getHTML
# Title
## Section
Headings, level 1 to 6 (######)<h1> … <h6>
**bold**bold<strong>
*italic* or _italic_italic<em>
`code`code<code>
[GeekTools](https://geektools.net)GeekTools<a href>
![Logo](logo.png "Title")An image with alt text<img alt src>
- one
- two
Bulleted list (also * or +)<ul><li>
1. one
2. two
Numbered list; it starts at the first number<ol><li>
> quoted textBlock quote<blockquote>
```js
let x = 1;
```
Code block; the word after ``` names the language<pre><code class="language-js">
---Horizontal line<hr>
line one\
line two
Line break inside a paragraph (or two spaces at the end of the line)<br>
\*not italic\*A backslash shows a mark as a normal charactertext
~~old~~old (GFM)<del>
- [ ] to do
- [x] done
Task list with check boxes (GFM)<input type="checkbox">
| A | B |
|---|--:|
| 1 | 2 |
Table; --: aligns right, :-: centers (GFM)<table>
https://example.comA link without brackets (GFM)<a href>

How Markdown becomes HTML

  • Paragraphs are separated by an empty line. Lines directly below each other join into one paragraph, so a single Enter becomes a space. Turn on Enter = line break if you want the GitHub-comment behaviour, where every Enter is a <br>.
  • HTML inside Markdown is copied as it is, so you can use tags Markdown does not have, such as <details>, <kbd> or <sup>. Remove unsafe HTML (on by default) deletes <script>, <iframe>, onclick= style attributes and javascript: links, and the status line lists what it removed. Keep it on for Markdown written by other people, such as comments or user profiles.
  • Heading ids give every heading an id the way GitHub does: ## Getting Started becomes <h2 id="getting-started">, so [see setup](#getting-started) jumps to it. A second heading with the same text gets -1.
  • Copy HTML gives the part that goes inside <body>, ready for a blog, CMS or e-mail template. Download .html saves a complete page with a simple readable style, and its title is your first heading. Copy formatted copies the preview itself, so you can paste it into Gmail, Outlook, Google Docs or Word with bold, links and lists kept.
  • Code blocks get a language-… class but no colors. Syntax highlighters such as Prism or highlight.js read that class on your own site.

HTML, Google Docs or Word to Markdown

Choose HTML → Markdown. You can paste HTML code, or simply copy part of a web page, a Google Doc or a Word document and paste it: browsers put the formatted version on the clipboard, and this page reads it. Google Docs marks bold and italic text with styles instead of tags; those are turned into **bold** and *italic* too.

Becomes MarkdownStays out or stays HTML
Headings, paragraphs, bold, italic, strikethrough, links, images, line breaksColors, fonts, font sizes, underline and text alignment (Markdown has no way to write them)
Bulleted, numbered and nested lists, task-list check boxesScripts, styles and comments are removed
Tables with a header row, block quotes, horizontal linesTables without a header row stay as HTML, which Markdown allows
Code blocks, with the language when the HTML has a language-… classMerged table cells (colspan/rowspan) cannot be written as a Markdown table

Images keep their web address. When you paste from Word, images that only exist on your computer cannot come along; upload them somewhere and fix the links afterwards.

Convert Markdown in code and on the command line

ToolMarkdown to HTMLHTML to Markdown
Pandocpandoc -f gfm -t html README.md -o README.htmlpandoc -f html -t gfm page.html -o page.md
Node.jsmarked.parse(md) (marked) or markdownit().render(md)new TurndownService().turndown(html)
Pythonmarkdown.markdown(md, extensions=['tables'])markdownify.markdownify(html) or html2text.html2text(html)
PHP(new League\CommonMark\GithubFlavoredMarkdownConverter())->convert($md)(new League\HTMLToMarkdown\HtmlConverter())->convert($html)
Gogoldmark.Convert(src, &buf)htmltomarkdown.ConvertString(html)
RubyCommonmarker.to_html(md)ReverseMarkdown.convert(html)
GitHub APIgh api markdown -f text="$(cat README.md)" -f mode=gfm(none)

Markdown parsers do not remove dangerous HTML by themselves. If people other than you write the Markdown, clean the result with a sanitizer such as DOMPurify (browser and Node) or bleach / nh3 (Python) before you show it.

Frequently asked questions

How do I convert Markdown to HTML?

Choose "Markdown to HTML" and type or paste your Markdown, or open a .md file. The preview updates as you type. Click "HTML" above the preview to see the code, then copy it or download it. The download is a complete .html page that opens in any browser; the copy is only the part that goes inside <body>.

How do I convert HTML or a Google Doc to Markdown?

Choose "HTML to Markdown". Paste HTML code, or copy text from a web page, Google Docs or Word and paste it into the box: the page reads the formatting from the clipboard, so headings, bold, links, lists and tables come with it. The Markdown appears in the second box. Paste with Ctrl+Shift+V if you only want the plain text.

Why does a single line break not show in the HTML?

In standard Markdown, lines that follow each other belong to the same paragraph, so one Enter becomes a space. Leave an empty line to start a new paragraph, or end a line with two spaces or a backslash (\) for a line break. GitHub comments and many chat apps treat every Enter as a break; turn on "Enter = line break" to get the same result here.

How do I make a table in Markdown?

Write the column names between | characters, then a line of dashes, then one line per row: | Name | Price | then |---|---:| then | Apple | 1.20 |. A colon on the right side of the dashes aligns the column to the right, colons on both sides center it. The Table button in the toolbar inserts an example. Tables are part of GitHub Flavored Markdown, not of the original Markdown.

Can I use HTML inside Markdown, and is it safe?

Yes, Markdown lets you write HTML tags directly, for example <details> or <kbd>. That also means a Markdown file can contain a <script> tag or an onclick attribute. With "Remove unsafe HTML" turned on (the default), this page removes scripts, event handlers and javascript: links with the DOMPurify library and tells you what it removed. The preview never runs scripts in any case.

What is GitHub Flavored Markdown (GFM)?

GFM is the Markdown used by GitHub, GitLab and many other sites. It is the CommonMark standard plus tables, task lists (- [ ] and - [x]), strikethrough (~~text~~) and links that work without brackets. Most README files use it. Turn off "GitHub Flavored" to see how a strict CommonMark parser reads your text.

Is my text uploaded?

No. The conversion runs with JavaScript in your browser, using the open-source marked, turndown (both MIT license) and DOMPurify (Apache 2.0) libraries, and nothing is sent to a server. Only your settings, such as the options you choose, are kept in this browser for your next visit.

More developer and writing tools