Skip to content
ToolkitHub

HTML → Markdown Converter

Convert HTML to Markdown

Guide

Converting HTML back to Markdown

By Logappradeep · ServiceNow developer

Converting HTML to Markdown is the reverse of what a static site generator does. Instead of rendering lightweight text into tags, you take existing markup, such as a blog post exported from a CMS, a page copied from an internal wiki, or the body of an HTML email, and turn it into plain text with Markdown syntax that is easy to edit, diff and store in Git.

How elements map to Markdown

Most structural HTML has a direct Markdown equivalent:

  • <h1> through <h6> become one to six # characters.
  • <strong> and <b> become **text**; <em> and <i> become *text*.
  • <a href="/docs">Docs</a> becomes [Docs](/docs).
  • <li> items become lines starting with - for unordered lists or 1. for ordered ones.
  • <p> becomes a paragraph separated by a blank line, and <br> becomes a line break.

So <h2>Setup</h2><p>Run <strong>make</strong>.</p> converts to a ## Setup heading followed by the line Run **make**.

What does not survive

Markdown describes document structure, not presentation, so the conversion is lossy by design. Classes, IDs, inline styles, colors, fonts and layout containers such as <div> and <span> have no Markdown form and are dropped. Complex tables with merged cells, forms, iframes and embedded scripts cannot be expressed either. Most converters, and most Markdown renderers, keep such fragments as raw HTML embedded in the Markdown, which is valid but defeats some of the purpose. Expect to tidy the result by hand when the source is a heavily designed page.

Good reasons to convert

  • Migrating a WordPress or Confluence page into a docs-as-code repository.
  • Turning a rich-text email or newsletter into a plain README or changelog entry.
  • Saving web articles as Markdown notes in tools like Obsidian.
  • Reducing noisy HTML to plain structure before reviewing changes in a diff.

Pitfalls

Check whitespace and escaping. Characters that mean something in Markdown, such as *, _, # at the start of a line, or a number followed by a period, need a backslash if they appear in ordinary text; otherwise a line like "2024. A good year" might turn into a numbered list. Relative links and image paths copied from a website may break once the content lives somewhere else, so search for ](/ and update them. Finally, pick the flavor your destination expects: GitHub Flavored Markdown supports pipe tables and task lists, while some platforms only accept basic CommonMark.

Conversion in this tool runs in your browser, so pages from private intranets are not uploaded anywhere.

Frequently asked questions

Why did my styles and colors disappear?

Markdown has no syntax for classes, inline styles or colors, so presentation is intentionally dropped. Only structure such as headings, emphasis, links and lists carries over.

What happens to HTML tables?

Simple tables can be written as GitHub Flavored Markdown pipe tables, but tables with merged cells or nested content cannot, and are usually left as raw HTML.

Can Markdown contain raw HTML?

Yes. Most Markdown renderers pass inline HTML through unchanged, which is a common fallback for elements Markdown cannot express.

Why does a line in my output show up as a list?

A line that starts with a number and a period, or with a dash or asterisk, is treated as a list item. Escape the character with a backslash to keep it as plain text.