Convert Markdown to PDF
Converting Markdown to PDF parses the plain-text markup — headings, lists, blockquotes, code blocks — and typesets each element with real formatting onto fixed, paginated PDF pages. This tool runs the whole pipeline in your browser: paste or open a .md file and download the formatted PDF, with nothing uploaded to any server.
How it works
Markdown is a line-oriented format, and the converter's first pass exploits that: it walks the text line by line and classifies each into a block type. A line starting with one to six # characters is a heading of that level; -, * or a number-and-dot prefix opens a list item; > opens a blockquote; a triple-backtick fence switches into a code block, where classification is suspended until the closing fence; everything else accumulates into paragraphs, with blank lines as separators.
A second pass cleans each block's inline content. This renderer takes a deliberately conservative approach to inline syntax: markers for bold (**), italic (* or _) and links ([text](url)) are stripped rather than styled — the words remain, the asterisks and URLs disappear, and the text is set in the block's regular font. That trades inline styling away for a guarantee that raw syntax never leaks into the output. Extended syntax such as tables, footnotes or task-list checkboxes is not interpreted and comes through as ordinary text.
Typesetting then assigns each block its visual role: headings get larger bold type with extra space above, mirroring how a stylesheet would treat h1–h3; list items are indented behind a bullet or number; blockquotes are inset from the margin; code blocks switch to a monospaced font with every space and blank line preserved. As blocks are placed down the page, the layout engine tracks the remaining height and starts a new page when a block will not fit — pagination that Markdown itself, being pageless, knows nothing about. The finished pages are written with pdf-lib as real text operators, so the PDF stays small, selectable and searchable.
Worked example: converting a project README
Input: a 9 KB README.md of 214 lines — one # title, six ## sections, 32 bullet points, three fenced code blocks totalling 41 lines, and 17 inline links. Conversion was effectively instant and produced a 4-page, 19 KB PDF.
Reading the output against the source: the title and section headings came out in progressively sized bold type, the installation commands sat in monospace with their indentation intact, and the bullets aligned cleanly with hanging indents. The 17 links appeared as their visible text only — "the documentation" rather than a URL — which is exactly the stripping behavior described above; for the two links readers genuinely needed, the fix was writing the bare URL into the sentence before converting. A page break initially split the second code block; inserting one blank line above the fence moved the whole block to page 3. Compare that with the same README pushed through plain text to PDF: 6 pages of uniform type with every # and ** visible — structure is what this converter adds.
Frequently asked questions
Which Markdown features does this converter support?
Headings, ordered and unordered lists, blockquotes and fenced code blocks are rendered with distinct formatting. Inline bold, italic and link syntax is cleaned to plain text, and extended features like tables or footnotes are not interpreted.
Is my Markdown sent to a server to be converted?
No. Parsing and PDF generation both run as JavaScript in your browser tab, so the text never leaves your device. The download link points at a file assembled in memory locally.
Why does bold text appear without asterisks but not in bold?
The renderer strips inline markers such as asterisks, underscores and link brackets so the raw syntax never shows in the output, but it typesets the affected words in the regular font. Block-level structure like headings and code blocks is where this tool applies visual formatting.
What happens to hyperlinks in my Markdown?
A link written as text in square brackets followed by a URL in parentheses is reduced to its visible text, and the URL is dropped rather than kept as a clickable annotation. If a reader must be able to follow the address, write the URL out in the text itself.
Are code blocks kept exactly as written?
Yes. Everything between triple-backtick fences is set in a monospaced font with indentation and blank lines preserved, and no Markdown rules are applied inside it. Syntax highlighting is not added.
Can I convert a README.md file from a project?
Yes, open or paste the file and typical READMEs convert well, since they lean on headings, lists and code blocks. Badges, HTML snippets and tables will come through as plain text rather than rendered elements.