html-to-markdown
GitHub

HTML to Markdown Converter

Paste your HTML code and instantly convert it to clean, readable Markdown syntax. Free, fast, and runs entirely in your browser.

Advertisement Space

What is Markdown?

Markdown is a lightweight markup language created by John Gruber in 2004. It allows you to write formatted text using a simple, plain-text syntax that is easy to read and write. Markdown files use the .md extension and are widely used in documentation, README files, blogs, forums, and messaging platforms. Unlike HTML, Markdown focuses on readability - the source text looks almost like the final formatted output.

Why Convert HTML to Markdown?

There are many situations where you need to convert HTML to Markdown. You might be migrating content from a website to a static site generator like Jekyll, Hugo, or Astro that uses Markdown files. Or you might want to clean up HTML content for use in a GitHub README, a wiki, or a note-taking app like Obsidian or Notion. Converting HTML to Markdown also makes content more portable and easier to version control with Git, since Markdown diffs are much cleaner than HTML diffs.

This tool runs entirely in your browser using the DOMParser API, which means your HTML content is never sent to any server. The conversion happens instantly as you type, with support for debounced live updates. You can also paste rich text directly from web pages, and the tool will capture the underlying HTML for conversion.

Supported HTML Elements

This converter handles over 20 common HTML elements and converts them to their Markdown equivalents. The following table shows the mapping between HTML tags and Markdown syntax:

HTML ElementMarkdown SyntaxDescription
<h1> to <h6># to ######Headings (levels 1-6)
<p>Plain text with blank linesParagraphs
<strong>, <b>**text**Bold text
<em>, <i>*text*Italic text
<a>[text](url)Hyperlinks
<img>![alt](src)Images
<ul>, <ol>- item / 1. itemLists (unordered and ordered)
<blockquote>> textBlockquotes
<code>`code`Inline code
<pre><code>```lang ... ```Fenced code blocks
<table>| col | col |Tables with headers
<hr>---Horizontal rules
<br>Two trailing spacesLine breaks

How to Use This Tool

Using this HTML to Markdown converter is straightforward. Simply paste your HTML code into the left panel, and the converted Markdown will appear instantly in the right panel. You can also paste rich text directly from any web page - the tool will automatically detect and convert the HTML structure. Click the "Copy Markdown" button to copy the result to your clipboard, or use the "Preview" toggle to see how the generated Markdown renders as formatted text. The converter handles nested elements, preserves code block formatting with language detection, and generates proper Markdown tables from HTML tables. All processing happens locally in your browser - your content is never uploaded to any server.