๐Ÿ› ๏ธ Developer Tools
ยท 1 min read

Free Markdown to HTML Converter


Convert Markdown to clean HTML. Runs entirely in your browser.

]+)`/g, โ€˜$1โ€™); // Headings html = html.replace(/^######\s+(.+)$/gm, โ€˜
$1
โ€™); html = html.replace(/^#####\s+(.+)$/gm, โ€˜
$1
โ€™); html = html.replace(/^####\s+(.+)$/gm, โ€˜

$1

โ€™); html = html.replace(/^###\s+(.+)$/gm, โ€˜

$1

โ€™); html = html.replace(/^##\s+(.+)$/gm, โ€˜

$1

โ€™); html = html.replace(/^#\s+(.+)$/gm, โ€˜

$1

โ€™); // Bold and italic html = html.replace(/***(.+?)***/g, โ€˜$1โ€™); html = html.replace(/**(.+?)**/g, โ€˜$1โ€™); html = html.replace(/*(.+?)*/g, โ€˜$1โ€™); // Images html = html.replace(/![([^]])](([^)]+))/g, '$1'); // Links html = html.replace(/[([^]]+)](([^)]+))/g, โ€˜$1โ€™); // Blockquotes html = html.replace(/^>\s+(.+)$/gm, โ€˜
$1
โ€™); // Horizontal rules html = html.replace(/^---$/gm, '
'); // Unordered lists html = html.replace(/^[-*]\s+(.+)$/gm, โ€˜
  • $1
  • โ€™); html = html.replace(/((?:
  • .</li>\n?)+)/g, โ€˜
      $1
    โ€™); // Ordered lists html = html.replace(/^\d+.\s+(.+)$/gm, โ€˜
  • $1
  • โ€™); // Paragraphs html = html.replace(/^(?!<[a-z])((?!</?\w).+)$/gm, โ€˜

    $1

    โ€™); // Clean up empty paragraphs html = html.replace(/

    \s*</p>/g, โ€); return html.trim(); } function convertMd() { var md = document.getElementById(โ€˜md-inputโ€™).value; var html = mdToHtml(md); document.getElementById(โ€˜md-htmlโ€™).value = html; document.getElementById(โ€˜md-previewโ€™).innerHTML = html; } function togglePreview() { document.getElementById(โ€˜md-preview-wrapโ€™).style.display = document.getElementById(โ€˜md-show-previewโ€™).checked ? โ€˜blockโ€™ : โ€˜noneโ€™; } function copyMdHtml(btn) { navigator.clipboard.writeText(document.getElementById(โ€˜md-htmlโ€™).value); btn.textContent = โ€˜Copied!โ€™; setTimeout(function() { btn.textContent = โ€˜Copy HTMLโ€™; }, 1500); } document.getElementById(โ€˜md-inputโ€™).addEventListener(โ€˜inputโ€™, convertMd);

    Supported Syntax

    • Headings (# H1 through ###### H6)
    • Bold (**text**) and italic (*text*)
    • Links ([text](url)) and images (![alt](url))
    • Code blocks (triple backticks) and inline code
    • Unordered and ordered lists
    • Blockquotes (> text)
    • Horizontal rules (---)

    For a full reference, see the Markdown Cheat Sheet.