Skip to content

HTML to Markdown Converter

Convert HTML or pasted web content to clean Markdown, and back. Runs in your browser.

Loading tool…

About this html to markdown converter

This converter turns HTML into clean Markdown, including tables, task lists, strikethrough and fenced code blocks in GitHub Flavored Markdown. It also works the other way, turning Markdown into safe HTML. It is for developers moving docs into a repository, writers moving posts from a CMS to a static site, and anyone pasting web or Google Docs content into a Markdown editor.

You can paste HTML code, or copy part of a web page or a Google Doc and paste it straight in. The page picks up the formatted version from your clipboard rather than the plain text. Both sides have a rendered preview, so you can check that headings, lists and tables came across before you copy the result.

Writing new Markdown from scratch rather than converting it? The Markdown previewer has a toolbar and a live split view.

Features

  • Paste formatted content, not just code

    Copy a section of a web page, a Google Doc or a Word document and paste it into the HTML box. The tool takes the HTML version from the clipboard, so bold, links, lists and tables survive. Turn the option off if you want the plain text instead.

  • Google Docs and Word clean-up

    Google Docs wraps copied content in a bold tag set to normal weight, which naive converters turn into one giant bold block. Word adds o:p tags and bullet glyphs. Both are cleaned up, and inline styles for bold, italic and strikethrough become real Markdown.

  • Tables that do not break

    HTML tables become GFM pipe tables with column alignment carried over from align or text-align. Pipes inside cells are escaped, line breaks inside cells are flattened, and a table without a header row gets its first row promoted, because GFM tables need one.

  • Your Markdown style

    Choose # or underlined headings, - * or + bullets, ** or __ for bold, _ or * for italics, fenced or indented code, inline or reference links, and how line breaks are written. Lists come out as - item rather than the wide - item spacing many converters produce.

  • Markdown to HTML as well

    Switch direction to turn Markdown into HTML with GFM tables and task lists. The output is cleaned with DOMPurify, so scripts and inline event handlers never make it into your page. To try the result with your own CSS, paste it into the HTML playground.

How to use the html to markdown converter

  1. 1Paste HTML code, or copy part of a web page or Google Doc and paste it in.
  2. 2Pick your Markdown style: headings, bullets, bold, code blocks and links.
  3. 3Check the rendered preview, then copy the Markdown or download a .md file.

When to use it

  • Moving a blog to a static site

    Paste the HTML body of each post from WordPress or another CMS, set the base URL to your old domain so image links keep working, and download a .md file for Hugo, Jekyll, Astro or Eleventy.

  • Google Docs drafts into GitHub

    Write a README or design doc in Google Docs with your team, then copy it and paste it here. Headings, links, checklists and tables come out as Markdown that GitHub renders properly. Tidy any messy tables in the Markdown table generator.

How does HTML to Markdown conversion work?

The HTML is parsed by your browser's DOMParser into an inert document, where no scripts run and no images load. Then each element is mapped to its Markdown equivalent: h1 to h6 become # headings, strong and b become **bold**, em and i become _italic_, a becomes [text](url), ul and ol become lists, blockquote becomes > and pre with code becomes a fenced block. A language-xxx class on the code element is kept as the fence's language label.

The conversion uses turndown, an open-source library (MIT licence), with its GitHub Flavored Markdown plugin plus our own rules for tables and strikethrough. Elements that Markdown cannot express, such as a div with a class, are reduced to their content. Script, style, form and meta tags are removed entirely.

What does not survive the trip to Markdown?

Markdown is deliberately simpler than HTML, so some things have no Markdown form. Colours, fonts, classes and inline styles are dropped. Merged table cells (colspan and rowspan) cannot be shown in a pipe table, and the tool warns you when a table has them. Underline has no Markdown syntax at all.

If you need some of these, turn on Keep video, iframe, sup, sub and kbd as HTML. Many Markdown renderers pass simple HTML tags through, so a superscript or a keyboard key keeps working. Some, GitHub among them, strip iframes and scripts for security, so test embeds on the site where they will live.

CommonMark, GFM and which flavour to use

CommonMark is the strict, fully specified core of Markdown. GitHub Flavored Markdown (GFM) is a superset that adds tables, ~~strikethrough~~, task lists with [ ] and [x], and automatic links. GitHub, GitLab, Bitbucket, most static site generators and most note apps read GFM, so it is on by default.

Turn GFM off for targets that only understand CommonMark or the original 2004 Markdown. Tables are then kept as HTML, which those renderers usually still display.

Why use Mavros

 MavrosTypical upload sites
Rich paste from Docs, Word and web pagesYes, with clean-upCode only
GFM tablesAlignment, escaped pipes, header fixTables without headers kept as HTML
Style optionsHeadings, bullets, emphasis, code, links, breaksFixed style
PreviewBoth sides, input and resultResult only, or none
PrivacyRuns in your browserHTML or URL sent to a server

Tips

  • If the HTML arrives minified on one long line, format it first so you can find the part you need.
  • Set the base URL before you copy the result if the HTML uses relative links. Otherwise /images/photo.jpg will break in its new home.
  • Choose Keep <br> for line breaks if your Markdown goes into a table cell or a renderer that trims trailing spaces, because two-space breaks are easy to lose.
  • Use the Rendered view on the result side to catch problems before you paste, such as a list that turned into a paragraph.

Questions

How do I convert HTML to Markdown?

Paste the HTML into the left box and the Markdown appears on the right as you type. Pick your preferred heading, list and emphasis style, check the Rendered view, then copy it or download a .md file.

How do I convert a Google Doc to Markdown?

Select the content in Google Docs, copy it, and paste it into the HTML box here. With Paste formatted text on, the formatting arrives as HTML and the Docs clean-up turns it into normal Markdown with headings, lists, links and tables.

Does it convert HTML tables?

Yes, into GitHub Flavored Markdown tables. Column alignment is kept, pipes in cells are escaped and a missing header row is created from the first row. Merged cells cannot be represented, so the tool warns you when it sees them.

Can I convert a web page by URL?

No. Fetching a page would mean sending its address through a server, and this tool never contacts one. Open the page, select the part you want, copy it and paste it here instead. That also works on pages behind a login.

How do I convert Markdown back to HTML?

Switch the direction to Markdown → HTML. GFM tables, task lists and code blocks are supported, and the output is sanitised with DOMPurify so it is safe to paste into a page.

Are images converted?

Yes, as ![alt text](src), with relative paths made absolute if you set a base URL. You can also keep only the alt text or drop images. The preview shows a label instead of each image, because this page does not load files from the web.

Is my HTML uploaded?

No. Parsing and conversion happen in your browser, so private documents and internal pages stay on your device.