Utilia

HTML to Markdown Converter

Convert HTML to Markdown and Markdown to HTML in your browser, with GitHub tables, strikethrough, task lists and a safe preview. Nothing is uploaded.

Conversion

Preview

The preview is sanitized: scripts, forms and event handlers are removed and remote images are never loaded.

How to convert HTML to Markdown

  1. Choose the direction: HTML → Markdown or Markdown → HTML.
  2. Paste your code into the input box, or click Open a file to load an .html, .htm, .md or .txt file from your computer (up to 10 MB).
  3. Adjust the options. For HTML → Markdown you can pick the Headings style, the List marker and the Code blocks style. For Markdown → HTML, Sanitize the HTML (remove scripts and event handlers) is on by default.
  4. Click Convert. The result also updates while you type.
  5. Copy or download the result. Swap direction moves the result back into the input so you can convert it the other way and check the round trip.

The Preview under the result shows how the Markdown renders, so you can check the conversion at a glance.

What the HTML → Markdown conversion does

The converter reads your HTML with the browser’s own parser, in an inert document: scripts do not run and images are not downloaded. It then walks the page structure and writes the Markdown equivalent of each element:

  • <h1> to <h6> become headings. ATX (# Title) writes # to ######; Setext (underlined) underlines level 1 and 2 headings with === or --- (levels 3 to 6 always use #).
  • <strong> and <b> become **bold**, <em> and <i> become _italic_, inline <code> becomes backticks.
  • Links become [text](url "title") and images become ![alt](src).
  • Lists use the chosen marker (-, * or +); ordered lists keep their start number, and nested lists are indented.
  • <pre><code> becomes a code block, either Fenced (```) or Indented (4 spaces).
  • <blockquote>, <hr> and line breaks are converted too.
  • <script>, <style>, <iframe>, <noscript> and similar elements are removed with their content.

Characters that would otherwise be read as Markdown syntax, such as a * or a # at the start of a line, are escaped with a backslash so the text stays literal.

GitHub Flavored Markdown

With GitHub Flavored Markdown (tables, ~~strikethrough~~, task lists) checked:

  • Tables become pipe tables with aligned columns. The header comes from a <thead> row or a row made only of <th> cells; if there is none, an empty header row is added, because GFM requires one. Column alignment is read from align="right" or style="text-align: center". Pipes inside cells are escaped as \|, line breaks become <br>, and a colspan is padded with empty cells. A <caption> is written as a paragraph above the table.
  • <del>, <s> and <strike> become ~~strikethrough~~.
  • Checkboxes at the start of list items become task list items: - [x] done, - [ ] to do.

Markdown has no equivalent for nested tables, merged rows or cell styling. A table that contains another table is kept as raw HTML, which most Markdown renderers accept. Without the GFM option, every table is kept as HTML.

Markdown → HTML

In the other direction, the Markdown is rendered with a CommonMark-compliant parser, with the GFM extensions when the option is on. The output is HTML fragments, ready to paste into a CMS, an email template or a web page. When Sanitize the HTML (remove scripts and event handlers) is checked, raw HTML embedded in the Markdown is cleaned: <script> tags, onclick attributes and javascript: links are removed. Uncheck it only for Markdown you wrote yourself.

Frequently asked questions

Is my HTML sent to a server?

No. Both conversions run entirely in your browser, and the page never uploads what you paste or open. You can safely convert internal documentation or drafts.

Is the preview safe with untrusted HTML?

Yes. The Preview is always passed through DOMPurify: scripts, forms, frames and event handlers are removed, links open in a new tab without access to this page, and remote images are never loaded. Only images embedded as data: URLs are displayed.

Why do some parts of my page disappear?

Markdown only describes content structure. Layout elements, CSS classes, inline styles, forms and embedded widgets have no Markdown form, so only their text is kept. Scripts and styles are removed entirely.

Can I convert a whole web page?

Yes. Paste the full source, including <html> and <head>: only the <body> content is converted. For cleaner Markdown, paste just the article part rather than the navigation and footer.

Which Markdown flavour does the output use?

The output follows CommonMark, the standard supported by GitHub, GitLab, Obsidian, most static site generators and many CMS editors. Tables, strikethrough and task lists follow the GitHub Flavored Markdown specification.