MarkPrep
All posts
2026-10-13 · 6 min

How to Convert Markdown to PDF (With Real, Selectable Text)

Any web browser can convert a Markdown file to PDF, with nothing to install. Paste the Markdown into a browser-based converter, check the formatted preview, then print it and pick "Save as PDF" as the printer.

Your browser's print engine writes the PDF from formatted text, so the words in the file stay real text. You can select them, search them and copy them out. A screenshot pasted into a PDF gives you none of that. The steps below use MarkPrep's Markdown to PDF converter, which runs in the browser tab.

How to convert a Markdown file to PDF in your browser

  1. Open the Markdown. Load the .md file into a text editor such as Notepad or TextEdit, select everything and copy it.
  2. Paste it into the converter. On the Markdown to PDF page, replace the sample text in the Markdown box with your own.
  3. Read the preview. The Preview panel shows the formatted document as you type: headings, lists, links, code and tables.
  4. Click Print to PDF. A new tab opens with the formatted document, and your browser's print dialog appears.
  5. Pick the PDF printer. In the print dialog, pick Save as PDF (or your system's PDF printer) as the destination. Set the paper size and margins there too.
  6. Save the file. Give it a name and save it.

The same steps convert a Markdown document to PDF when the Markdown comes from a chat or a note instead of a file. Skip the text editor and copy the text straight from there.

If nothing opens at step 4, your browser may be blocking pop-ups for the site. Allow them and click again.

MarkPrep turns the Markdown into formatted HTML on your computer, and nothing is uploaded at any point. If you are writing a document from scratch, use the Markdown editor instead. It has the same Print to PDF button, plus downloads for Word and HTML.

Why the text in the PDF stays selectable

A PDF can hold either text or pictures of text. When you print a web page to PDF, the browser writes the words as text with their fonts and positions.

You can search a long PDF with Ctrl+F or Cmd+F and copy a paragraph into an email. Another tool that reads the PDF gets the words cleanly too. A PDF made from screenshots needs OCR before any of that works, and OCR can misread characters.

To check your own PDF, open it and try to select a sentence. If it highlights word by word, the text layer is there. If nothing highlights, the PDF holds a picture of the text instead. Make it again from the Markdown with one of the routes in this guide.

What to check before you save the PDF

The preview is close to the printed result, but a few things behave differently on paper.

  • Page breaks. The print engine decides where pages break, as it would for any web page. A long table or code block can split across two pages, so look through the print preview before you save.
  • Margins and paper size. These come from the print dialog. Choose A4 or Letter and adjust the margins there.
  • Images. An image shows only if its address is a full web link (https://...). A relative path such as images/chart.png has nothing to point to in the print tab, so the image is missing.
  • Diagrams and code colours. This export prints Mermaid diagram code as a plain code block, and code has no syntax colours. Code sits on a light grey background in a fixed-width font.
  • Tables. Tables print with a thin border on every cell. The text in each cell wraps to fit the page width, so a table with many columns gets cramped.

Can Claude convert Markdown to PDF?

Yes. Claude can create files you download, including PDFs. Anthropic's help centre lists file creation on every Claude plan, on the web, Claude Desktop and the mobile apps. If it is switched off, turn on Code execution and file creation under Settings, then Capabilities. On Team and Enterprise plans, an organisation owner can switch it off for everyone.

To use it, paste your Markdown or attach the .md file, and ask Claude to turn it into a PDF. Claude writes and runs code to build the file, then gives you a download. Your document goes to Anthropic's servers as part of the chat, which may not suit confidential text. The layout also depends on the code Claude writes, so ask for the paper size, fonts and margins you want.

For a document you would rather keep on your own computer, the browser route above is the simpler choice. It also gives you the same layout every time, because the styling is fixed.

How to convert Markdown to PDF with Pandoc

Pandoc is a free command-line converter. It suits people who convert many files, or who want the same settings every time. To save Markdown as PDF with it, name an output file that ends in .pdf:

pandoc notes.md -o notes.pdf

By default Pandoc builds the PDF with LaTeX, so a LaTeX engine has to be installed first. If you don't want LaTeX, choose another engine with the --pdf-engine option. Pandoc's manual lists weasyprint, wkhtmltopdf, typst and others. Each one needs its own install.

Pandoc gives you control over templates, fonts and page layout, and you can run it on a whole folder with a script. The cost is the setup. You install Pandoc, then a PDF engine, before the first file comes out.

Which way to convert MD to PDF should you use?

Situation Best route Why
One document, now, nothing to install Browser converter, then Save as PDF Selectable text, nothing installed; the file stays on your computer
You are already writing in a Claude chat Ask Claude for a PDF It builds the file in the chat
Many files, or a fixed house style Pandoc Repeatable settings and templates, run from a script

You can convert Markdown to PDF for free on every route in the table. The browser converter and Pandoc cost nothing, and Claude's file creation is on its free plan too.

If your next step goes the other way, MarkPrep's PDF to Markdown converter turns a PDF back into Markdown. For an editable document instead of a fixed one, convert the Markdown to Word to get a real .docx with Word heading styles.

Try it on your own file

Convert a document and watch the token counter. It's free, needs no account and uploads nothing.