SWISSARMY/PDF All tools
Convert

HTML to PDF

Convert HTML to PDF online

Convert any chunk of HTML into a styled PDF. Paste markup, upload a file, or fetch a URL — preview, adjust paper size, then download.

Drop an .html file
or paste HTML below
HTML

Opens your browser's Print dialog. Choose Save as PDF as the destination — that's how we generate a real PDF without ever uploading your content.

HOW IT WORKS

How to html to pdf

  1. 01

    Paste your HTML or upload a file.

  2. 02

    Pick a page size.

  3. 03

    Click Save as PDF.

FAQ

Frequently asked

What CSS is supported? +
Most modern CSS is supported via the browser's own renderer.
Can I include external images? +
Yes, but only over HTTPS — and your browser must be able to load them.
Privacy? +
Files never leave your browser — everything happens locally on your device.
GUIDE

Convert HTML to PDF — free, in your browser, no signup

Updated

TL;DR

HTML to PDF means different things to different people: print a webpage, convert email markup to PDF, render a styled document. SwissArmyPDF uses the browser's own print engine for lossless rendering — CSS, web fonts, tables, all preserved. Drop HTML or paste it, click Save as PDF.

When you need HTML → PDF

  • Email content archive. Save an HTML email as PDF for record-keeping.
  • Custom invoice or receipt. Generate HTML from your billing system, render to PDF, attach to email.
  • Report generation. Build a styled HTML report (chart libraries, custom CSS), export to PDF.
  • Documentation snapshots. Save a doc page at a point in time.
  • Editorial proof. Convert draft HTML to PDF for review.
  • Static site export. Print specific pages from a static site for offline reading.

How to convert HTML to PDF (step by step)

  1. Open HTML to PDF.
  2. Drop an .html file or paste HTML directly into the editor.
  3. Pick a page size (A4 or Letter).
  4. Click Save as PDF. Your browser's print dialog opens.
  5. Choose Save as PDF as the destination.

The print engine renders the HTML with the browser's full CSS support — exactly what you'd see in a browser tab, but paginated.

What CSS works

Because we use the browser's native print engine, you get everything the browser supports:

  • Flexbox, Grid, Position. All modern layout primitives.
  • Web fonts. @font-face works; fonts load before printing.
  • Backgrounds and gradients. Browser may have a "background graphics" toggle in the print dialog — enable for full color.
  • Print-specific CSS. @media print rules apply. Use page-break-before / page-break-after for explicit pagination control.
  • @page rules. Set page size, margins, and headers/footers per CSS spec.

Caveats:

  • External resources need HTTPS. Images, fonts, and stylesheets must be HTTPS-reachable; mixed-content blocking will skip HTTP assets.
  • JavaScript runs once before print. Heavy SPAs that fetch async data may not finish rendering before the print dialog opens.
  • iframe content may not render depending on the source's CORS policy.

Controlling page breaks

By default, the browser paginates wherever it lands. To force breaks:

  • Page break before an element: <div style="page-break-before: always"></div>
  • Keep an element on one page: page-break-inside: avoid
  • Break after: page-break-after: always

For headers/footers on every page, use the @page CSS at-rule with margin boxes — though browser support varies.

Browser-print vs server-side HTML→PDF (Puppeteer, wkhtmltopdf)

ApproachStrengthWeakness
Browser-print (this tool)Free, no setup, lossless rendering, no uploadManual click in print dialog; not batchable
Puppeteer / PlaywrightScriptable, batchable, headlessRequires Node.js + Chromium install
wkhtmltopdfCLI, batchable, simple deployOlder WebKit fork; some modern CSS missing
weasyprintPure CSS-spec compliance for printDoesn't run JS; CSS subset different from browsers

For one-off conversions, the browser tool is fastest. For automation (1000 invoices/day), Puppeteer is the right answer.

Troubleshooting

  • Popup blocked. Allow popups for swissarmypdf.com.
  • Images missing. External images need HTTPS. Local file paths and HTTP-only URLs are blocked.
  • Background colors missing. In the print dialog, enable "Background graphics" (Chrome) or "Print backgrounds" (Firefox).
  • Layout breaks in print. Some CSS layouts that work on screen break at page boundaries. Use page-break-inside: avoid on elements you want to keep together.
  • Web fonts didn't load. The print dialog can fire before async font loads finish. Wait a moment and retry.

Why local HTML-to-PDF matters

HTML files often contain things you don't want online: internal report markup, draft content, email contents, customer data. Web-based converters upload your HTML to a remote server and render it there — your content briefly lives on someone else's disk. SwissArmyPDF uses your browser's own print engine; the HTML is rendered in a popup window in your browser, then your browser saves the PDF. No upload, no remote rendering.

Common next steps

RELATED

More convert tools