Convert HTML to PDF right in your browser
The HTML to PDF converter turns HTML code into a paginated PDF document. Paste a complete page or a fragment — an invoice template, a newsletter, a report exported from another app — or open an .html file, and see it rendered at the exact width of your chosen paper before you make the PDF.
There are two ways out. Print to PDF hands the document to your browser’s own print engine for the best result: selectable vector text, working links and proper page breaks. Download PDF (image) builds the file right here with no dialog, by capturing the rendered page and cutting it into pages.
Your HTML is never uploaded. It is rendered in a sandboxed frame on your own device with scripts switched off, so even code from an unknown source can’t reach this page or your data.
How to convert HTML to PDF
- Paste your HTML into the HTML code box, press Open .html file, or drop a file onto the box. Press Sample to try it with an invoice.
- Choose the Page size, orientation and margins; the preview redraws as a sheet of that paper.
- Pick a Layout width: “Fit to page width”, or 768–1280 px to render a wider layout scaled down to fit.
- Keep or drop Background graphics, and if the HTML uses relative image paths, enter the site’s address as the Base URL.
- Press Print to PDF and choose “Save as PDF” in the dialog, or press Download PDF (image) to save the file straight away.
HTML to PDF features
True page-width preview
The preview is exactly as wide as the printable area of your paper, so text and tables wrap as they will in the PDF.
Selectable text through print
The print route uses the browser’s PDF engine: real fonts, selectable text, clickable links and CSS page-break rules.
One-click image PDF
html2canvas renders the page and jsPDF slices it into pages, moving each cut up to the nearest blank row so lines of text are not sliced in half.
Paper, margins and backgrounds
Five paper sizes, portrait or landscape, four margin presets, and a switch that keeps or drops backgrounds in both outputs.
Safe rendering
Scripts, inline event handlers and javascript: links are removed, and the frame is sandboxed with forms, pop-ups and navigation blocked.
Print to PDF or image PDF — which should you use?
Print documents people will read, search or copy from; use the image download for a quick, faithful snapshot or when your print dialog has no PDF option.
| Print to PDF | Download PDF (image) | |
|---|---|---|
| Text | Selectable, searchable, copyable | Part of a picture — not selectable |
| Links | Clickable | Not clickable |
| Sharpness | Vector — sharp at any zoom | About 190 dpi at page width: crisp on screen and on paper at normal size |
| File size | Usually small | Larger, roughly 100–400 KB per page |
| Page breaks | Follows all CSS break rules | Follows forced breaks, otherwise cuts at a blank row near the page end |
Saving a PDF from the print dialog
- Chrome and Edge: set Destination to “Save as PDF”, open More settings, untick “Headers and footers” and press Save. The page size and margins you chose here are already applied.
- Firefox: choose “Save to PDF” as the printer, untick “Print headers and footers”, then Save.
- Safari on Mac: open the PDF menu in the bottom corner of the dialog and choose “Save as PDF”.
- Backgrounds missing? Keep “Background graphics” ticked here; the browser then prints backgrounds even if the dialog’s own option is off.
What about converting a web page from its URL?
This tool converts HTML you paste or open. For a live page, use URL to PDF, which saves a page as it looks, or Webpage to PDF, which keeps only the article as a clean, readable PDF. Browsers stop one website from reading another website’s pages (the same-origin policy), so those two tools fetch the public page through our server; nothing of yours is sent with it.
For a page behind a login, or one built by JavaScript, print it from your own browser instead. Open the page and press Ctrl+P (⌘+P on a Mac), then choose “Save as PDF”. On Android, open Chrome’s ⋮ menu → Share → Print and pick “Save as PDF”. On iPhone and iPad, tap Share → Print, then spread two fingers on the page preview to open it as a PDF you can save to Files. To tidy a page first, save it with “Save page as”, open the .html file here and enter the site as the Base URL so its images still load.
Tips for better results
- Force a new page with
<div style="break-before: page"></div>— both outputs honour it. Keep rows and figures together withbreak-inside: avoid. - Pages built by JavaScript, such as charts or single-page apps, come out empty because scripts are switched off. Print those from their own site.
- Combine the result with other files using Merge PDF and shrink image PDFs with Compress PDF. Writing in Markdown? Try Markdown to PDF; for plain text, Text to PDF.
HTML to PDF FAQ
How do I convert HTML to PDF for free?
Paste your HTML or open an .html file, choose the paper size and margins, then press “Print to PDF” and pick “Save as PDF” in the dialog — or press “Download PDF (image)” to get the file directly. There is no sign-up, watermark or limit.
Can I convert a website URL to PDF here?
This page works with HTML you paste or open. For a web address, use URL to PDF (the page as it looks) or Webpage to PDF (just the article). Pages behind a login are best printed from your own browser (Ctrl+P or ⌘P → Save as PDF); the steps for phones are above.
Why is the text in my downloaded PDF not selectable?
“Download PDF (image)” stores each page as a picture of the rendered HTML. For selectable, searchable text and clickable links, use “Print to PDF”, which uses the browser’s own PDF engine.
Does JavaScript in my HTML run?
No. Scripts and inline event handlers are removed and the frame is sandboxed, so content that only appears after scripts run won’t be in the PDF.
Why are some images missing?
Relative paths such as images/logo.png have nowhere to load from when HTML is pasted, so enter the site’s address in “Base URL”. In the image download, images from other sites appear only if their server allows cross-origin use; data URIs always work.
How do I remove the date and address printed at the top and bottom?
Those are the browser’s print headers and footers. In Chrome or Edge open “More settings” and untick “Headers and footers”; in Firefox untick “Print headers and footers”. Choosing “None” for margins also removes them, because there is no room to print them.