Markdown to HTML Converter
Convert Markdown to clean HTML with live preview.
Written by Anil Gautam · Updated
How does the converter turn Markdown into HTML?
Conversion runs in your browser and goes line by line. A line starting with one to six # characters and a space becomes h1 to h6, while #Heading with no space stays ordinary text. Lines starting with -, * or + and a space become items of a ul, and lines like "1. " become items of an ol. Neighboring plain lines are joined with a space into one paragraph, and a blank line closes the paragraph or list. Each line beginning with "> " becomes its own blockquote, a line made only of three or more hyphens, asterisks or underscores becomes an hr, and the lines between two lines of three backticks are escaped and wrapped in pre and code tags.
The sample in the input box produces an h2, a paragraph containing <strong>markdown</strong> and <a href="https://oneclickuse.com">link</a>, a ul with three li items, and a pre block holding const x = 1;. Within a line the converter also handles images, inline code, *italic* or _italic_, and ~~strikethrough~~. Copy HTML copies the markup as shown, one block per line with list items indented two spaces, and no id or class attributes are added. The preview inserts the generated HTML into the page, so images your Markdown points to are loaded from their own addresses.
Which Markdown habits do not convert as expected?
Indented sub-items do not nest: " - nested" under a list item ends the list and turns into a paragraph. Ordered lists always render from 1, so items typed as 3. and 4. display as 1 and 2. Two trailing spaces do not create a line break, a title underlined with === stays plain text, bold needs double asterisks (__bold__ is left as typed), and a link title in quotes after the URL ends up inside the href and breaks the link. An autolink such as <https://example.com> stays plain text, and a language name after the opening backticks is dropped.
Raw HTML is escaped, so <b>hi</b> typed into the Markdown shows up on the page as literal text with its angle brackets. Inline code is escaped once: a < b between backticks comes out as <code>a < b</code> and displays as a < b, the same as in a fenced block. To go the other way, use the HTML to Markdown Converter.