Markdown to HTML Converter
Convert Markdown to HTML or HTML back to Markdown, with a live rendered preview and notes on where the flavours of Markdown disagree.
Rendered preview
What survives a round trip, and what used to not
Switching direction on this page feeds the current output back in as input, so it is fair to ask whether markdown → HTML → markdown returns what you typed. We put 40 constructs through both directions and re-parsed each result, comparing the two HTML outputs the way a browser would. Five came back structurally different — and all five were the same kind of problem.
The two halves used different dialects. Going forward, marked implements GitHub Flavored Markdown, which has tables, strikethrough and task lists. Coming back, Turndown's built-in rules implement CommonMark, which has none of them — and its fallback for a tag it cannot name is to keep the text and drop the tag. So the forward pass emitted HTML the return pass quietly discarded.
| You typed | Came back as | Now |
|---|---|---|
| a | b | table | Four separate paragraphs — the table gone entirely | A table |
| :- | -: | alignment | Four paragraphs, alignment gone too | Alignment preserved |
~~gone~~ | gone — plain text, no mark of deletion | ~~gone~~ |
- [ ] todo | - todo — the checkbox vanished | - [ ] todo |
<kbd>Ctrl</kbd> | Ctrl — a bare word | <kbd>Ctrl</kbd> |
This page now adds the missing Turndown rules. Re-running the same 40 constructs: structure lost falls from 5 to 0, and nothing that previously survived broke. One thing improved that wasn't the target — the task list used to never settle, so converting it twice gave a different answer than converting it once, and the output depended on how many times you'd pressed the button. All 40 now settle after a single rewrite.
The rewrites that aren't losses
Of the 40, 16 now come back byte-for-byte identical and the other 24 come back changed but meaning exactly the same thing. Markdown offers several spellings of most ideas, and a converter has to pick one. These are worth knowing before you paste a file back into a repository, because the diff will be large and entirely cosmetic:
| You typed | Comes back as | Why it's the same |
|---|---|---|
*italic* | _italic_ | Both are <em> |
* bullet or + bullet | - bullet | All three are <li> |
--- rule | * * * | Both are <hr> |
Heading underlined with === | # Heading | Both are <h1> |
| Four-space indented code | A fenced block | Both are <pre><code> |
[ref][1] plus a definition | [ref](url) inline | Both are the same <a> |
Two rewrites do change your source in ways worth flagging. snake_case_name comes
back as snake\_case\_name — correct, because some parsers would otherwise read
those underscores as emphasis, but noisy in a diff. And a footnote comes back as
text[^1](note), a link rather than a footnote, because marked doesn't
implement footnotes at all. If your file uses them, this isn't the right tool for it.
How to use
- Paste Markdown or HTML into the input.
- Read the converted output and the live preview.
- Check tables and nested lists, where flavours differ most.
- Copy the result.
Frequently asked questions
Why does my Markdown render differently in different places?
Because there is no single Markdown. The original 2004 implementation left many cases undefined, so every tool resolved them differently. CommonMark is the modern attempt at a precise specification, and GitHub Flavored Markdown extends it with tables, strikethrough and task lists — which is why a table works on GitHub and not everywhere.
Is HTML allowed inside Markdown?
In most flavours, yes — raw HTML passes through untouched, which is how people add elements Markdown cannot express. Some renderers strip it for safety when handling untrusted input, so it is not something to rely on for content other people submit.
Why did my line break disappear?
Because a single newline is treated as a space in standard Markdown; paragraphs are separated by blank lines. To force a line break within a paragraph, end the line with two spaces or a backslash. Some flavours treat single newlines as breaks, which is another source of cross-tool difference.
How faithful is converting HTML back to Markdown?
Approximate, and necessarily so. Markdown can express only a subset of HTML, so anything without an equivalent — nested tables, styling, most attributes, arbitrary elements — must either be dropped or left as raw HTML. Round-tripping complex documents loses detail.
Which heading syntax should I use?
Hash marks, for all levels. The underline style only supports two levels and is easy to trigger accidentally — a line of hyphens under text becomes a heading whether you meant it or not, which surprises people writing dashes as a separator.
How do I escape a character Markdown would interpret?
Backslash before it. This matters for asterisks, underscores, backticks, square brackets and hash marks appearing as literal text. Underscores inside words are a particular nuisance in variable names, where an unescaped pair turns the middle into italics.
🔒 This tool runs entirely in your browser. Nothing you enter is uploaded, logged, or stored.