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.
| Direction | Browser tool | pandoc | Guide |
|---|---|---|---|
| Markdown to HTML | MD to HTML | pandoc in.md -o out.html | Markdown to HTML |
| Markdown to PDF | MD to PDF | pandoc in.md -o out.pdf (needs a PDF engine) | Markdown to PDF |
| Markdown to Word | MD to DOCX | pandoc in.md -o out.docx | Markdown to Word |
| Markdown to plain text | Copy the editor preview | pandoc in.md -t plain --wrap=none | Markdown to text |
| HTML to Markdown | HTML to MD | pandoc in.html -t gfm -o out.md | HTML to Markdown |
| Web page to Markdown | URL to MD (Pro) | pandoc URL -t gfm -o out.md | URL to Markdown |
| Word to Markdown | DOCX to MD | pandoc in.docx -t gfm --extract-media=. -o out.md | Word to Markdown |
| PDF to Markdown | PDF to MD | Not supported (use MarkItDown) | PDF to Markdown |
| CSV to Markdown table | Paste into the table generator | pandoc in.csv -t gfm | CSV to Markdown table |
| JSON to Markdown | Script it | Not supported | JSON 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.
| Element | MD to HTML | MD to PDF or DOCX | HTML or DOCX to MD | PDF to MD |
|---|---|---|---|---|
| Headings, lists, bold, links | Kept | Kept | Kept | Usually kept |
| Tables | Kept | Kept, no merged cells | Kept if simple | Often broken |
| Images | Kept as img tags | Embedded | Extracted to files or dropped | Dropped |
| Code blocks with language | Kept | Kept, monospaced | Kept if the source marks them | Lost (becomes prose) |
| Footnotes | Kept | Kept | Rarely kept | Lost |
| Fonts, colours, layout | None to keep | Comes from a stylesheet or reference doc | Dropped by design | Dropped 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.
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.