Markdown to PDF — Convert Markdown to PDF Online

Write or paste Markdown and convert it to a downloadable PDF instantly. Supports headings, bold, italic, links, code blocks, tables, and lists. 100% client-side — your content stays private.

Markdown to PDF

Markdown Input
PDF Preview
Generating PDF...

PDF generated successfully!

Download PDF

What does a Markdown to PDF converter do? It turns plain-text Markdown syntax into a paginated PDF file. This one parses your text as GitHub-flavored Markdown with marked, then draws each block onto A4 pages with pdf-lib using the standard Helvetica and Courier fonts. Because the words are written as real text objects rather than a screenshot, the finished PDF stays selectable, searchable and copy-pasteable.

How to Convert Markdown to PDF

  1. Write or paste your Markdown — Type into the left pane or paste an existing .md file. The toolbar inserts bold, italic, heading, link, code-fence, table and list syntax at the cursor.
  2. Read the live preview — The right pane re-renders on every keystroke, showing GitHub-style headings, shaded code blocks and bordered tables. Use it to catch a broken table row or an unclosed code fence.
  3. Convert to PDF — Click Convert to PDF. The parser runs, pdf-lib embeds Helvetica, Helvetica-Bold and Courier, and each block is drawn down the page until the cursor runs out of room and a new page starts.
  4. Download the file — Press Download PDF to save the result. The file is built as a Blob in memory, so the download never touches a server.
  5. Fall back to HTML when you need controlDownload .html gives you the styled HTML the preview uses. Open it and print from your browser when you need custom margins, landscape orientation, non-Latin fonts or clickable links.

How Markdown to PDF Conversion Works

Markdown is a plain-text format: the file on disk contains nothing but characters and a handful of punctuation conventions. A PDF is the opposite — a fixed-geometry container where every glyph has a coordinate on a page of a stated size. Converting between them means deciding, for each piece of your document, exactly where it lands and in which font. This converter does that in three passes, all inside the browser tab.

First, marked parses the Markdown with GitHub-flavored Markdown enabled and breaks turned on, so a single newline becomes a line break instead of being folded into the previous line. The result is an HTML string. Second, that HTML is attached to a detached element so the browser builds a real element tree from it — this is what gives block detection its reliability, because the parser has already resolved nesting, list types and table structure. Third, the tool walks the top-level blocks and calls pdf-lib's drawText for each one, tracking a vertical cursor as it goes and starting a fresh page whenever the cursor falls below the bottom margin.

Line wrapping is measured rather than guessed. For every candidate line, the embedded font reports the exact advance width of the string at the chosen size, and a word is only added while the measured width still fits the text column:

keep adding words while widthOfTextAtSize(line, size) <= 495 pt

That measurement is why the output does not overflow the margin even when a paragraph contains long URLs or unusual spacing, and why the page count depends on your content rather than on a fixed lines-per-page assumption.

Page Layout the Converter Uses

PropertyValue
Page sizeA4 — 595.28 × 841.89 pt
Left margin50 pt
First baseline791 pt from the bottom edge
Text column width495 pt
Body textHelvetica, 11 pt, 14 pt line height
HeadingsHelvetica-Bold at 22 / 18 / 15 / 13 pt
Code blocksCourier, 9 pt
Page breakNew page when the cursor drops below 50 pt

Latin alphabets only. The PDF uses three of the fourteen standard fonts built into every PDF reader — Helvetica, Helvetica-Bold and Courier — and those are encoded with WinAnsi. Characters outside that range, including Chinese, Japanese, Korean, Arabic, Devanagari and most emoji, cannot be encoded, so a document containing them will not export cleanly. For those scripts, use Download .html and print from your browser, which can use any font installed on your system.

Which Markdown Features Reach the PDF

The preview and the PDF are produced by two different renderers, so a few things look richer on screen than they do in the exported file. This table is the honest comparison; check it before converting anything you intend to send on.

MarkdownIn the previewIn the PDF
Headings # to ######Sized and ruledHelvetica-Bold, 22 / 18 / 15 / 13 pt
ParagraphsWrapped at 700 pxWrapped to the 495 pt column
Bold and italic inside a paragraphShownFlattened to plain body text
Bullet and numbered listsShown, nestedDrawn with a bullet or number prefix
Fenced code blocksShaded boxCourier 9 pt, no shading
BlockquotesLeft rule, grey textIndented text
GFM tablesBordered cellsCell text laid out in columns
Horizontal rulesThin lineThin line
LinksBlue and clickableLink text only, not clickable
ImagesDisplayedNot drawn

Getting Better Output

  • Structure with headings rather than bold lines. Only real headings get the larger bold font in the PDF; a bold sentence inside a paragraph does not.
  • Use fenced code blocks for anything multi-line. Inline backticks are flattened into the surrounding paragraph, while a fence switches the whole block to Courier.
  • Keep table cells a similar length. Column widths are divided evenly, so one very long cell forces the rest to look sparse.
  • Break long documents with horizontal rules. They read as section dividers and give you a natural place to check pagination.
  • If you need images, clickable links, custom margins or a non-Latin script, download the HTML and print it from your browser instead.

Frequently Asked Questions

Open the .md file in any text editor, copy its contents into the left pane, and click Convert to PDF. There is nothing to install and no account to create. The converter parses the syntax, lays the blocks out on A4 pages, and hands back a finished PDF you can download immediately.

Yes. Every block is written with pdf-lib's text drawing operations, so the PDF contains genuine text objects rather than an image of your document. You can select and copy passages, search inside the file, and a screen reader can read it aloud. That is the main practical difference between this tool and a converter that screenshots a rendered page.

GitHub-flavored Markdown, parsed by the marked library with GFM extensions and breaks enabled. That means pipe tables, fenced code blocks, strikethrough and task-list syntax are recognised, and a single newline inside a paragraph produces a line break rather than being merged into the line above.

Your Markdown, the preview and the finished PDF all stay in the browser tab; nothing is uploaded and nothing is retained after you close it. The marked and pdf-lib libraries are fetched from public CDNs the first time you convert, which is an ordinary script request that carries none of your text.

Inline emphasis inside a paragraph is flattened. The exporter reads the text content of each block and draws it in a single font, so a **bold** phrase in the middle of a sentence keeps its words but loses its weight. Headings still come out bold because they are separate blocks. If inline emphasis matters, download the HTML and print from your browser.

The three fonts used are standard PDF base-14 fonts with WinAnsi encoding, which covers Latin script and common Western punctuation but nothing beyond it. CJK text, Arabic, Devanagari and most emoji have no representation in that encoding, so the export cannot write them. Use the HTML download and print from your browser, which can reach any font installed on your machine.

Not from this tool. Page size is fixed at A4, the text column at 495 points, and the fonts at Helvetica and Courier. Those constraints keep the output predictable without a settings panel. When you need control, take the HTML download into your browser's print dialog, where paper size, orientation, scale and margins are all adjustable.

Convert here when you want a fast, repeatable, single-column document and the content is plain prose, lists, code and tables in Latin script. Export the HTML and print when you need images, working hyperlinks, a different paper size, colour styling, or a font your language requires. Both paths start from the same Markdown, so it costs nothing to try one and switch.

Use Cases

README to Client Deliverable

A developer turns a project README into a PDF spec for a client who will not open a repository, keeping the code blocks and setup tables intact.

Meeting Minutes for the Record

A project lead writes minutes in Markdown during the call and issues a dated PDF straight afterwards, so the version circulated cannot be edited in place.

Course Handouts

An instructor keeps lesson notes in Markdown under version control and exports a fresh printable handout each term without re-formatting anything by hand.

Release Notes on a Ticket

A release manager pastes the changelog entry for a version and attaches the PDF to a support ticket, giving the customer a fixed document rather than a moving wiki page.

Documentation Snapshots for Audit

A technical writer freezes the Markdown source of a procedure as a PDF so an auditor can see exactly what the documentation said on a given date.