HTML to Markdown Converter

Turn HTML into Markdown: headings, emphasis, links, images, lists, block quotes, fenced code blocks and, with GFM enabled, tables, strikethrough and task lists.

Load an example:
Up to 200,000 charactersCtrl + Enter to run
No result yet.

How the conversion works

The HTML is parsed into hast with rehype-parse, transformed into an mdast (Markdown) tree by rehype-remark, and written out by remark-stringify. With GFM enabled, remark-gfm adds tables, strikethrough and task-list syntax. Fenced code blocks keep their language when the HTML has a language-* class.

Limitations

  • Markdown cannot express everything HTML can. Classes, ids, inline styles, colspans, <div> layout and form controls (other than task checkboxes) are dropped.
  • Scripts, styles and other non-content elements are ignored.
  • Tables with merged cells or block content inside cells are simplified.
  • Whitespace is collapsed the way a browser would render it.

For the reverse direction, see the rehype vs remark tutorial, which builds a Markdown-to-HTML pipeline.

Packages used

rehype-parse, rehype-remark, remark-gfm, remark-stringify, bundled locally from npm and run in a Web Worker. Your input stays on your device.

Other tools: HTML Formatter · HTML Minifier · HTML Sanitizer · HTML Playground · Plugin Explorer

Use ↑ ↓ to move, Enter to open.