HTML to PDF converter

Paste HTML or open a file, check the rendered preview, and save it as a PDF — the conversion happens in your browser, so nothing leaves your machine.

Opens your browser's print dialog — pick "Save as PDF" as the destination. Nothing is uploaded.

Rendered preview (this is what prints)

Paste HTML or open a .html file to see the rendered page here.

The browser is the converter

Browsers already contain an excellent HTML-to-PDF engine: the one behind the print dialog. This tool leans on it. Paste HTML (or open a .html file), check the rendered preview, and hit save — the print dialog opens for exactly that preview, and choosing "Save as PDF" as the destination writes the file. Because the browser does the whole job, nothing is uploaded and there are no file-size limits beyond your machine's.

The preview frame is sandboxed: your HTML can use any CSS it wants, but scripts don't run. That keeps pasting arbitrary HTML safe and makes the output deterministic — the PDF is the markup and styles, not whatever JavaScript would have done.

CSS that makes better PDFs

  • Set the paper size in the document itself: @page { size: a4; margin: 20mm } (or letter, or a5 landscape). The print dialog respects it.
  • Control where pages split with break-before, break-after, and break-inside: avoid — the last one keeps tables and figures from being cut in half.
  • Backgrounds are dropped by default when printing; either enable "Background graphics" in the dialog or add print-color-adjust: exact to the elements that need their color.
  • Use pt, mm, or cm for print dimensions — they mean the same thing on paper everywhere, unlike px.
  • A media="print" stylesheet (or @media print block) can hide navigation and buttons so only the content ends up in the PDF.

Frequently asked questions

How does the HTML to PDF conversion work?

Your HTML renders in an isolated frame right on this page, and the save button opens your browser's print dialog for that frame. Choose "Save as PDF" as the destination and the browser's own print engine produces the PDF — the same one that prints web pages every day.

Is my HTML uploaded to a server?

No. The HTML never leaves your browser: rendering, the print dialog, and the PDF file are all produced locally by the browser itself. That's also why the tool works offline once the page is loaded.

Why don't I see "Save as PDF" in the dialog?

Look at the destination (or printer) dropdown in the print dialog — every major browser lists a "Save as PDF" entry alongside real printers. On macOS it can also live behind the PDF button in the system print dialog.

Can I control the page size and margins?

Yes, with the @page CSS rule inside your HTML — for example @page { size: a4; margin: 20mm }. The print dialog also has its own paper-size and margin settings which apply on top.

Why does my PDF look different from my website?

External stylesheets and images load only if their URLs are absolute and reachable, and print media queries kick in during PDF generation. For faithful output, inline your critical CSS and check the preview here first — what the preview shows is what prints.

Will JavaScript in my HTML run?

No — the preview frame is sandboxed without script permission, so pasted HTML renders but never executes code. If your page needs JavaScript to build its content, paste the rendered HTML (from the browser's "Inspect" or "Save page" output) instead.

Related free tools

See all free tools →

Built something? Put it online in seconds

host0 is the cloud for small software: bring any coding agent, build the tool only you need — like this one — and say "deploy to host0". Live at a shareable URL, no servers to run.