ToolHub

Markdown ↔ HTML Converter

Convert between Markdown and HTML with live preview

Markdown input

HTML output

Conversion runs locally in your browser using marked and turndown. Your text never leaves your device.

Overview

Convert Markdown and HTML in both directions

Markdown is the writing format that powers GitHub READMEs, most modern blog platforms, Notion documents, Obsidian notes, and the inline content on Reddit, Discord, and Slack. HTML is the format browsers actually render. Converting between the two is a common need: writers who think in Markdown but need HTML to paste into a CMS, developers who want to clean up raw HTML into readable Markdown source, and anyone moving content between platforms that speak different formats.

ToolHub Markdown Converter handles both directions with live preview, copy, and full GitHub Flavored Markdown support. Conversion runs in your browser using the well-known marked and turndown libraries. Your content never leaves your device.

Step-by-step

How to use the converter

  1. 1

    Pick a direction

    Toggle between Markdown to HTML and HTML to Markdown at the top. The labels on each pane update so you always know which side is input.
  2. 2

    Type or paste your content

    Drop Markdown source or HTML markup into the left pane. The output regenerates on every keystroke, so you can tweak and watch the result update live.
  3. 3

    Toggle preview (Markdown to HTML only)

    For Markdown to HTML, click Preview to see the rendered result instead of the raw HTML. Useful for checking that your formatting actually looks right before you ship it.
  4. 4

    Copy and use

    Hit copy to grab the full output. Paste it into your blog, Slack, Notion, GitHub, email, or wherever the next step in your workflow needs it.

Use the swap button

The arrow icon between the panes swaps your input and output. Useful when you want to round-trip content: convert Markdown to HTML, edit a bit, then convert back to Markdown to see the cleaned-up source.

Background

What is Markdown?

Markdown is a lightweight markup language created by John Gruber and Aaron Swartz in 2004. The design goal was simple: make a syntax that is both readable as plain text and convertible to clean HTML. The result is a tiny set of conventions that look like email formatting:

  • # Heading for an h1, ## Subheading for an h2, and so on
  • **bold** for strong, _italic_ for emphasis
  • [text](url) for links, ![alt](url) for images
  • - item for bulleted lists, 1. item for numbered
  • `code` for inline, three backticks for code blocks
  • > quote for blockquotes

The original spec was small. GitHub Flavored Markdown (GFM) extended it with tables, task lists, strikethrough, and fenced code blocks with syntax highlighting hints. GFM is now the de facto standard everywhere people write Markdown.

Why people prefer Markdown to HTML

  • Faster to write: a few characters do the work of long HTML tags.
  • Readable as source: even unrendered, Markdown is comfortable to read.
  • Portable: every modern tool understands at least basic Markdown.
  • Future-proof: plain text outlives any specific app or platform.
  • Diff-friendly: version control shows clean changes line by line.

Comparison

Markdown vs HTML: when to use which

MarkdownHTML
Best forWriting source contentFinal rendered page
Learning curveMinutesHours to days
Feature ceilingLimited (text content)Unlimited (any UI)
Custom stylingNot supportedFull CSS control
Where it runsSource files, docs, READMEs, blogsWeb pages, emails, apps
ToolingLightweight (text editor)Browser dev tools, design tools

The right pattern is usually: write in Markdown, convert to HTML at publish time. Tools like Next.js, Hugo, Gatsby, and most static site generators do exactly this automatically.

Use cases

When to convert each direction

Publishing to a CMS

Some platforms only accept HTML in their editors. Write in Markdown, convert, paste.

Pasting into Slack or Discord

These render Markdown but not HTML. If your source is HTML, convert to Markdown first.

Cleaning up rich text editor output

Word, Google Docs, and similar produce ugly HTML. Convert to Markdown and back to get clean output.

Migrating between platforms

Moving from Medium to Ghost, WordPress to Hugo, Notion to a static site? Markdown is the universal middle ground.

Writing technical documentation

Source files in Markdown, render to HTML for the public docs site. Used by Stripe, GitHub, Linear, almost everyone.

Composing emails with code

Some email tools accept HTML but you write in Markdown. Convert before pasting into the email composer.

Reference

GitHub Flavored Markdown features supported

Tables

Pipe-separated columns with a header divider row. Cell alignment with colons in the divider: | --- | for default, | :--- | for left, | ---: | for right, | :---: | for center.

Task lists

List items prefixed with [ ] for unchecked or [x] for checked. Useful for project status, checklists, and TODOs.

Fenced code blocks

Three backticks open and close a code block. Add a language identifier after the opening backticks (like ```js) for syntax highlighting in tools that support it.

Strikethrough

Text wrapped in double tildes: ~~strikethrough~~. Renders as a struck-through span.

Auto-linking

Plain URLs in text get auto-converted to clickable links. No square brackets needed.

Common Markdown mistakes

  • Forgetting blank lines: most Markdown processors require an empty line before lists, code blocks, or headings to recognize them.
  • Using single asterisk for italic in some places: stick to either underscore or asterisk consistently to avoid confusion.
  • Mixing tabs and spaces in code blocks: use spaces only or your code block may break.
  • Putting blank line inside a list item: that ends the list. Keep continuation indented without blank lines.
  • Using HTML inside Markdown without sanitization: most processors allow inline HTML, which is a security risk if the source is user-supplied.
  • Expecting tables to work in classic Markdown: tables are GFM-only. Standard Markdown does not support them.

Common questions

Why does my HTML to Markdown output look stripped?

Markdown supports a small subset of what HTML can express. CSS classes, inline styles, custom attributes, complex nested divs, and visual layout (multi-column grids, absolute positioning) have no Markdown equivalent and are discarded during conversion. The output preserves the semantic content but not the visual design.

Can I keep raw HTML inside my Markdown?

Yes. The Markdown spec allows inline HTML, and our converter preserves it. This is useful for things Markdown cannot express (centered images, video embeds, inline styles). Be careful with user-generated Markdown though: inline HTML is also a vector for XSS attacks.

Does this support MDX?

Not directly. MDX is Markdown plus JSX (React components). MDX requires a build step that compiles components, which is beyond a simple text converter. For MDX content, write and process it in your build pipeline.

Can I customize the output HTML?

Not from this tool. The HTML output uses standard tags (h1, p, ul, code, pre, table, etc.) without classes or inline styles. Add styling with your own CSS after pasting the output into your project.

Is the rendering safe from XSS?

The Preview pane renders the HTML output directly. If you paste untrusted Markdown that contains script tags, those would execute in the preview. Only paste content you wrote or trust. For server-rendering Markdown from end users, always sanitize with a library like DOMPurify or rehype-sanitize.

100% private

Privacy and security

Content stays on your device

Conversion uses marked and turndown, both running entirely in your browser. There is no upload, no logging, no analytics on your text. Open developer tools and watch the Network tab during conversion: zero outbound requests carry your content.
  • No file or network upload
  • Works offline once the page is loaded
  • Compatible with private and incognito browsing
  • Open-source libraries (marked and turndown), inspectable in your browser

Quick lookup

Markdown syntax quick reference

The most common Markdown syntax and the HTML each snippet becomes when you convert Markdown to HTML. Keep this handy while you write.

MarkdownBecomes this HTML
# Heading<h1>Heading</h1> top-level heading
## Subheading<h2>Subheading</h2> second-level heading
**bold**<strong>bold</strong> bold text
*italic*<em>italic</em> italic text
[link](url)<a href="url">link</a> hyperlink
`code`<code>code</code> inline code span
- list item<ul><li>list item</li></ul> bulleted list
> quote<blockquote>quote</blockquote> block quotation
![alt](img)<img src="img" alt="alt"> embedded image

This covers CommonMark basics plus the GitHub Flavored Markdown extras. Paste any of these into the converter to see the exact HTML it produces.

Step-by-step

How to convert Markdown to HTML

Converting Markdown to HTML takes a few seconds in the browser. There is nothing to install and no account to create.

  1. 1

    Set the direction to Markdown to HTML

    Use the toggle at the top so the left pane is your Markdown input and the right pane is the generated HTML.
  2. 2

    Type or paste your Markdown

    Drop in a README, a blog draft, or a single line. The HTML output regenerates on every keystroke.
  3. 3

    Check the rendered preview

    Click Preview to confirm the formatting looks right before you copy the markup.
  4. 4

    Copy the HTML

    Grab the output and paste it into your CMS, email, or web page.

As a worked example, # Title becomes <h1>Title</h1>, and **done** becomes <strong>done</strong>. Every Markdown construct maps to a single semantic HTML tag, which is why the output stays clean and easy to style.

Reverse direction

Converting HTML back to Markdown

The converter also runs the other way. Flip the direction to HTML to Markdown and paste raw markup to get back a tidy Markdown source file. This reverse conversion is most useful for cleaning up rich text: HTML pasted out of Word, Google Docs, or a webpage is usually full of nested <span> tags, inline styles, and empty attributes. Converting that HTML to Markdown strips the noise and leaves plain, readable text.

  • Turn messy CMS or email HTML back into portable Markdown source.
  • Extract the readable content from a copied webpage without the styling cruft.
  • Round-trip content: convert Markdown to HTML, edit, then convert back to see the cleaned-up Markdown.

Workflow

Markdown to PDF

There is no direct Markdown to PDF button, and you do not need one. The simplest and best online Markdown to PDF converter workflow is a two-step trick that works in any browser and installs nothing:

  1. 1

    Convert Markdown to HTML

    Paste your Markdown, set the direction to Markdown to HTML, and open the rendered Preview.
  2. 2

    Print the HTML to PDF

    Open your browser Print dialog (Ctrl+P or Cmd+P) and choose Save as PDF as the destination.

Why go through HTML first

PDF is a print format, and browsers already know how to print HTML beautifully. Converting Markdown to HTML first lets the browser handle page breaks, fonts, and margins for you, so the PDF matches what you see in the preview.

FAQ

Frequently asked questions

How do I convert Markdown to HTML?

Paste your Markdown into the input pane with the direction set to Markdown to HTML, then copy the generated HTML from the output pane. The conversion happens instantly in your browser as you type, so there is no button to press and no upload to wait for.

Can I convert Markdown to PDF?

Yes, in two steps. Convert your Markdown to HTML, open the Preview, then use your browser Print dialog and select Save as PDF. Going through HTML gives you a clean, printable document without installing any software.

Is this converter private?

Completely. Conversion runs entirely in your browser with the marked and turndown libraries. Your text is never uploaded, logged, or analyzed, and the tool keeps working offline once the page has loaded.

Which Markdown flavor is supported (CommonMark, GFM)?

The converter uses GitHub Flavored Markdown, which is built on top of the CommonMark specification. That means all the CommonMark basics plus the GFM extras: tables, task lists, strikethrough, autolinked URLs, and fenced code blocks.

Related tools

Quick steps

1

Pick a direction

Markdown to HTML for publishing, HTML to Markdown for clean source files.

2

Type or paste

Conversion happens live as you type. Use Sample to load example content.

3

Preview or copy

Toggle the rendered preview, or copy the output ready to paste anywhere.

Frequently asked questions

Which Markdown flavor is supported?

GitHub Flavored Markdown (GFM): standard headings, lists, links, images, plus tables, task lists, strikethrough, and fenced code blocks. The same dialect used by GitHub, GitLab, Reddit, and most modern blogging platforms.

Will my content be uploaded?

No. Conversion runs entirely in your browser using marked (Markdown to HTML) and turndown (HTML to Markdown). Open the developer tools Network tab and confirm: zero outbound requests carry your content.

Can I convert Markdown with custom HTML inside?

Yes. marked allows raw HTML inside Markdown by default. The output preserves your inline tags. Be aware this is also why you should sanitize untrusted Markdown before rendering.

Why does HTML to Markdown sometimes lose formatting?

Markdown is a strict subset of HTML's possibilities. CSS classes, inline styles, custom attributes, and complex nested layouts have no Markdown equivalent and are dropped during conversion.

Related tools

More free developer tools and other utilities you might find useful.