Markdown to HTML Converter
Paste Markdown and get clean HTML as you type — headings, lists, links, code blocks, block quotes, GitHub tables and strikethrough — with a sanitised live preview beside it. Raw HTML is escaped unless you choose to allow a safe subset. Runs in your browser; nothing is uploaded. Free, no sign-up.
Converts as you type, entirely in your browser — nothing is uploaded.
HTML
399 characters of Markdown became 794 characters of HTML.
Preview
Sanitised before display. Links open in a new tab; images load from their own addresses.
Field notes
Results were significant (p < .05). See the CommonMark spec for the full syntax.
- Sample size: 48
- Effect size:
d = 0.62- medium, by Cohen's benchmarks
Raw HTML such as <b>this</b> is escaped unless you allow it.
| Group | Mean | SD |
|---|---|---|
| Control | 4.1 | 0.8 |
| Treatment | 5.3 | 0.9 |
Draft Final version.
How to Use the Markdown to HTML Converter
- 1. Paste or type your Markdown. The HTML updates as you type. The example in the box shows most of the syntax; Clear empties it.
- 2. Decide what happens to raw HTML. By default any tag you typed —
<b>,<div>— is escaped and shows up as text. Choose Allow a safe subset to keep tags such as<sup>,<kbd>or<details>; they pass through an allowlist filter first. - 3. Keep or drop the GitHub extensions. Tables,
~~strikethrough~~and bare links likewww.example.orgcome from GitHub Flavored Markdown, not core CommonMark. Untick the box to convert strictly by the CommonMark rules. - 4. Copy or download the HTML. Copy HTML puts the fragment on your clipboard for a CMS, template or email; Download .html wraps it in a complete UTF-8 page that opens in any browser.
What Each Piece of Markdown Becomes
| Markdown | HTML | Notes |
|---|---|---|
# Title to ###### Title | <h1> to <h6> | The space after the hashes is required: #tag stays ordinary text. |
A line underlined with === or --- | <h1>, <h2> | Setext headings. The underline can be any length. |
*italic*, **bold** | <em>, <strong> | Underscores work too, but not inside a word: snake_case_name stays as typed. |
`code` and fenced blocks | <code>, <pre><code> | A word after the opening fence, such as python, becomes class="language-python". |
- item, 1. item | <ul>, <ol> | Indent a line to the item's text to nest it. A list starting at 3 gets start="3". |
> quoted text | <blockquote> | A line without > still continues a quoted paragraph. |
[text](url "title"),  | <a>, <img> | Reference links, [text][label] with [label]: url anywhere in the document, work too. |
<https://example.org> | <a> | Angle-bracket autolinks. GitHub mode also links bare www. and https:// addresses. |
---, *** or ___ alone on a line | <hr /> | Three or more characters, spaces allowed between them. |
| Two spaces or a backslash at a line's end | <br /> | A plain line break inside a paragraph stays a soft break. |
Pipes over a | --- | row | <table> | GitHub extension. :--, :-: and --: align left, centre and right. |
~~text~~ | <del> | GitHub extension; one tilde on each side works too. |
Raw HTML, Links and the Preview
Markdown lets you mix in HTML, which is also how a pasted document can smuggle in a <script> or an onerror handler. So the converter treats raw HTML as text by default: <b> comes out as <b> and displays literally — the behaviour most comment systems and forums use.
With Allow a safe subset, tags pass through an allowlist instead. Formatting and structure survive — <sup>, <sub>, <kbd>, <mark>, <details>, tables, figures — while scripts, styles, iframes, forms, SVG and MathML are removed together with everything inside them, and so are comments. Event attributes such as onclick, plus style, id and class, are dropped; the one exception is a language-… class on <code>. The HTML you copy is the filtered version, identical to what the preview shows.
Links and images must point to an https:, http: or mailto: address or to a relative path. Anything else — javascript:, data:, vbscript: — loses its address and keeps its text, so a link to javascript:alert(1) becomes the plain word you linked. The check runs after escapes and character references are decoded, the way a browser reads them.
Images in the preview
The preview loads each image from its own address, so previewing a document with remote images contacts those servers. Converting never does — the HTML is built entirely on this page.
A Worked Example
Markdown
## Results Participants (*n* = 48) rated the task **easy**. 1. Pilot study 2. Main study - Online - In person | Condition | Mean | | --- | ---: | | A | 4.2 | | B | 5.1 |
HTML
<h2>Results</h2> <p>Participants (<em>n</em> = 48) rated the task <strong>easy</strong>.</p> <ol> <li>Pilot study</li> <li>Main study <ul> <li>Online</li> <li>In person</li> </ul> </li> </ol> <table> <thead> <tr> <th>Condition</th> <th align="right">Mean</th> </tr> </thead> <tbody> <tr> <td>A</td> <td align="right">4.2</td> </tr> <tr> <td>B</td> <td align="right">5.1</td> </tr> </tbody> </table>
No blank lines separate the list items, so the list is tight: each <li> holds its text directly rather than a <p>, and the nested list sits inside its parent item. The table's second column is right-aligned because its delimiter cell ends with a colon, and that alignment is repeated on every cell in the column.
Frequently Asked Questions
- Which Markdown standard does this converter follow?
- CommonMark 0.31, the specification most modern Markdown parsers implement, plus GitHub Flavored Markdown's tables, strikethrough and bare-URL autolinks. It is tested against examples from both specifications. Footnotes, task-list checkboxes, math and front matter belong to other dialects and come through as ordinary text.
- Why does my HTML show up as text instead of tags?
- Raw HTML is escaped by default, so
<b>becomes<b>and displays as typed. Switch to Allow a safe subset to keep it. Tags outside the allowlist — scripts, styles, iframes, forms — are still removed in that mode. - Is it safe to paste Markdown from someone else?
- Yes, for converting and previewing here. Nothing runs: the preview is rebuilt from an allowlist of tags and attributes, with every value escaped and every address checked, before it is placed on the page. If you publish user-submitted content on your own site, keep a sanitiser there too, and prefer the escaping mode.
- How do I add a line break without starting a new paragraph?
- End the line with two spaces or a single backslash; both become
<br />. A plain line break inside a paragraph stays a newline in the HTML, which browsers display as a space. A blank line starts a new paragraph. - Why did my list items get wrapped in <p> tags?
- A blank line between any two items, or between two blocks inside one item, makes the whole list loose, and CommonMark then wraps each item's text in
<p>. Remove the blank lines for a tight list. The blank lines inside a fenced code block do not count. - Does the converter add classes, IDs or styles?
- No. The output is plain semantic HTML with no classes, inline styles or heading IDs — apart from the
language-…class on fenced code — so it takes on whatever stylesheet the page you paste it into already has. - Can I turn HTML back into Markdown?
- Yes, with the HTML to Markdown Converter. Expect some loss on a round trip: Markdown has no syntax for attributes, merged table cells or most inline styling, so those details cannot come back.