HTML to Markdown Converter

Convert HTML to clean Markdown instantly. Free HTML to Markdown converter with configurable heading styles, link formats, and code block options.

What is an HTML to Markdown converter?

An HTML to Markdown converter takes HTML markup (tags like <h1>, <p>, <a>, <strong>) and translates them into equivalent Markdown syntax. The heading becomes # Heading, the paragraph stays as plain text, the link turns into [text](url), and the bold tag becomes **text**.

The result is clean, readable text that preserves the document's structure without the visual noise of HTML tags. Markdown is used everywhere: GitHub READMEs, documentation sites, static site generators, CMS platforms, and increasingly as the input format for AI and LLM pipelines.

This tool runs the conversion entirely in your browser. Paste your HTML, adjust the output settings if needed, and get Markdown you can copy directly into your project. No data is sent to any server.

How to convert HTML to Markdown with this tool

The conversion takes three steps:

  1. Paste your HTML into the input area on the left. This can be raw markup from view-source, a CMS export, an API response body, or any HTML fragment.
  2. Set your preferences using the four dropdowns below the input: heading style (ATX or Setext), bullet character, code block style (fenced or indented), and link format (inline or reference).
  3. Click Convert and the Markdown output appears on the right with syntax highlighting. Click Copy to put it on your clipboard. Only plain text is copied, no formatting artifacts.

The converter handles full HTML documents and fragments equally well. You can paste an entire page (it will ignore <head> and metadata) or just a section of markup. If you change the conversion options, click Convert again to regenerate with the new settings.

Conversion options explained

This converter exposes four settings that control how the Markdown output is generated:

Option Choices What it controls
Headings ATX, Setext ATX uses # prefixes (# H1, ## H2). Setext underlines H1 with === and H2 with ---. ATX is far more common in modern Markdown.
Bullets -, *, + The character used for unordered list items. All three produce the same output when rendered. Dash is the most common convention.
Code blocks Fenced, Indented Fenced uses triple backticks (```). Indented uses four-space prefixes. Fenced blocks support language annotations for syntax highlighting.
Links Inline, Reference Inline puts the URL right after the text: [text](url). Reference collects URLs at the bottom: [text][1] with [1]: url at the end. Reference style keeps long URLs out of the reading flow.

How HTML elements map to Markdown syntax

Every common HTML element has a Markdown equivalent. Here is how this converter maps them:

HTML Markdown
<h1> to <h6> # to ######
<p> Plain text with blank lines
<strong>, <b> **bold**
<em>, <i> *italic*
<a href="..."> [text](url)
<img src="..." alt="..."> ![alt](src)
<ul> / <ol> - item / 1. item
<blockquote> > quoted text
<code> `inline code`
<pre><code> ``` code block ```
<hr> ---
<br> Two trailing spaces or backslash

Elements without a Markdown equivalent (like <div>, <span>, and <style>) are stripped, and their text content is preserved where possible. Inline styles and class attributes are removed since Markdown has no concept of CSS.

When to convert HTML to Markdown

HTML-to-Markdown conversion comes up in several common developer workflows:

  • Documentation migration. Moving content from a CMS, wiki, or WYSIWYG editor into a static site generator like Hugo, Jekyll, Astro, or Docusaurus. The source is HTML; the target is Markdown files in a Git repo.
  • Web scraping and data extraction. When you scrape a webpage and need the content in a structured, readable format rather than raw HTML. Markdown strips the noise while preserving headings, lists, links, and emphasis.
  • AI and LLM pipelines. Language models work better with clean text than with HTML tags. Converting scraped or fetched HTML to Markdown before feeding it into a RAG pipeline, summarizer, or agent context window removes layout noise and reduces token count.
  • Email and rich text cleanup. Copying content from emails, Google Docs, or Notion often produces HTML with inline styles and proprietary attributes. Converting to Markdown strips the formatting to produce clean, portable text.
  • README and GitHub content. When assembling documentation from multiple HTML sources (API responses, rendered templates, CMS exports) and consolidating it into a single Markdown file for GitHub or GitLab.

Handling edge cases

Not every HTML element has a clean Markdown equivalent. Here is how this converter handles the tricky ones:

Tables. Standard Markdown supports tables with pipe syntax, but the conversion depends on the table structure. Simple tables with <thead> and <tbody> convert cleanly. Complex tables with colspan, rowspan, or nested tables may lose their layout. For complex tables, consider using a dedicated data formatting tool instead.

Nested lists. HTML allows deeply nested <ul> and <ol> elements. The converter preserves nesting by indenting child items, following CommonMark conventions.

Images. The <img> tag converts to ![alt](src). If no alt attribute is present, the alt text is left empty. The title attribute, if present, is included after the URL.

Inline styles and classes. Markdown has no styling layer. All style, class, and id attributes are stripped. If your HTML relies on classes for visual meaning (like colored text or custom badges), that information is lost in the conversion.

Script and style blocks. The content of <script> and <style> elements is removed entirely. These are rendering artifacts, not content, and have no place in a Markdown document.

Markdown vs HTML: when to use which

HTML and Markdown serve different purposes. HTML is a rendering language. It tells a browser exactly how to display content, including layout, styles, and interactivity. Markdown is a writing format. It captures the structure of content (headings, lists, emphasis, links) without prescribing how it looks.

Use HTML when you need precise control over presentation: landing pages, emails with custom layouts, interactive web applications. Use Markdown when you need portable, readable content: documentation, README files, blog posts, technical writing, and data destined for LLM processing.

The conversion from HTML to Markdown is lossy by design. Markdown intentionally lacks support for colors, custom fonts, absolute positioning, and JavaScript. That constraint is the point. It forces content to be clean, focused, and compatible with any rendering context.

Frequently Asked Questions

Is my HTML sent to a server?

No. This HTML to Markdown converter runs entirely in your browser using JavaScript. The HTML you paste is processed locally on your device. Nothing is uploaded or stored.

What Markdown flavor does this produce?

The output follows CommonMark conventions by default. When using ATX headings and fenced code blocks, the result is compatible with GitHub Flavored Markdown (GFM), GitLab Markdown, and most static site generators.

Can I convert a full webpage?

Yes. Paste the entire HTML source and the converter will extract the text content, ignoring <head>, <script>, and <style> elements. For best results, paste only the <body> content or the specific section you need.

What happens to HTML tables?

Simple tables with a header row and body rows convert to Markdown pipe tables. Complex tables with merged cells, nested tables, or missing headers may produce imperfect results since Markdown tables have limited structure.

Does the converter preserve images?

Yes. <img> tags are converted to Markdown image syntax: ![alt text](image-url). The image file itself is not downloaded. Only the reference is preserved.

What is the difference between ATX and Setext headings?

ATX headings use hash marks (# H1, ## H2). Setext headings use underlines: === for H1 and --- for H2. Setext only supports two heading levels, while ATX supports six. ATX is the dominant convention in modern Markdown.

Can I use this for rich text to Markdown conversion?

Yes. If you copy content from a WYSIWYG editor, Google Docs, or Notion and paste it as HTML, this tool will convert it to clean Markdown. The rich formatting (bold, italic, headings, lists, links) is preserved; visual-only styles (fonts, colors, spacing) are stripped.

Related Free Tools

If you work with HTML and structured content, these tools handle adjacent tasks:

  • HTML Formatter & Beautifier -- format and pretty-print HTML before converting it, making it easier to identify the sections you want to extract.
  • JSON Formatter & Validator -- format structured data from APIs. Useful when your HTML-to-Markdown workflow starts with an API that returns HTML inside JSON payloads.
  • Curl Command Generator -- convert curl commands to code for fetching HTML programmatically before converting it to Markdown.
  • Robots.txt Tester & Validator -- check whether a page you want to scrape and convert is allowed by the site's robots.txt before building a pipeline around it.

Give your AI agent a faster, leaner browser

Structured page data instead of raw HTML. Your agent processes less, decides faster, and costs less to run.

Stability detection built in
Fraction of the payload size
Diffs after every action
No credit card required. 1 hour of free runtime included.