HTML to PDF
Paste HTML or open an .html file, preview it at its printed width with page breaks marked, pick the page size and margins, and save a crisp PDF with selectable text — without uploading anything.
At a glance
- Turns HTML code or an .html file into a PDF using your browser’s own print engine, so text stays selectable and searchable and links stay clickable.
- Works with a full page (with its own
<style>) or a fragment such as<h1>Hello</h1>, which gets clean default styling. - Page sizes A4, Letter, Legal, A3 and A5, portrait or landscape, with none, narrow, normal or wide margins.
- A live preview shows the page at its printed width, with dashed lines where the page breaks will fall.
- Keeps background colours, and can stop images, table rows and code blocks being cut in half across pages.
- JavaScript in the HTML is not run, for safety: pages that build their content with scripts need to be saved from the browser instead.
- The HTML never leaves your device — nothing is uploaded to a server.
Step by step
How to convert HTML to PDF
- 1
Add your HTML
Paste HTML into the editor, click Open file to load an .html file, or try the Sample invoice.
- 2
Set up the page
Choose the page size, orientation and margins, and check the preview and its page-break lines.
- 3
Save as PDF
Click Save as PDF. In the print window, set the destination to Save as PDF and turn off Headers and footers.
- 4
Download
Click Save and choose where to keep the PDF. Its name is taken from the file name box or the page’s title.
Features
Everything you need, nothing you don’t
Real text, not a screenshot
The PDF is made by the browser’s print engine, so text is sharp at any zoom, can be searched and copied, and links work.
See page breaks first
The preview is drawn at the exact paper width and marks where each new page starts, so you can fix the layout before saving.
Invoices and templates
Ideal for HTML invoices, receipts, email templates, reports and resumes. Try the sample invoice to see how it works.
Clean page breaks
Images, table rows and code blocks move to the next page instead of being sliced across two.
Your page setup wins
The page size and margins you choose here override any @page rules in the HTML, so the PDF comes out as you expect.
Private and safe
Everything happens in your browser, and scripts in the HTML are blocked so pasted code can’t do anything unexpected.
Getting a perfect PDF
Use absolute links for images and styles. A relative link like images/logo.png only works if you set the Base URL to the site the HTML came from, for example https://example.com/. Images embedded as data: URLs always work.
Turn off headers and footers in the print window (under *More settings* in Chrome and Edge) to remove the date, title and page URL printed at the edges.
Force a new page anywhere by adding <div style="break-before: page"></div> to the HTML. Headings are kept with the paragraph that follows them.
For the most faithful result, use Chrome or Edge on a computer — they follow the page size and margins exactly. Other browsers work too but may ignore some print settings.
Which page size to choose
| Page size | Dimensions | Typical use |
|---|---|---|
| A4 | 210 × 297 mm | India, Europe and most of the world |
| Letter | 8.5 × 11 in (216 × 279 mm) | USA and Canada |
| Legal | 8.5 × 14 in (216 × 356 mm) | US legal documents and contracts |
| A3 | 297 × 420 mm | Posters, wide tables and diagrams |
| A5 | 148 × 210 mm | Booklets, receipts and small notices |
FAQ
Frequently asked questions
Is the text in the PDF selectable?
Why doesn’t my JavaScript run?
Can I convert a website URL to PDF?
Why are my images missing?
https:// addresses. Images on your computer must be embedded as data URLs.How do I remove the date and URL at the top and bottom?
Does it work on a phone?
Keep going
Related tools
Images to PDF
Convert JPG, PNG and other images to one PDF. Reorder and rotate pages, choose A4 or Letter, margins and quality — free, private and with no upload.
Merge PDF
Merge PDF files online for free. Combine PDFs in any order, pick exact pages from each and download one file — processed in your browser with no upload.
Compress PDF
Compress PDF files in your browser: shrink scans and image-heavy PDFs, or hit a target like 200 KB. Text stays sharp and selectable — free, private, no upload.
PDF Watermark
Add a text or logo watermark to a PDF: CONFIDENTIAL, DRAFT or “For KYC only” stamps with your own size, angle and opacity. Free, private, no upload.
PDF Password Remover
Remove the password from PDFs you can open. Unlock AES and RC4 protected PDFs and lift print and copy restrictions — free, in your browser, no upload.
Split PDF
Split a PDF into several files by page ranges, every N pages or one file per page, or extract just the pages you need. Free, private, no upload.
Last updated Report a problem or suggest a feature