How to convert HTML to Markdown

Moving content to a docs site, wiki or CMS usually means turning HTML into Markdown. Conversion keeps the words, links and structure — and drops the classes, styles and tracking the new home does not want.

Why move content to Markdown

A move to docs, a wiki or a static site

The usual reason is a move: content written for a website has to live in a documentation system, a wiki, a static site generator or a CMS that speaks Markdown. Copying the rendered text loses the links and the structure; copying the HTML keeps the structure but in the wrong format. Converting gives you the content in the format the new home expects, with links and headings intact.

Plain text diffs cleanly and edits anywhere

Markdown is also a better source format for content that changes. It is plain text, so it works in version control, diffs cleanly, and can be edited in any text editor. HTML produced by a visual editor is none of those things. Converting is often the first step in taking content back under control.

What survives the conversion

Headings, links, lists and code carry over

Headings become # markers, paragraphs stay paragraphs, bold and italic become ** and *, links become [text](url), images become ![alt](src), and lists become - or numbered items. Code becomes backticks, a pre block becomes a fenced code block, and a blockquote gains its > markers. The result is Markdown you can paste straight into a docs site or a CMS.

Scripts and styles are dropped on purpose

Two things are dropped on purpose. Scripts and styles are removed entirely — Markdown has no place for them, and carrying them over would be a security risk in most destinations. Tables, div wrappers and span elements are not dropped, but their structure is: their text passes through as plain paragraphs, so a table becomes its cell text in reading order.

The cleanup pass

Three checks are worth doing on every conversion. First, links: relative links like /about stay relative, so if the new home lives on a different domain, make them absolute or re-point them. Second, images: the converter keeps the src and the alt text, but a relative image path needs the same treatment as a relative link. Third, tables: they arrive as plain text, so find them in the output and rebuild them as Markdown tables before publishing.

Nested lists survive with two-space indentation, which most Markdown renderers understand. Deeply nested structures and multi-paragraph list items are the edge cases — read them once in the output and tidy the indentation if your renderer complains.

Convert HTML to Markdown in the browser

  1. Open the HTML to Markdown Converter and paste your HTML into the Input box.
  2. Click Convert to Markdown. Headings, paragraphs, links, images, lists, code and quotes are converted; scripts and styles are dropped.
  3. Read through the output and find the tables — they arrive as plain text and need rebuilding by hand.
  4. Check relative links and image paths, and re-point them if the content is moving to a different domain.
  5. Click Copy output or Download to save the Markdown, then paste it into your docs, wiki or CMS.

Migrating a whole site

One page by hand is a browser tool's job. A whole site is a script's job: fetch each page, convert it, and write the Markdown files out, keeping the URL structure as file paths. Libraries like Turndown do the conversion in Node, and Pandoc does it from the command line. The loop is the same either way — convert, tidy, publish — but automation keeps the tidying list in one place instead of spread across a hundred browser tabs.

Budget most of the time for tidying, not converting. The conversion is the fast part; fixing relative links, rebuilding tables and checking images is where a migration actually takes its time. A site with a thousand pages needs a checklist, not just a converter.

Markdown as a clean source format

HTML copied from a web page carries classes, inline styles and tracking attributes that you do not want. Converting to Markdown strips all of that away and leaves the words, the links and the structure — a clean source you can edit, version-control and publish anywhere.

That cleanliness is the real reason teams move to Markdown. The content becomes portable: the same source can feed a docs site, a PDF, an email and an app, because none of those destinations is baked into it. HTML is a destination; Markdown is a source. Converting moves content from the former to the latter.

Related guides

Questions people ask

Are links and images kept?

Yes, with their destinations. A link becomes Markdown link syntax with the same address, and an image keeps its alt text and source. Relative paths stay relative, so re-point them if the content moves domains.

What happens to tables?

They become plain text. The table structure is lost and the cell text appears in reading order. Rebuild important tables as Markdown tables by hand after converting.

Can I convert a whole website at once?

Not in a browser tool. For a whole site, use a script with a library like Turndown or a command-line tool like Pandoc, which can convert page after page automatically.