Markdown to HTML / HTML to Markdown
Convert Markdown into HTML markup or extract Markdown from HTML tags.
Client-Side Execution & Privacy Guarantee
This utility executes 100% locally in your web browser. Your inputs, tokens, queries, and data payloads are never transmitted to any external server or backend.
Markdown is the writing format of choice for documentation, READMEs, and many content systems, while HTML remains the rendering target for browsers and email. Converting in either direction lets you author in the lighter syntax and obtain clean markup, or recover a Markdown approximation from existing HTML. Both transformations execute locally.
The converter follows the CommonMark specification for the core constructs and adds the widely used GitHub-flavored extensions for tables, strikethrough, and task lists. The reverse path produces readable Markdown that preserves headings, lists, links, and emphasis while discarding purely presentational attributes.
Markdown constructs to HTML elements
Headings, paragraphs, emphasis, strong text, links, images, inline code, and fenced code blocks map directly to their HTML counterparts. Ordered and unordered lists, including nested lists, become the corresponding ol/ul structures with proper li wrapping.
Tables are emitted as HTML table elements with thead and tbody. Task-list checkboxes become disabled input elements so the visual state is retained without introducing interactive form controls.
HTML to Markdown extraction rules
The reverse converter walks the DOM-like structure of the supplied HTML fragment. Block elements such as headings, paragraphs, and lists are turned into the matching Markdown syntax. Inline formatting is translated to asterisks, underscores, or backticks.
Unknown or purely stylistic tags (span, div with only class attributes, font, etc.) are unwrapped so their text content survives. Attributes other than href, src, alt, and title are dropped because Markdown has no place to store them.
Whitespace, entities, and safety
Significant whitespace inside code spans and blocks is preserved exactly. Elsewhere the converter normalizes runs of spaces and newlines according to Markdown rules so the output stays compact yet readable.
HTML entities are decoded on the way to Markdown and re-encoded when producing HTML, ensuring characters such as & and < round-trip correctly. Script and style tags are stripped entirely for safety.
When to use this tool
- Turning a README excerpt into HTML for a preview pane
- Recovering editable Markdown from a rendered documentation page
- Preparing content for a static-site generator that expects one format or the other
- Cleaning HTML email fragments into Markdown for archival
- Verifying that a Markdown snippet produces the expected tags
How to use the Markdown to HTML / HTML to Markdown
- Paste Markdown or an HTML fragment into the input area.
- Select the conversion direction.
- Click Convert.
- Review the output; malformed Markdown usually still produces partial HTML with a warning.
- Copy the result or download it.
- For HTML input, ensure the fragment is well-formed enough for the parser to build a tree.
- Clear the panes after use if the content is confidential.
Worked examples
Basic Markdown to HTML
# Title A **bold** word and a [link](https://example.com).
<h1>Title</h1> <p>A <strong>bold</strong> word and a <a href="https://example.com">link</a>.</p>
Headings, paragraphs, strong text, and links are mapped directly.
Simple HTML list to Markdown
<ul><li>First</li><li>Second</li></ul>
- First - Second
Unordered list items become Markdown dash lines.
Common mistakes and tips
- Fenced code blocks with a language tag become pre/code elements that retain the language class.
- Nested blockquotes and lists are supported up to reasonable depth.
- Raw HTML embedded inside Markdown is passed through unchanged when converting to HTML.
- The reverse conversion cannot perfectly recover every Markdown feature from arbitrary HTML; complex layouts become simplified.
- After conversion you can paste the HTML into the HTML formatter for indentation.
Frequently asked questions
Does it support GitHub-flavored Markdown tables?
Yes. Pipe tables are converted to HTML tables and back.
Are images handled?
Yes. Markdown image syntax becomes img tags; img tags with src and alt become Markdown images.
What happens to HTML comments?
They are stripped in both directions.
Can I convert a full HTML document including head?
Only the body content is processed. The head, scripts, and styles are ignored.
Is the generated HTML sanitized?
Script tags and event-handler attributes are removed. The output is suitable for most documentation uses but should still be reviewed before insertion into a live page.