Markdown to PDF Converter

Turn a Markdown file into a properly typeset PDF. Headings come out larger and bold, lists stay indented, code blocks keep their spacing in a fixed width face, and everything paginates on real heights rather than a fixed number of lines. Nothing is uploaded.

  • Nothing uploaded
  • Works with no signal
  • No sign up
  • Searchable output
Drop a Markdown file here or click to choose one. Files ending .md, .markdown or .txt. Nothing is changed until you press the button.

or paste it in

Nothing loaded yet.

Preview

Showing how the blocks fall onto the page.

Add some Markdown to see the pages.
heading paragraph list item code quote

Text goes in as real text, so the finished PDF stays searchable. Links become their label text, because a printed page cannot hold a clickable address.

Your document never leaves this device.The file is read by your browser, the PDF is built here in the page, and the download comes from your own machine. Nothing is sent to a server, so nothing is stored on one. Open the network tab in your browser tools and convert something: there is no upload request to see.

1Drop the Markdown inIt never leaves your machine.
2Set the body sizeEverything updates as you change it.
3Build and downloadAssembled here and saved from your own browser.

Headings are not the same height as text

A heading occupies about two and a half times a body line, so there is no fixed number of lines per page. Pagination measures real heights in points instead of counting.

How to use this tool

Drop a Markdown file on the box at the top or paste straight into the panel underneath. The preview and the page count appear immediately.

Set the body size and the page. Everything else scales from the body size, so that one setting moves the whole document.

The preview shows each line as a bar at its real width and position, coloured by what kind of block it belongs to, so you can see where headings land and where pages break.

Why counting lines stops working

A plain text document is easy to paginate. Every line is the same height, so you divide the page height by the line height and you know how many lines fit. That number never changes.

Markdown breaks that immediately. A first level heading is set at nearly twice the body size and carries space above and below it. A code block is smaller and indented. A quote is indented too. Suddenly a page might hold forty lines of prose, or twelve headings, or some mixture, and there is no single number that describes it.

One A4 page holding 36 body paragraphs beside the same page holding only 14 level one headings
Same page and settings. Only the kind of content differs, and capacity changes two and a half times.

So pagination here measures height in points rather than counting lines. Each block is given its real height, including the space around it, and blocks are placed until the next one would not fit. That is the whole difference between this and the plain text converter, and it is why the two exist separately.

One consequence worth knowing: headings, list items and quotes are kept whole. If a heading will not fit in the space left at the bottom of a page it moves to the next page rather than being stranded there with its text overleaf. Paragraphs and code blocks do flow across pages, because they can be arbitrarily long and holding them back would waste half a sheet.

What is kept and what is dropped

Headings keep their level, and their size follows from it. Lists keep their markers and their nesting, so a nested bullet sits further in than its parent. Block quotes are indented and set in italic. Horizontal rules are drawn as actual lines. Fenced code is set in a fixed width face and its content is passed through untouched, so a hash inside a code block stays a hash rather than becoming a heading.

Inline emphasis is a deliberate simplification. Bold, italic, inline code and link syntax are stripped so the words read cleanly, but a bold word inside a paragraph is not re-bolded in the output. Doing that properly means measuring and drawing each run of a line separately, which is a considerably larger piece of work than it sounds, and the result without it is a clean readable document rather than a broken one.

Links become their label text. An image becomes its alt text rather than the picture, because fetching the image would mean a network request, and the promise on this page is that nothing leaves your machine.

A worked check you can repeat

At an 11 point body size, a first level heading comes out at 11 times 1.9, which is 20.9 points, with 12.5 points of space above it and 6.3 below. At 1.45 line spacing its single line occupies 30.3 points, so the whole heading block is 49.1 points tall.

A body paragraph of one line at the same settings occupies 11 times 1.45, which is 15.95 points, plus 3.85 points of space after it, so 19.8 in total. The heading is about two and a half times the height of a body line, which is exactly why counting lines gives the wrong answer.

On A4 with a 20 mm margin the usable height is 728.5 points. Fill it with body paragraphs and you get about 36 of them; fill it with first level headings and you get about 14.

The parsing and layout were checked against an independent implementation before publishing: thirty nine hand written cases covering heading levels, seven hashes not being a heading, a hash without a space not being a heading, nested list depth, fenced code containing text that looks like Markdown, unterminated fences, and every inline form. Then thirty thousand generated cases confirming that no page ever exceeds its height and that no content is ever dropped. That fuzzing found two real defects in the pagination, both fixed before this went up.

Mistakes that catch people out

Expecting bold words to stay bold. Inline emphasis is stripped rather than rendered. Headings are bold, individual words within a paragraph are not.

Expecting images to appear. An image becomes its alt text. Fetching it would mean a network request, which would break the promise that nothing leaves your machine.

Raising the body size a little and getting many more pages. Headings scale with it, so the effect compounds through a document with a lot of structure.

Forgetting to close a code fence. Everything after an unclosed fence is treated as code. The block count in the summary will look wrong, which is the quickest way to spot it.

Using a tiny page with a large body size. If a single heading cannot fit on a page, the tool says so rather than producing something broken.

Common questions

Is my Markdown uploaded anywhere?

No. The file is read by your browser, the PDF is built here on the page, and the download comes from your machine. Nothing crosses the network, so there is nothing on a server to store or delete.

Which Markdown does it understand?

Headings from one to six hashes, bullet and numbered lists including nesting, block quotes, horizontal rules, fenced code blocks, and inline bold, italic, code, links and images.

What happens to links?

They become their label text. A printed page cannot hold a clickable address, so the words survive and the address does not.

Does code keep its formatting?

Yes. Fenced code is set in a fixed width face and its lines are used exactly as written, so indentation survives and nothing inside a code block is treated as Markdown.

Why did the page count jump when I changed the body size?

Because headings are sized relative to the body. A first level heading is nearly twice the body size, so raising the body size raises every heading with it and the document grows faster than you might expect.

Will the text stay searchable?

Yes. Everything goes in as real text rather than as a picture, so the finished PDF can be searched, selected and copied from.

Related PDF tools and reference

Reference: The CommonMark specification, which defines the Markdown syntax handled here.