Markdown Converter: Every Direction Explained (2026)

September 11, 2026 · 10 min read

Markdown Converter: Convert Markdown to and from Any Format

A markdown converter turns .md files into HTML, PDF, Word, or plain text. It also turns HTML, web pages, Word, PDF, and CSV back into Markdown. This page is the map: every direction, what survives the trip, which tool to use (browser, pandoc, or a library), and where the step-by-step guide for each one lives.

The Markdown Conversion Matrix

Every conversion is one row in this table. The browser column is our free tool for that direction, and the pandoc column is the command that does the same thing locally. Each guide link goes to the post that walks through the details, so this page stays a hub rather than repeating them.

DirectionBrowser toolpandocGuide
Markdown to HTMLMD to HTMLpandoc in.md -o out.htmlMarkdown to HTML
Markdown to PDFMD to PDFpandoc in.md -o out.pdf (needs a PDF engine)Markdown to PDF
Markdown to WordMD to DOCXpandoc in.md -o out.docxMarkdown to Word
Markdown to plain textCopy the editor previewpandoc in.md -t plain --wrap=noneMarkdown to text
HTML to MarkdownHTML to MDpandoc in.html -t gfm -o out.mdHTML to Markdown
Web page to MarkdownURL to MD (Pro)pandoc URL -t gfm -o out.mdURL to Markdown
Word to MarkdownDOCX to MDpandoc in.docx -t gfm --extract-media=. -o out.mdWord to Markdown
PDF to MarkdownPDF to MDNot supported (use MarkItDown)PDF to Markdown
CSV to Markdown tablePaste into the table generatorpandoc in.csv -t gfmCSV to Markdown table
JSON to MarkdownScript itNot supportedJSON to Markdown

Pandoc infers the output format from the file extension after -o, which is why most rows don't need a -t flag. When there's no output file, or the extension is unknown, it defaults to HTML, per the pandoc manual.

What Survives a Markdown Conversion?

Markdown describes structure, not appearance. It has headings, lists, emphasis, links, code, and (with GFM) tables and task lists. It has no fonts, colours, page sizes, columns, or merged cells. That single fact explains almost every complaint about a Markdown converter, in both directions.

ElementMD to HTMLMD to PDF or DOCXHTML or DOCX to MDPDF to MD
Headings, lists, bold, linksKeptKeptKeptUsually kept
TablesKeptKept, no merged cellsKept if simpleOften broken
ImagesKept as img tagsEmbeddedExtracted to files or droppedDropped
Code blocks with languageKeptKept, monospacedKept if the source marks themLost (becomes prose)
FootnotesKeptKeptRarely keptLost
Fonts, colours, layoutNone to keepComes from a stylesheet or reference docDropped by designDropped by design

Going to PDF or Word, the look comes from something outside the Markdown. Our PDF tool applies its own stylesheet. Pandoc uses a LaTeX template for PDF and a --reference-doc file for DOCX, which the manual describes as a style reference whose styles are copied into the output. Coming back from PDF or Word, layout is discarded on purpose. That's the trade you make for a portable file, and it's why the Markdown vs HTML question keeps coming up.

Which Markdown Converter Should You Use: Browser, pandoc, or Library?

Three kinds of tool cover every row above. The right one depends on four things: privacy, batch size, fidelity, and whether the conversion has to run on a schedule.

Browser tools are the fastest for one file. Paste, convert, download, done. For a single README or a document you want to send today, this is what we use ourselves. The trade-off is that a file you upload leaves your machine, which rules browser tools out for confidential documents.

pandoc is the right choice when you have a folder of files, need a reproducible command, or work on documents you can't upload. It's a single binary, it reads 40-plus formats and writes 60-plus, and one shell loop converts a whole directory. The cost is setup. PDF output needs a separate engine (pdflatex, wkhtmltopdf, weasyprint, and typst are all accepted by --pdf-engine), and the defaults produce a plain academic look until you supply a template.

Libraries belong inside an application. marked and markdown-it (JavaScript) and Python-Markdown handle Markdown to HTML. For HTML to Markdown, turndown (JavaScript) and markdownify (Python) are the standard picks. Microsoft's MarkItDown (Python, pip install 'markitdown[all]') covers PDF, Word, PowerPoint, Excel, images with OCR, audio transcription, HTML, CSV, JSON, EPUB, and ZIP archives. It's the tool we'd reach for to feed documents into an LLM pipeline.

The rule we follow: browser for one file, pandoc for a folder, library for a product.

Convert Markdown to HTML, PDF, and Word

This is the outbound half of the matrix, and it's where fidelity is highest because HTML can represent everything Markdown can.

HTML output. The output is semantic markup: h1 to h6, p, ul, table, pre with a code child carrying the language class. It's the base for every other outbound format, since PDF converters render HTML and DOCX converters map the same tree to Word styles. Standalone pages need -s in pandoc to get a head and a body wrapper.

PDF output. The page breaks, margins, and fonts don't exist in the Markdown. A browser tool supplies a stylesheet; pandoc supplies a LaTeX or HTML template. Page breaks in particular need a hint the converter understands, which the page break guide covers.

Word output. Headings become Word heading styles, so the navigation pane and table of contents work. Code blocks become a monospaced style, and tables become real Word tables without merged cells. If your company has a template, pandoc's --reference-doc=template.docx copies its styles.

Here's a sample that uses the elements that survive the outbound trip. Convert it to HTML below, then try the same text in the PDF and DOCX tools to compare.

Quarterly summary

Revenue grew 12% against the previous quarter.

Region Change
EMEA +14%
APAC +9%
  • Close the books
  • Publish the report

Source: internal ledger. Figures rounded to the nearest percent.

47 words251 characters13 lines
Markdown

Convert to Markdown from HTML, Word, PDF, and URLs

Inbound conversions are lossy by design, so the goal is clean Markdown rather than a faithful copy.

HTML input. The converter walks the DOM and emits Markdown for the tags it knows. Divs, spans, inline styles, scripts, and tracking pixels are dropped, which is usually the point. Nested tables and tables with colspan come out flattened or as raw HTML. Pandoc's -t gfm writer produces GitHub-flavoured output with pipe tables, and turndown gives you the same in Node with a plugin for GFM.

A URL. The same as HTML, plus a fetch step and a readability pass that strips navigation, footers, and sidebars. Our URL to MD tool is a Pro feature. Pandoc accepts a URL directly as its input argument if you'd rather work locally.

Word files. Headings, lists, bold, italics, links, and simple tables map cleanly because Word stores them as structure. Images are the catch: pandoc needs --extract-media=DIR to pull them out of the .docx and rewrite the references, otherwise they're gone. Comments and tracked changes are dropped unless you ask for them.

PDF files. PDF has no structure, only positioned text, so every converter guesses at headings from font size and rebuilds paragraphs from line positions. Expect to fix tables and code blocks by hand. Pandoc can't read PDF at all; MarkItDown and our PDF tool can, with the limits above.

CSV and JSON. These are data, not documents. CSV maps naturally to a Markdown table (pandoc reads .csv directly). JSON needs a small script that decides which keys become headings, which become tables, and which are skipped.

Pandoc Flags Worth Memorising

Pandoc's manual is long; these six commands cover most Markdown conversions you'll ever run. The pandoc guide goes deeper on templates and filters.

pandoc -f gfm -t html5 -s README.md -o readme.html
pandoc -f markdown -t docx --reference-doc=style.docx report.md -o report.docx
pandoc report.md -o report.pdf --pdf-engine=xelatex
pandoc page.html -t gfm --wrap=none -o page.md
pandoc contract.docx -t gfm --extract-media=media -o contract.md
pandoc notes.md -t plain --wrap=none -o notes.txt

-f and -t name the reader and writer. The Markdown readers you'll use are markdown (Pandoc's own dialect, the default), gfm (GitHub), and commonmark; commonmark_x is CommonMark with the extensions most people want. -s makes a standalone document with a header. --wrap=none stops pandoc from re-wrapping paragraphs at 72 characters, which matters for Markdown output that goes into a Git repo.

One limitation to plan for: pandoc's default markdown reader is its own dialect, not GFM. It requires a blank line before a heading, so a ## Heading line that directly follows a paragraph is read as part of that paragraph, where GitHub would render a heading. Pass -f gfm when the file was written for GitHub.

Common Markdown Converter Mistakes

Expecting a PDF to look like the Markdown preview. The preview is HTML with our stylesheet. A different converter applies a different stylesheet, so fonts and spacing change. Pick the converter first, then adjust the Markdown for it.

Converting a PDF and treating the result as final. Run the output through the formatter and read every table. PDF to Markdown is a first draft, never a finished file.

Forgetting --extract-media on DOCX input. Pandoc silently drops embedded images without it. The output Markdown looks complete until you notice every figure is missing.

Markdown Converter FAQ

A markdown converter is only as good as your understanding of what the target format can hold. Outbound to HTML, PDF, and Word, structure survives and appearance comes from a template. Inbound from HTML, Word, and PDF, expect a clean draft rather than a copy. Start with the direction you need in the editor, convert a real file, and read the output before you trust it.