HTML to Markdown Converter

Words—
Characters—
Lines—

How HTML to Markdown Converter is calculated: Basic HTML to basic markdown, labelled plainly: h1-h3 become # ## ###, strong and b become **x**, em and i become *x*, code becomes `x`, links become [t](u), ul items become - item, ol items become 1. item, and paragraphs become plain lines. Tables, images, classes, and styling are not converted.

What is an HTML to markdown converter?

An HTML to markdown converter turns HTML — the code a browser renders as a web page — back into markdown, the plain text with a few simple marks that writers actually type. Paste in a heading, a paragraph with bold and italic, and a list, and the converter gives you the markdown for all of it: a hash for the heading, two stars for the bold, a dash for each list item. The default text on this page is a short shopping list in HTML, and the output is the same list in markdown — 17 words, 126 characters, and 8 lines.

The need comes up whenever a web page has to become a document again. A page copied out of a browser, an old post exported as HTML, a help article that needs to move into a readme — all of them arrive as HTML, and all of them are easier to edit as markdown. HTML is written for browsers; markdown is written for people. The converter moves the text from one to the other.

This converter handles the basic pair of formats, and it says so plainly in the formula box: headings one to three, bold, italic, inline code, links, bullet lists, numbered lists, and paragraphs. Tables, images, classes, and styling are not converted — a table in HTML comes out as its plain text, not as a markdown table, and an image comes out as nothing at all, because markdown for images needs an address the converter does not invent.

Everything runs in your browser — your text never leaves your device, nothing is stored, and there is no account to create. It works offline once the page has loaded, so you can use it anywhere you edit.

How HTML becomes markdown

The converter reads the HTML tag by tag and replaces each one with its markdown mark. A level-one heading becomes one hash and a space; a level-two heading becomes two hashes; a level-three heading becomes three. A strong tag becomes two stars around the words, an emphasis tag becomes one star, and a code tag becomes backticks. A link becomes square brackets for the text and round brackets for the address — the address is kept exactly as it was in the HTML.

Lists are handled as blocks. A bullet list becomes a dash and a space at the start of each item, one item per line. A numbered list becomes a number, a full stop, and a space — and the numbers are renumbered from one, in order, no matter what numbers the HTML used. A list in HTML that starts at 5 still becomes 1, 2, 3 in markdown, because markdown numbers its lists from one and the converter follows the markdown rule, not the HTML one.

Paragraphs become plain lines with a blank line between them, and a line break tag becomes a plain newline. Any tag the converter does not know is stripped and its text kept — a span, a div, or a font tag disappears, but the words inside it stay. That is the safe choice: the text is never lost, even when the formatting around it cannot be carried across.

Finally, the entities are decoded. An & in the HTML becomes a plain &, < becomes <, and " becomes a double quote — the same decoding the HTML encoder-decoder does by hand. The markdown that comes out is plain text with marks in it, not HTML with entities in it, which is what makes it readable and editable.

The subset this converter handles — and what it does not do

The subset is the point of this tool, and it is worth stating exactly. Headings: h1, h2, and h3 only — h4 and deeper become plain text, because basic markdown stops at three levels on the matching converter. Bold: strong and b. Italic: em and i. Inline code: code. Links: a tags with an href, in either quote style. Bullet lists: ul with li items. Numbered lists: ol with li items, renumbered from one. Paragraphs: p tags. Line breaks: br tags. Everything else: stripped, text kept.

What it does not do is just as important. It does not do tables — a table in HTML comes out as its cell text run together, not as a markdown table, because building a markdown table from HTML needs column widths the converter does not guess at. It does not do images — an img tag has no text to keep, and the converter does not invent a markdown image from an address alone. It does not do classes, ids, styles, or any attribute other than href: the formatting of the page is left behind, and only the words and the structure travel.

That limit is a deliberate choice, not a missing feature. Basic markdown covers most of what anyone rescues from a page — a heading, a few paragraphs, a list, a link — and a converter that does the basics exactly is more useful than one that guesses at tables and gets them wrong. If you need a table, rebuild it by hand in markdown. If you need the words, this converter gives them to you in one step.

If you need the other direction — markdown into HTML — the markdown editor on this site does that, with the same basic subset. The two converters are mirrors of each other: the same shopping list goes from markdown to HTML on one page and from HTML back to markdown on this one, and the round trip gives you the text you started with.

A worked example: a shopping list back to markdown

Take the default HTML exactly as it sits on the page: a level-two heading, a paragraph with bold milk, italic bread, and code eggs, a bullet list with Apples and Bananas, and a paragraph with a link to Sortrun. The output is the same list in markdown: ## Shopping List, a blank line, Buy **milk**, *bread*, and `eggs`., a blank line, - Apples, - Bananas, a blank line, and Visit [Sortrun](https://sortrun.com) for more tools. It is 17 words, 126 characters, and 8 lines.

Try a numbered list next. Paste in <h2>Steps</h2><ol><li>Mix</li><li>Bake</li><li>Serve</li></ol> and the output is ## Steps, a blank line, 1. Mix, 2. Bake, 3. Serve — 8 words, 33 characters, 5 lines. The numbers are renumbered from one in order, even though the HTML could have started at any number, and the heading is two hashes because it was an h2.

Now try the round trip. Take the markdown from the matching converter — the same shopping list, with a numbered list of two steps in the middle — convert it to HTML, paste that HTML here, and the output is the markdown you started with, word for word. The two converters agree with each other, because they use the same subset in both directions. A word counter can check the length of the same text on either side of the trip.

One more check worth doing: paste in HTML with a tag the converter does not know, such as <span>hello</span>. The output is the plain word 'hello' — the tag is gone, the text is kept. That is the rule for unknown tags: strip the tag, keep the words. Nothing you paste is ever lost to a tag the converter does not recognise.

Who converts HTML to markdown, and why

Writers are the biggest users. A post exported from an old blogging tool arrives as HTML, and editing it as HTML means fighting with tags. Converting it to markdown gives back a plain-text document that any editor can open, and the writer can edit the words without touching a tag.

Programmers are the second group. Documentation that lives in HTML — a help page, a wiki export, an old site — often needs to move into a readme or a docs folder, and those live in markdown. The converter does the move in one step, and the programmer checks the result instead of retyping the whole page.

Note-takers and students are the third group. A page copied out of a browser for study notes is HTML, and notes are easier to keep as markdown — headings, bold key terms, and lists, in a file that can be searched and versioned. The converter turns the copied page into notes in seconds.

Documentation teams are a fourth group, and they use the converter when a site moves to a new system. A help centre written in HTML does not move itself into a markdown-based docs site — every page has to be converted, and a converter that does the basics exactly is the tool for the job. The writer, the reviewer, and the site all read the same plain-text file at the end, and the HTML is made from it when it is needed.

HTML to markdown converter vs markdown editor

This converter and the markdown editor are mirrors, not twins. The editor takes markdown in and shows the HTML out, with a live rendered preview beside it. This converter takes HTML in and gives markdown out, with no preview — because markdown is already plain text, and there is nothing to preview.

Use the editor when you are writing markdown and want to see the result. Use this converter when you have HTML and want the markdown back — a paste, a copy, and you are done. The subsets match on both pages, because they are the same basic markdown in both directions: the same shopping list gives the same five blocks on either page.

There is one more difference: the editor's preview renders the HTML in the page, so you can see a heading as a heading. This converter gives you the markdown as text, so you can read the marks themselves — the hashes, the stars, the dashes. If you are learning markdown, this converter is the better teacher: it shows you exactly what each tag becomes, mark by mark.

Both pages are private in the same way: everything runs in your browser, nothing is uploaded, nothing is stored. The choice between them is about direction — markdown to HTML, or HTML to markdown — and both are one click away from each other.

Common conversion mistakes

The most common mistake is expecting a table to survive. A table in HTML comes out as its cell text run together, not as a markdown table, because the converter does not build markdown tables. If you need a table in markdown, rebuild it by hand from the cell text — the words are all there, only the grid is gone.

Second: expecting images to survive. An img tag has no text to keep, and the converter drops it silently. If the image matters, note its address before you convert — the converter will not remind you it was there. Third: expecting classes and styles to survive. A class that makes a paragraph red, or a style that centres a heading, is formatting, not content, and the converter leaves formatting behind by design.

Fourth: pasting a whole page, doctype and all, and being surprised by the leftover text. The converter strips the tags, but the text in a page's navigation, footer, and sidebar is still text — and it will all come through. Convert the part you need, not the whole page, or clean the navigation out of the result afterwards. A text formatter can tidy the spacing of the result once the conversion is done.

And fifth: converting twice and expecting the same result. HTML to markdown to HTML is a round trip that works, because the subsets match — but HTML to markdown to markdown again is a no-op, and markdown to HTML to markdown is only exact for the basic subset. If the HTML had a table, the table is gone after the first conversion, and no second conversion will bring it back.

How to use this HTML to markdown converter

Using it is simple. Paste HTML into the box — the default is a short shopping list in HTML — and the markdown appears instantly in the box below, with the word, character, and line counts shown above it. To use the markdown somewhere else, copy it from the output box with the Copy button.

To try a tag, paste it and watch the output change — an h1 for a heading, a strong tag for bold, a ul for a bullet list, an ol for a numbered list. To start over, select all, delete, and paste the new HTML. The counts update as you type, so you can see the length of what you are converting without a second tool.

Everything runs in your browser. No sign-up, no account, no data sent anywhere — your text never leaves your device. It works offline once the page has loaded, so you can use it anywhere you edit. Try it with something real before you need it: copy a page you own, convert it, and read the markdown — that is the fastest way to learn what survives and what does not.

And if you want to go the other way — markdown into HTML — the markdown editor does that with the same subset. The converter is for the way back; the editor is for the way there — and both use the same basic markdown underneath.

Frequently Asked Questions

Basic HTML, stated plainly: h1 to h3 headings, strong and b for bold, em and i for italic, code for inline code, links with an href, ul and ol lists with li items, p paragraphs, and br line breaks. Tables, images, classes, ids, and styles are not converted — unknown tags are stripped and their text is kept.

Yes, for the basic subset. The same shopping list goes from markdown to HTML on the matching converter and from HTML back to markdown on this page, and the result is the markdown you started with, word for word. Anything outside the subset — a table, an image — is lost on the first conversion and cannot come back.

Because markdown numbers its lists from one, and the converter follows the markdown rule, not the HTML one. A list in HTML that starts at 5 still becomes 1, 2, 3 in markdown. The order is kept; only the starting number changes, because markdown does not carry a starting number.

Yes. Everything runs in your browser — your HTML is never uploaded, stored, or sent anywhere. You can use it offline once the page has loaded, and you can paste a page you own without worrying about who sees it.

More free tools

More calculators and utilities from Sortrun — free, no sign-up.