Three ways to turn a .md file into a clean, shareable PDF — from a free browser tool to command-line options.
Markdown is great for writing — it's plain text, version-controllable, and renders everywhere. But when you need to share a document with someone outside a technical context, or attach it to an email, PDF is the universal format. PDF preserves your formatting exactly, works offline, and doesn't require the reader to have any markdown renderer installed.
Choose based on your needs — no-install browser tools, browser print, or command line.
The fastest way. Open markdownutils.com/pdf, paste your markdown, choose a theme, and export. Everything runs in your browser — nothing is uploaded to a server.
Step by step
.md file from your computer.If you're already viewing rendered markdown — on GitHub, VS Code preview, or any other renderer — you can print it to PDF using your browser's built-in print function.
Quality varies depending on the renderer's CSS. GitHub's markdown renderer produces clean PDFs. Raw .md files opened directly in a browser won't render — you need a viewer first.
Pandoc is the most powerful option — a universal document converter that can turn markdown into PDF, Word, HTML, ePub, and more. Requires installation and a LaTeX engine for PDF output.
Install Pandoc:
# macOS (Homebrew) brew install pandoc brew install --cask basictex # Ubuntu / Debian sudo apt-get install pandoc texlive # Windows (Chocolatey) choco install pandoc miktex
Convert a markdown file:
# Basic conversion pandoc README.md -o output.pdf # With custom margins and font size pandoc README.md -o output.pdf \ -V geometry:margin=1in \ -V fontsize=12pt # With a custom template pandoc README.md -o output.pdf --template=mytemplate.tex
Pandoc gives you full control over the output, but requires a working LaTeX installation which can be complex to set up. For most use cases, the browser-based approach is faster.
Markdown Utils supports 5 themes, 13 font families, and 3 style controls — all reflected live in the preview before you export.
Light
Clean white background, slate headings, blue links and blockquotes. The default — works for any document type and prints cleanly on standard paper.
Best for: Reports, documentation, general use
Dark
Near-black (#0a0a0a) background with slate body text, indigo accents, and cyan inline code. Ideal for code-heavy documents or sharing in developer contexts.
Best for: Technical docs, code references, developer audiences
Sepia
Warm cream background (#f5f3ed), Georgia serif body font, warm brown borders. Code blocks use a high-contrast black-on-white style. Great for long-form reading.
Best for: Long documents, essays, documentation meant to be read carefully
Minimal
Pure black on white with no decorative color — borders, blockquotes, and table headers all in black. Helvetica Neue body font. Closest to a printed book or academic paper.
Best for: Academic papers, formal reports, print-first documents
Ocean
Deep navy background (#0d1b2a), muted blue body text, teal accents and links. A dark theme with a distinct nautical palette — more atmosphere than the Dark theme.
Best for: Portfolio documents, creative technical writing, developer showcases
Each theme ships with a matched highlight.js code theme — syntax colours are chosen to complement the document palette rather than clash with it. Highlighting is applied in both the live preview and the exported PDF.
| Theme | Code highlight theme |
|---|---|
| Light | GitHub |
| Dark | GitHub Dark |
| Sepia | a11y-light |
| Minimal | Stack Overflow Light |
| Ocean | Nord |
Specify the language after the opening triple-backtick (e.g. ```python) to activate highlighting.
Nine fonts covering the main use cases — system fonts load instantly, Google Fonts load on-demand and embed in the PDF.
| Font | Type | Best for |
|---|---|---|
| System Sans | Sans-serif · System | Default — native OS font, no loading delay, crisp at any size |
| Inter | Sans-serif · Google | Technical docs, SaaS documentation, screen-first content |
| Roboto | Sans-serif · Google | General documents, clean and neutral |
| Open Sans | Sans-serif · Google | Dense body-heavy content, accessible writing |
| Lato | Sans-serif · Google | Business reports, professional presentations |
| Georgia | Serif · System | Long-form reading, essays, print-first documents |
| Merriweather | Serif · Google | Long technical writing, screen-first long-form content |
| Playfair Display | Serif · Google | Proposals, covers, portfolio documents |
| JetBrains Mono | Monospace · Google | Developer docs, code-first documents |
Font size
Range: 10px – 20px
Default: 14px
Controls the base font size for body text. Headings scale proportionally. Use 12–13px for dense technical documents, 15–16px for comfortable reading, 18–20px for presentations.
Line spacing
Range: 1.2 – 2.5
Default: 1.75
The line-height multiplier. 1.4–1.6 is tight and compact, 1.7–1.9 is comfortable for reading, 2.0+ is airy and open. The default (1.75) balances density with readability.
Margins
Range: None / Narrow / Normal / Wide
Default: Normal
Controls the padding around the document content. Normal (50px top/bottom, 60px sides) suits most documents. Narrow saves space for dense content. Wide adds breathing room for clean reports. None is minimal padding for full-bleed layouts.
Beyond standard markdown, the PDF exporter supports two powerful extensions — both render in the live preview and are fully exported to PDF.
Use a fenced code block tagged mermaid. Diagrams are theme-aware — colours automatically match your selected PDF theme (indigo for Light, violet for Dark, teal for Ocean, etc.):
Write LaTeX math inside $...$ for inline or $$...$$ for block display. KaTeX renders them as crisp vector math — perfect for technical and scientific documents:
Yes — the Markdown Utils converter is completely free with no limits, no sign-up, and no watermarks on the output.
No. Everything runs in your browser. Your content never leaves your computer.
Yes. Click the Upload button in the toolbar to load any .md or .txt file directly into the editor.
Browsers add default margins when printing. The Export PDF button removes these automatically using @page { margin: 0 } and adds clean content padding instead.
Yes. Specify the language after the opening ``` (e.g. ```python) and the PDF will include syntax-highlighted code blocks.
Yes. The font dropdown includes system fonts and Google Fonts like Inter, Merriweather, Playfair Display, JetBrains Mono, and more.
📄
Free, instant, no sign-up. Upload your file or paste markdown and export in seconds.