How to Convert HTML to Markdown
- Paste an HTML fragment or upload a supported
.htmlfile. - Convert the source and review which semantic elements remain meaningful in Markdown.
- Convert and inspect links, images, nested lists, tables and code fences.
- Copy the Markdown or download the
.mdfile.
What Does the Converter Preserve?
| Source content | Possible conversion result | Conversion note |
|---|---|---|
| Headings | Map <h1>–<h6> to Markdown headings | |
| Paragraphs and emphasis | Convert paragraphs, strong and emphasis | |
| Lists | Convert ordered, unordered and nested lists | |
| Links | Preserve text and resolved URL | |
| Images | Preserve source and alt text | |
| Code | Use inline code and fenced blocks | |
| Tables | Convert compatible tables to GFM | |
| Blockquotes | Convert semantic blockquotes |
What May Change During Conversion?
Scripts, styles and forms
Executable and interactive elements do not have an ordinary Markdown equivalent and may be omitted or reduced to text.
Complex tables
Row spans, column spans, nested tables and rich cell content may need raw HTML or flattening.
Relative URLs
A pasted fragment may not include the page’s base URL, so relative links and image paths cannot always be resolved.
Layout containers
div, grid and flexbox layout do not imply a semantic reading order.
Hidden and boilerplate content
The converter needs a clear policy for hidden elements, navigation and visually collapsed content.
Common Uses for HTML to Markdown
Migrate web documentation
Move semantic HTML into a Markdown-based documentation system.
Clean copied rich text
Convert editor-generated HTML into a simpler format before versioning or publishing.
Prepare code examples
Retain code blocks and headings without carrying the full page stylesheet.
Create text-first AI context
Remove scripts and styling while retaining the information structure that must still be reviewed.
HTML to Markdown Example
<h2>Setup</h2>
<p>Read the <a href="/guide">guide</a>.</p>
<ul><li>Install</li><li>Test</li></ul>
## Setup
Read the [guide](/guide).
- Install
- Test
Tips for Cleaner Markdown Output
- Use semantic HTML Headings, lists and tables convert more reliably than generic layout containers.
- Provide a base URL when needed Relative links require context if the result should work outside the original page.
- Choose an output dialect GFM supports tables and task lists that baseline CommonMark does not define.
- Review code fences Confirm the detected programming language and any embedded backticks.
- Decide the raw-HTML fallback Keeping unsupported HTML may preserve information but reduce portability.
Review Large Files Before Conversion
For large or complex files, start with a representative sample and review the generated output before relying on it.
Check the output for missing text, reading order, and layout issues before using it in another system.
Frequently Asked Questions
Are <script> and <style> elements removed?
Scripts and styles are not useful Markdown content and should not be relied on in the result. Review pasted HTML before reusing the output.
Are HTML tables converted to Markdown tables?
Compatible rectangular tables can become GFM tables. Tables with rowspan, colspan, nested blocks or multiple header rows need a documented fallback.
Are code blocks and inline code preserved?
They can be mapped from <pre> and <code>.
What happens to links and images?
Valid link text and destinations may be retained. Relative links and image paths remain context-dependent because an uploaded fragment has no guaranteed base URL.
Are unsupported HTML tags removed or retained?
Presentation-only wrappers may be simplified while readable text is retained. Compare the output with the source when custom elements carry meaning.
Does the converter output CommonMark or GFM?
The intended output is GitHub-Flavored Markdown. Tables, strikethrough and task lists rely on GFM extensions.
Can I paste an entire HTML document?
Yes. You can paste a fragment or upload an .html or .htm file, then review the generated Markdown.
Can this page convert a live website URL?
No. This page accepts pasted HTML or an uploaded HTML file; it does not fetch a live website URL.
Convert Markdown Back to PDF
Already have a Markdown file? Use theMarkdown to PDF converterto create a shareable PDF.