HTML to Markdown Converter – Free Online Tool

Convert HTML to Markdown online with our free browser-based converter. Paste HTML source or supported rich text to transform headings, links, lists, tables, and other common HTML elements into readable Markdown. Preview the result, copy it, or download an .md file without installing software.

HTML Source Input Paste or Type HTML (Tab supported)
Input Chars: 0 Words: 0 Lines: 0
Client-Side In-Browser
Markdown Output GitHub Flavored Markdown
Output Chars: 0 Words: 0 Lines: 0 Change: 0%
Zero Network Latency

How to Convert HTML to Markdown Online

A step-by-step workflow for converting HTML source code, document snippets, or rich text into clean GitHub Flavored Markdown.

Our browser-based HTML to Markdown converter translates raw HTML elements into clean, portable Markdown syntax without transmitting data across external networks. The interactive workspace processes documents locally in real time:

1

Enter or Load Your HTML Content

Paste HTML markup directly into the left editor pane, drag and drop an .html or .txt file onto the workspace card, or click Open (Ctrl+O / Cmd+O) to load a document from disk. You can also click Sample to load an example demonstrating headings, tables, links, and code blocks.

2

Configure Markdown Output Preferences

Adjust syntax options in the compact settings bar to match your project conventions: choose between ATX (# Heading) and Setext (=== / ---) heading styles, select your preferred bullet marker (-, *, or +), pick your code fence character (``` or ~~~), and toggle GFM Tables.

3

Inspect Generated Markdown in Real Time

Conversion executes automatically as you type or paste. The right pane immediately displays the generated Markdown syntax with syntax highlighting. The metrics bar tracks input and output characters, word counts, line totals, and file size reduction percentage.

4

Review the Rendered Live Preview

Switch between the Source tab (displaying raw Markdown code) and the Preview tab (displaying the rendered visual document). The preview validates headings, link destinations, list nesting, code block highlighting, and table alignments before you export.

5

Copy or Download the Markdown File

Click Copy MD to copy the converted Markdown to your system clipboard for instant pasting into documentation, CMS editors, or README files. Click Download .md (or press Ctrl+S / Cmd+S) to save the file locally.

What Is an HTML to Markdown Converter?

Bridging the gap between verbose web presentation markup and lightweight, human-readable documentation syntax.

HyperText Markup Language (HTML) is the foundational presentation language of the World Wide Web. It relies on verbose opening and closing tags, nested container elements, and presentational attributes to instruct browsers how to display content. While HTML is ideal for browsers, it can be cluttered and difficult for human developers to write, edit, and review in plain-text editors.

Markdown, designed in 2004 by John Gruber and Aaron Swartz, offers an intuitive plain-text formatting syntax that conveys document structure through familiar punctuation like hashes, hyphens, asterisks, and backticks. An HTML to Markdown converter parses the Document Object Model (DOM) of an HTML snippet or web document, identifies semantic elements, and translates them into equivalent Markdown tokens while stripping out non-semantic wrapper tags, inline styles, and tracking scripts.

HTML Source Input Converted Markdown Output
<h2>Project Setup</h2>
<p>Install dependencies using <strong>npm</strong>:</p>
<pre><code class="language-bash">npm install</code></pre>
<p>Read the <a href="https://example.com">docs</a>.</p>
## Project Setup

Install dependencies using **npm**:

```bash
npm install
```

Read the [docs](https://example.com).

Software engineers, technical authors, researchers, and content managers rely on HTML to Markdown conversion when migrating legacy CMS articles into Git-backed repositories, converting web articles into knowledge base notes, or decluttering messy rich-text snippets for documentation platforms like Docusaurus, VitePress, Hugo, and Jekyll.

HTML Elements and Their Markdown Equivalents

A comprehensive reference mapping standard HTML tags to GitHub Flavored Markdown syntax.

While Markdown covers the most essential semantic elements required for technical documentation, it deliberately avoids the infinite extensibility of HTML. The table below outlines how common HTML elements translate into Markdown constructs:

HTML Element Markdown Equivalent Output Behavior & Notes
<h1> to <h6> # to ###### (or Setext === / ---) Translates heading levels 1 through 6. ATX style uses hash prefixes; Setext underlines H1 and H2.
<p> Paragraph separated by blank lines Collapses surrounding paragraph tags and separates running text blocks with empty lines.
<strong>, <b> **bold text** Wraps bold phrases in double asterisks or double underscores based on configuration.
<em>, <i> _italic text_ or *italic text* Translates emphasis into single underscores or single asterisks.
<del>, <s>, <strike> ~~strikethrough~~ GFM extension syntax wraps deleted or struck-out text in double tildes.
<a href="url">text</a> [text](url) Converts hyperlinks to anchor syntax. Title attributes (if present) are appended in quotes.
<img src="url" alt="desc"> ![desc](url) Preserves image source URLs and alternative descriptions for screen readers and search engines.
<ul>, <li> - List item (or *, +) Converts unordered list items into bullet points using your selected marker preference.
<ol>, <li> 1. List item Converts ordered list items into sequentially numbered lists, preserving start indexes when present.
<blockquote> > Quote text Prefixes quoted paragraphs with greater-than symbols, supporting nested blockquotes.
<code> (inline) `inline code` Wraps inline code snippets, variable names, and terminal commands in single backticks.
<pre><code> (block) ```lang ... ``` Converts preformatted blocks into fenced code blocks, extracting language classes automatically.
<table> GFM pipe table or safe HTML table Translates regular tables into pipe syntax (| a | b |); preserves HTML for complex merged cells.
<hr> --- Converts horizontal divider lines into standard three-hyphen thematic breaks.

Important Semantic Distinction: Not every HTML tag has an equivalent in Markdown. Presentational tags like <div>, <span>, <section>, and <font>, along with inline CSS styles (style="color: red;"), do not exist in plain Markdown. The converter strips these containers while extracting and preserving their inner textual content to produce clean, distraction-free documents.

Convert HTML Tables to Markdown Tables

Translating tabular rows, headers, and column alignments into GitHub Flavored Markdown pipe tables.

Tables are widely used in technical documentation to display API parameters, configuration options, benchmarks, and comparison matrices. Standard Markdown does not natively include table syntax; however, GitHub Flavored Markdown (GFM) introduced pipe tables, which have since become the universal standard across modern developer platforms.

How HTML Table Rows Become Markdown Rows

During conversion, the parser extracts <tr> row elements and iterates across child <th> and <td> cells. Each cell's text is extracted, trimmed, and bounded by vertical pipe characters (|). Literal pipes within cell text are automatically escaped (\|) so they do not inadvertently split rows into extra columns.

Table Headers and Column Alignment

Under the GFM table specification, the delimiter row requires one or more hyphens per cell (with three hyphens commonly used as a readable formatting convention). When table cells specify text alignment (via align="center" or CSS text-align), the converter injects alignment colons into the delimiter row:

| Parameter | Type | Default | Description | | :--- | :---: | :---: | ---: | | `apiKey` | String | None | API authentication token | | `timeout` | Integer | `3000` | Connection timeout in milliseconds | | `retries` | Integer | `3` | Maximum retry attempts on failure |

Limitations of Complex HTML Tables

Standard Markdown pipe tables cannot represent cells that span multiple rows (rowspan) or columns (colspan). When our converter detects merged cells, it preserves the table as sanitized HTML markup rather than mangling your data into a distorted pipe layout. Modern Markdown processors (including GitHub, GitLab, and static site generators) render raw HTML tables seamlessly.

If you need to visually create, rearrange, or adjust custom Markdown tables from scratch, explore our dedicated companion tool, the Markdown Table Generator.

Convert Rich Text and Web Content to Markdown

Practical methods for migrating content from websites, office suites, and rich-text editors into Markdown.

Content authors frequently need to extract published articles, intranet documentation, or knowledge base guides into Markdown format. Depending on how content is copied from external applications, your system clipboard may contain either rendered rich text or raw HTML markup:

  • Pasting Raw HTML Source: The input workspace is a plain-text code editor designed for raw HTML markup. If you copy HTML source code from a template, inspect an element using browser developer tools, or view a webpage's source, paste that raw HTML directly into the input pane for instant conversion.
  • Working with Content from Rich-Text Applications: When you copy formatted text from applications like Google Docs, Microsoft Word, or an email client, standard text inputs receive unformatted plain text. To convert rich documents or web pages, view or export the document as raw HTML source first, then paste that HTML markup into the editor to convert its headings, lists, links, and tables into Markdown.
  • Full Webpage Source Conversion: If you paste an entire HTML document including <!DOCTYPE html>, <head>, and <body> tags, our converter automatically isolates meaningful body content while discarding head metadata, CSS style blocks, link tags, and scripts.

Privacy & Security Note: To ensure complete privacy and zero network delay, our converter operates 100% locally in your browser. The tool does not perform automated remote webpage scraping or URL fetching over the network. To convert an online webpage, simply open the page in your browser, copy the relevant HTML source or text, and paste it into the editor.

Preserve Links, Images, Lists, and Code Blocks

Ensuring hyperlinks, media assets, hierarchical lists, and code blocks survive the conversion process intact.

Links and Image References

Hyperlinks are translated into standard [Anchor Text](url) format. If an image is wrapped within an anchor link (such as a clickable badge or linked diagram), the converter creates a nested image link: [![Alt Text](image.png)](https://example.com). Relative URLs (such as /docs/guide.html or ../images/logo.svg) are preserved exactly as written in the source HTML. Because conversion runs locally, images are not downloaded to your hard drive; their source paths remain references to the original endpoints.

Nested Lists and Indentation

Hierarchical lists with multiple levels of nesting are translated using standard two-space or four-space indentation rules. Child <ul> or <ol> elements are placed beneath parent list items to ensure compliant CommonMark rendering. When task list checkboxes (<input type="checkbox">) appear within list items, they are converted into standard GFM task syntax: - [ ] for unchecked items and - [x] for completed items.

Inline Code and Preformatted Blocks

Preformatted code blocks enclosed in <pre><code> tags are converted to fenced code blocks. Language hints are extracted from standard CSS class naming conventions on code elements (such as class="language-typescript" or class="lang-python"), placing the language identifier directly on the opening fence. Furthermore, if your code block contains literal backticks (such as Markdown documentation samples), the converter automatically increases the fence delimiter run (e.g., using four backticks ````) so the code block does not break prematurely.

HTML to Markdown vs. Markdown to HTML

Understanding directional workflows, information preservation, and when to use each transformation utility.

Translating between HTML and Markdown represents two complementary directions of the content creation lifecycle. Understanding the operational differences between our HTML to Markdown converter and our Markdown to HTML generator helps you choose the right tool for your project:

Dimension HTML to Markdown Markdown to HTML
Conversion Direction HTML Source → Markdown Document Markdown Document → HTML Output
Primary Input Format Raw HTML markup, snippets, complete web pages, or rich text. Plain-text Markdown syntax (CommonMark or GFM).
Primary Output Format Clean, human-readable Markdown plain text (.md). Semantic HTML fragments or standalone HTML5 documents.
Styling & Presentation Strips inline styles, fonts, and presentation classes to isolate semantics. Translates shorthand into semantic tags; optionally embeds CSS styling.
Typical Use Cases CMS migrations, developer docs, notes cleanup, Git repository ingestion. Web publishing, blog posting, documentation rendering, HTML emails.
Reversibility Not strictly lossless; custom classes, wrappers, and layout divs are removed. Produces valid semantic HTML that can be styled with any CSS stylesheet.

When authoring new articles or documentation, start in Markdown to write quickly, then convert to HTML using our Markdown to HTML converter when publishing to the web. Conversely, when extracting content from existing websites or legacy databases, use this tool to produce clean, maintainable Markdown.

Why Convert HTML Content to Markdown?

Key benefits for engineering teams, technical writers, knowledge managers, and digital publishers.

While HTML is the undisputed language of web browsers, Markdown has become the preferred standard for writing, collaborating on, and versioning written content. Here are the primary reasons organizations convert HTML into Markdown:

  • Modern Static Site Generator Migration: Modern documentation frameworks like Astro, Nextra, Docusaurus, VitePress, Hugo, and Jekyll consume Markdown directly. Converting legacy HTML pages into Markdown is the first step toward modernizing static sites.
  • Git Version Control & Meaningful Diffs: Plain-text Markdown files are easy to review in pull requests. Unlike verbose HTML with nested <div> tags where a small edit produces noisy line changes, Markdown diffs show clear, sentence-level modifications.
  • Knowledge Base & Note-Taking Tools: Popular productivity platforms like Obsidian, Logseq, Notion, and Bear use Markdown as their native storage format. Converting web research into Markdown creates future-proof notes free of web dependencies.
  • Eliminating Presentational Cruft: Copying content from web pages often carries hidden span tags, tracking pixels, font declarations, and messy inline styles. Converting to Markdown strips unwanted formatting, leaving clean semantic content.
  • AI & LLM Training Pipeline Preparation: Large language models and vector embedding pipelines often process Markdown more efficiently than raw HTML. Stripping non-semantic container tags and inline attributes reduces overall text volume and can lower token usage, depending on the structure and content of the source document.

HTML to Markdown Conversion Best Practices

Practical guidelines to ensure clean formatting, high accessibility, and consistent rendering across platforms.

  • Clean Boilerplate Before Conversion: If you are converting a complete web page, remove unrelated navigation bars, headers, footers, and advertising widgets before converting to keep your Markdown output focused purely on article content.
  • Enforce Semantic Heading Hierarchy: Verify that the converted Markdown uses a single H1 (# Title) followed by sequential H2 and H3 subheadings. Avoid skipping heading levels (such as jumping from H2 directly to H4) to maintain screen-reader accessibility.
  • Inspect Nested List Indentation: Check multi-level lists in the preview tab to verify that sub-items are indented by two or four spaces beneath parent items so that Markdown parsers do not flatten list hierarchies.
  • Verify Table Formatting & Pipes: Check converted tables to ensure all columns align correctly. If your table contained merged cells, confirm that the preserved HTML table markup renders properly in your target Markdown viewer.
  • Update Relative Links & Image URLs: If relative paths (like /images/hero.png) break when moving content to another repository or domain, update them to absolute web URLs or local project paths.
  • Label Fenced Code Languages: Ensure opening code block fences include accurate language identifiers (e.g., ```python, ```javascript) so client-side syntax highlighters can format code snippets properly.
  • Beautify Messy Output with Markdown Formatter: If source HTML contained erratic line breaks or uneven spacing, run your converted text through our Markdown Formatter to standardize indentation, clean spacing, and align table pipes.

Common HTML to Markdown Problems and Solutions

Actionable solutions for syntax discrepancies, unparsed tags, and formatting quirks during conversion.

Issue 1 Raw HTML Tags Remaining in Converted Markdown Output

Cause: Custom HTML tags, unsupported elements, or complex tables with colspan / rowspan that cannot be represented in standard Markdown syntax.

Fix: This is intentional behavior: rather than discarding data, the converter preserves safe, sanitized HTML tags for constructs without Markdown equivalents. If you prefer pure Markdown, replace complex elements with standard paragraphs or simple rectangular tables.

Issue 2 Missing Text Formatting (Bold, Italic, Strikethrough)

Cause: Non-semantic CSS styling (such as <span style="font-weight: bold;">) instead of standard semantic tags (<strong> or <b>).

Fix: Replace presentational span tags with semantic tags (<strong> or <em>) in your source HTML, or manually add **bold** and *italic* asterisks after conversion.

Issue 3 Broken Relative Links and Image References

Cause: Relative paths (e.g., ./images/pic.png or /about) failing when Markdown is opened from a different directory or domain.

Fix: Convert relative URLs to absolute web addresses (e.g., https://example.com/images/pic.png) or ensure relative assets are placed in matching folders within your repository.

Issue 4 Images Failing to Display in Rendered Preview

Cause: Image URLs pointing to local disk paths (e.g., C:\Users\...) or non-existent endpoints that browser security sandboxes block.

Fix: Update image paths to valid HTTPS URLs or host images on a public web server or cloud storage bucket.

Issue 5 Tables Failing to Convert into GFM Pipe Format

Cause: Table contains merged cells (colspan or rowspan), or the GFM Tables checkbox option was turned off in the settings bar.

Fix: Check that GFM Tables is enabled in the options bar. If your table contains merged cells, either split the merged cells in the source HTML to form a rectangular grid or leave the preserved HTML table intact.

Issue 6 Nested Lists Losing Indentation Hierarchy

Cause: Malformed source HTML where child <ul> or <ol> elements are placed as siblings to <li> rather than nested inside them.

Fix: Ensure child lists are nested inside parent <li> tags before conversion, or manually indent sub-items by 2 or 4 spaces in the generated Markdown.

Issue 7 Excessive Blank Lines and Cluttered Whitespace

Cause: Multiple consecutive empty <p></p>, <div>, or <br> tags in the source HTML.

Fix: Copy the converted Markdown and pass it through our Markdown Formatter to collapse redundant empty lines into clean single-line paragraph breaks.

Issue 8 Code Blocks Missing Language Highlighting

Cause: Source HTML code snippets contained in bare <pre> tags without class="language-xyz" attributes on the inner <code> element.

Fix: Add the language identifier manually to the opening fence (e.g., change ``` to ```javascript) so your site's syntax highlighter can colorize the code.

Frequently Asked Questions About HTML to Markdown

Comprehensive answers to common questions about HTML conversion, GFM tables, rich text, and privacy.

How do I convert HTML to Markdown online?

Paste your HTML code into the input pane, drag and drop an HTML file, or click Sample. The converter parses your markup and generates clean GitHub Flavored Markdown in real time. Inspect the syntax-highlighted code or preview, then click Copy MD or Download .md.

Is this HTML to Markdown converter free?

Yes. Our HTML to Markdown converter is 100% free with unlimited conversions, no usage limits, no software downloads, and no account registration required.

Can I paste HTML code directly?

Yes. You can paste raw HTML source code directly into the input editor. The workspace supports Tab key indentation, automatic multi-line conversions, and live metric tracking for characters, words, and lines.

Can I convert rich text to Markdown?

To convert formatted web pages or rich-text documents, paste their raw HTML source code into the editor. Pasting formatted text directly into a plain-text editor inserts unformatted text; copying the underlying HTML source allows the tool to transform headings, lists, links, and tables into clean Markdown.

Does it support HTML tables?

Yes. Standard HTML tables are converted into GitHub Flavored Markdown pipe tables with header rows and column alignment. Complex tables with colspan or rowspan are preserved as clean, sanitized HTML so no data is lost.

Are links and images preserved?

Yes. Hyperlinks are converted to standard Markdown [anchor](url) syntax, and images are converted to ![alt text](url) format. Relative paths are preserved as written in the source HTML.

Can I download the result as an .md file?

Yes. Click the Download .md button in the toolbar or press Ctrl+S (Cmd+S on Mac) to save the generated Markdown document directly to your local device.

Does the converter support GitHub Flavored Markdown?

Yes. The converter produces GitHub Flavored Markdown (GFM), including pipe tables, task lists (- [ ] and - [x]), strikethrough (~~text~~), and fenced code blocks with language identifiers.

Can I convert an entire webpage by URL?

No. To protect your privacy and ensure instantaneous local processing, the tool does not fetch remote URLs across the network. To convert a webpage, view its source code in your browser, copy the HTML, and paste it into the editor.

Will CSS styling be preserved?

No. Markdown is a structural markup format designed for content, not visual presentation. Presentational CSS styles, colors, custom fonts, and layout divs are stripped during conversion to yield clean, semantic Markdown.

Is HTML to Markdown conversion reversible?

While core content (headings, lists, links, tables) can be converted between formats, conversion is not strictly lossless. Custom CSS classes, complex div layouts, and advanced HTML features do not have direct Markdown equivalents.

Does the conversion happen locally in my browser?

Yes. All HTML parsing, script neutralization, and Markdown generation run entirely client-side using JavaScript in your web browser. No document text or file data is ever transmitted to external servers.