An HTML to Markdown converter turns web page code into clean, readable Markdown. Paste HTML, from a whole page or a fragment, and this HTML to Markdown converter rewrites headings, paragraphs, bold and italic text, links, images, lists, quotes, code and tables in Markdown syntax. Copy the result or download it as an .md file for a README, a docs site, a wiki or your notes app.
What Markdown is
Markdown is a simple way to format text using keyboard symbols you already know, such as asterisks for emphasis and number signs for headings. It sticks to the essentials rather than fonts and colors, which makes it easy to read even before it's rendered. CommonMark is a widely used standard version of Markdown, and GitHub Flavored Markdown adds extras such as tables.
How each element converts
- Headings h1 to h6 become # to ######.
- Paragraphs are separated by a blank line.
- Bold (strong or b) becomes **bold**; italic (em or i) becomes _italic_; strikethrough becomes ~~text~~.
- Links become [text](URL), keeping a title if there is one.
- Images become .
- Lists become - items or 1. numbered items, with nested lists indented under their parent and the start number kept.
- Blockquotes get a > at the start of each line.
- Inline code gets backticks, and code blocks (pre) become fenced blocks with three backticks, keeping a language such as js when the code is marked with one.
- Horizontal rules become ---, and line breaks become two spaces at the end of a line.
- Tables become GitHub-style tables, with a header row, a --- delimiter row and pipes between cells.
What's left out
Markdown only describes content and basic formatting, so anything that doesn't fit is dropped: scripts, styles, forms, buttons, embedded frames and SVG drawings. Classes, IDs, colors and layout are ignored. Divs, sections and similar containers are unwrapped so their content flows as normal paragraphs. HTML entities such as & and are turned back into the characters they stand for.
Special characters
Some characters mean something in Markdown, so the converter protects them when they appear in ordinary text. Asterisks, underscores, backticks, square brackets and backslashes are escaped with a backslash, as is a #, > or - at the start of a line, so 2*3 stays 2*3 instead of starting italic text. Inside tables, a pipe in a cell is written as \| so it doesn't start a new column, as the GitHub table spec describes. Text inside code is left exactly as it is.
How to use the HTML to Markdown converter
- Paste your HTML into the box: a full page, an article, or a snippet copied from your site's editor.
- Press Convert.
- Check the result. The line and character counts show how long it is.
- Copy the Markdown or download it as an .md file.
Example
This HTML:
<h1>Title</h1><p>Hello <strong>bold</strong> and <em>it</em> <a href="https://a.com">link</a>.</p>
becomes a level-1 heading, # Title, a blank line, and then: Hello **bold** and _it_ [link](https://a.com).
When to convert HTML to Markdown
- Moving a blog or docs from a CMS to a static site generator that uses Markdown files.
- Writing a README from content on a web page.
- Saving articles into a Markdown notes app.
- Cleaning up pasted content that carries a lot of hidden formatting.
To go the other way, use our Markdown to HTML converter.
Nested lists and quotes
Lists inside lists are indented under their parent item, so the structure is kept when the Markdown is rendered. Numbered lists keep their starting number, so a list that began at 3 in the HTML still starts at 3. Quotes that contain several paragraphs get a > on every line, including the blank lines between paragraphs, so they stay as one quote. Code inside a list item or quote is kept as written.
Tidying the result
The converter collapses extra spaces and line breaks from the HTML source, removes empty paragraphs and leaves exactly one blank line between blocks. If the HTML used line breaks for spacing, you may want to remove a few of the two-space line breaks afterwards. Check links and images too: absolute URLs work anywhere, but relative ones depend on where the Markdown file ends up.
Large pages
The converter handles up to 2,000,000 characters of HTML in your browser. For very long pages, paste the main article rather than the whole document; menus, sidebars and footers are converted too, and they add clutter to the Markdown.
Common mistakes
- Expecting layout such as columns or colors to survive; Markdown doesn't support them.
- Converting a page with menus and footers; paste just the article for a cleaner result.
- Forgetting relative links. Links such as /about stay relative, so check them in the new location.
- Complex tables with merged cells, which Markdown tables can't show.
What next
Use this often? Add HTML to Mark to your Home screen.
Frequently asked questions
How does the HTML to Markdown converter work?
It reads your HTML and rewrites each element in Markdown: headings become #, bold becomes **, links become [text](URL), lists become - items and tables become GitHub-style tables.
Does it keep tables?
Yes. Tables become GitHub Flavored Markdown tables with a header row and pipes between cells.
What happens to scripts and styles?
They're removed, along with forms, buttons, frames and layout, because Markdown only describes content.
Are code blocks kept?
Yes. Pre blocks become fenced code blocks with three backticks, keeping the language when it's marked.
Is my HTML uploaded?
No. The conversion runs in your browser and nothing is sent anywhere.
Was this tool helpful?
What went wrong?
We only receive the reason you pick, never what you typed into the tool.
Thanks for your feedback.