Skip to main content

HTML to Markdown

Convert HTML code to clean Markdown format instantly

Convert HTML to Markdown online. Transform HTML tags, links, images, lists, tables, and code blocks into clean Markdown syntax. Supports Vietnamese text and preserves formatting.


How to convert HTML to Markdown?

Converting HTML to Markdown is simple and fast. Follow these steps to transform your HTML code into clean, readable Markdown:

  • Paste your HTML code into the input panel on the left. You can paste raw HTML from any source — a webpage you copied, an email template, a CMS export, or HTML code you wrote yourself. The tool accepts any valid HTML markup including nested elements, attributes, and complex structures.
  • Click the 'Convert' button or press Ctrl+Enter. The converter will process your HTML and generate equivalent Markdown in the output panel on the right. It handles headings (h1-h6), paragraphs, bold, italic, links, images, ordered and unordered lists, blockquotes, code blocks (inline and fenced), horizontal rules, tables, and more.
  • Review the generated Markdown in the output panel. The converter intelligently chooses the most appropriate Markdown syntax — for example, it converts <strong> and <em> to **bold** and *italic*, <a href='...'>text</a> to [text](url), and <img src='...' alt='...'> to ![alt](src). If the result needs adjustment, you can edit the Markdown directly in the output panel.
  • Copy the Markdown using the Copy button, or download it as a .md file using the Download button. You can then paste it into any Markdown editor, documentation platform, GitHub repository, or static site generator. All processing happens locally in your browser — your HTML never leaves your device.

Related Tools

You May Also Need

Why convert HTML to Markdown?

Markdown has become the de facto standard for writing documentation, blog posts, README files, and technical content across the developer community. Unlike HTML, Markdown is lightweight, human-readable, and version-control friendly. Converting HTML to Markdown is useful when migrating content from a WYSIWYG editor or CMS to a Markdown-based platform like GitHub, GitLab, Notion, Obsidian, or a static site generator such as Astro, Hugo, or Jekyll. It's also helpful when you want to strip away presentation markup while preserving the semantic structure of your content. For example, converting an HTML email template to Markdown gives you clean, editable text that's easy to modify without dealing with closing tags and attribute quoting. Additionally, Markdown files are significantly smaller than their HTML equivalents, making them faster to store, transfer, and render. Many modern development workflows prefer Markdown because it separates content from presentation — you write once in Markdown and render it differently depending on the target platform.

What the converter handles well

The converter supports the full range of common HTML elements and transforms them into their Markdown equivalents. Headings from h1 through h6 become # through ######. Bold text wrapped in <strong> or <b> becomes **text**, and italic text in <em> or <i> becomes *text*. Links (<a>) become [text](url) with support for optional titles. Images (<img>) become ![alt](src) with proper alt text preservation. Lists — both ordered (<ol>/<li>) and unordered (<ul>/<li>) — are converted with correct indentation and bullet markers. Blockquotes (<blockquote>) use the > prefix. Code blocks are handled intelligently: inline code (<code>) uses backticks, while pre-formatted blocks (<pre><code>) use triple backtick fences with language detection from class names like 'language-javascript'. Tables (<table>/<thead>/<tbody>/<tr>/<th>/<td>) are converted to pipe-separated Markdown tables. Horizontal rules (<hr>) become --- or ***. Line breaks (<br>) become two trailing spaces. The converter also strips unnecessary whitespace, normalizes nested structures, and removes empty elements that would produce meaningless Markdown.

Frequently Asked Questions (FAQs)

Does this tool work offline?

Yes! All conversion happens entirely in your browser using JavaScript. Once the page loads, you don't need an internet connection to convert HTML to Markdown. Your HTML code is never sent to any server.

Can it handle complex HTML with nested elements?

Yes, the converter handles deeply nested HTML structures correctly. It processes parent-child relationships properly, ensuring that nested lists, headings inside blockquotes, links inside bold text, and other complex combinations are converted accurately.

Will it preserve my custom HTML classes and IDs?

No. Markdown is a simplified markup language that doesn't support custom classes, IDs, or inline styles. These presentation-specific attributes are stripped during conversion because they have no Markdown equivalent. If you need to preserve styling information, consider keeping the original HTML alongside the Markdown output.

Does it support Vietnamese text and special characters?

Yes, the converter fully supports Vietnamese text with all diacritical marks (ă, â, đ, ê, ô, ơ, ư and their tone-marked variants) as well as any Unicode characters. Special characters are preserved exactly as they appear in the HTML input.

What about HTML tables?

Tables are converted to Markdown pipe-table format. The first row becomes the header row, subsequent rows become data rows, and alignment is preserved if the original HTML includes align attributes. Empty cells are represented as empty strings between pipes.

Is there a limit to how much HTML I can convert?

The tool handles large HTML documents efficiently. You can convert entire articles, long documentation pages, or complex templates. Processing speed depends on your browser's JavaScript engine, but typical documents of several thousand lines convert in under a second.

Recently Used Tools