Markdown ↔ HTML Converter
Convert GitHub-flavored Markdown to HTML and back. Live preview, syntax highlighting.
- Free
- No signup
- Files never leave your browser
What the tool does
This is a two-way converter for the two most common text formats on the web:
- Markdown → HTML: parses your Markdown into HTML using the
markedlibrary with GitHub-flavored extensions, runs the result through Shiki to highlight fenced code, and sanitizes the output with DOMPurify before displaying. The HTML you see is the HTML you can paste anywhere. - HTML → Markdown: parses HTML into a DOM and walks it with
turndownplus the GFM plugin. The output is canonical, predictable Markdown.
Both directions update live as you type. There is no “convert” button — debounced rendering keeps the preview in sync.
What works
- CommonMark base: headings, paragraphs, lists, blockquotes, links, images, inline and fenced code, emphasis.
- GFM extras: tables, task lists (
- [ ]/- [x]), strikethrough (~~text~~), autolinks. - Syntax highlighting: fenced code blocks with a language tag get full Shiki rendering. Supported langs:
js,ts,json,bash,shell,python,css,html,md. - Sanitization: any HTML inside the Markdown source is allowed through if it is safe (DOMPurify allowlist).
<script>,onclick,iframe,javascript:URLs, and similar attack vectors are stripped. - Round-tripping: paste Markdown, copy HTML, paste it into the HTML → MD mode, get Markdown back. The output may use slightly different syntax than the original (canonical forms) but the rendered meaning is identical.
What does not survive round-tripping
Markdown is a strict subset of HTML expressiveness. The following data is lost when you convert HTML → Markdown:
- Arbitrary
class,id,style,data-*attributes on elements - Inline CSS
- Custom elements and web components
<iframe>,<script>,<form>and most interactive elements (also blocked by sanitization)- Complex nested layouts that have no Markdown equivalent (e.g.
<div>grids)
If you need attribute preservation, keep the source in HTML. If you need executable markup, this tool is the wrong tool — its only output is safe, static text.
When to use each direction
- MD → HTML: paste a README, blog post, or doc fragment from a Markdown editor and grab clean HTML for an email, CMS, or page that does not render Markdown natively. Useful for previewing how a GitHub issue or pull request will render before posting.
- HTML → MD: clean up HTML pasted from a rich-text editor (Notion, Google Docs, web pages) into something you can store in version control or paste into Slack. Useful for migrating content from a CMS to a static-site Markdown source tree.
Privacy
A static HTML page, a small JavaScript bundle, and four libraries (marked, turndown, dompurify, shiki) loaded from this domain. All conversion runs in your browser tab. Open DevTools → Network and watch — after the libraries load, no further requests fire. Your text never reaches a server.
Reminder: Shiki downloads its WebAssembly grammar files the first time you highlight code. That is the only outbound traffic, and it carries no information about your text.
Related tools
- JSON to CSV Converter — convert between JSON and CSV in your browser.
- JWT Decoder & Verifier — decode and verify JSON Web Tokens.
- Regex Tester — test and explain regular expressions live.
Frequently asked questions
Which Markdown flavor does the tool render?
GitHub-flavored Markdown (GFM). That means tables, task lists, strikethrough, autolinks, and fenced code blocks on top of the CommonMark base. Most modern Markdown content people paste (READMEs, GitHub issues, notion exports, MDX prose) is GFM.
Is the rendered HTML preview safe?
Yes. The preview is sanitized with DOMPurify, which strips <script>, inline event handlers (onclick, onerror, etc.), <iframe>, <object>, <form>, javascript: URLs, and other dangerous constructs. The HTML you copy out is whatever DOMPurify allowed — paste it anywhere with confidence.
How does the HTML → Markdown direction work?
Turndown parses the HTML into a DOM and walks it, emitting equivalent Markdown nodes. The GFM plugin adds support for tables, task lists, strikethrough, and fenced code. Round-tripping is reasonably stable for documents written in the spirit of Markdown; exotic HTML may simplify or get inlined into raw HTML chunks.
What about syntax highlighting in code blocks?
When a fenced code block has a language tag (e.g. ```ts), the preview uses Shiki to render highlighted HTML with the github-dark theme. Languages currently bundled: js, ts, json, bash, shell, python, css, html, md. Unknown languages fall back to plain monospace.
Does my text leave my browser?
No. Marked, Turndown, DOMPurify, and Shiki all run in your browser tab. Open DevTools → Network — after the page loads, no requests fire when you type, switch modes, or copy output. Shiki downloads its WebAssembly grammar files on the first highlight; that is the only outbound traffic, and it never includes your text.
Why does my Markdown round-trip differ slightly from the original?
Markdown has multiple valid spellings for the same HTML. Headings can use # or === underlines; lists can use - or *; emphasis can use * or _. Turndown picks one canonical form. The semantic meaning is preserved; the literal bytes are not always identical.
Why does my HTML lose some attributes after round-trip?
Markdown does not have a syntax for arbitrary HTML attributes. Class names, IDs, styles, and most data-attributes drop because there is no place to put them in the Markdown output. If you need attributes preserved, keep your source in HTML — do not round-trip.
How does the share link work?
Click Copy share link. The current mode and source text are base64-encoded into the URL fragment (the # part). The fragment is never sent to servers — it lives only in your browser. Anyone with the link sees the same source and mode.
Is this tool really free?
Yes. No signup, no token budget, no ads. Convert as much as you like.