How to convert HTML to PDF
- 1 Paste your HTML in the box, or press Open .html file. An example is loaded to start.
- 2 Check the live preview on the right.
- 3 Choose the page size, orientation and margins.
- 4 Press Download PDF, or Print or save as PDF for full CSS styling.
Download or print?
Use Download PDF for simple documents and the print option for styled pages. To go the other way, use PDF to HTML; for plain text documents, Text to PDF is simpler.
- Inline styles work in the quick download.
- Use print for flexbox and grid layouts.
- Images from other sites may be blocked.
Features
Live preview
See the page as you edit the code.
Two ways to save
Quick PDF download, or browser print with full styling.
Safe
Scripts are not run, and nothing is uploaded.
When to use it
Invoices and receipts from code
Turn HTML invoice templates into PDFs for customers. To protect them, use Protect PDF.
Email newsletters
Save an HTML email as a PDF for records or approval.
Developer testing
Check how HTML content looks as a printed document. To turn a PDF back into HTML, use PDF to HTML.
Saving web content
Paste the HTML of a page you wrote to keep a PDF copy. To combine several, use Merge PDF.
Related PDF tasks
Frequently asked questions
What is the difference between Download PDF and Print?
Download PDF builds the PDF in the tool from the HTML structure: headings, paragraphs, lists, tables, images and simple inline styles. Print uses your browser's engine, which understands full CSS, then you choose Save as PDF in the print window.
Can I convert a website by its URL?
No. Browsers block one website from reading another for security, so a URL cannot be fetched here. Open the page, view or copy its HTML, and paste it in, or print the page from your browser directly.
Is CSS supported?
Download PDF supports inline styles such as colour, font size, bold and alignment. Style sheets, flexbox and grid layouts need the print option.
Do images work?
Images embedded as data or loaded from sites that allow it are included. Images that other websites block are left out, and the tool tells you how many.
Does JavaScript run?
No. Scripts are removed and never run, which keeps the page safe and means the PDF shows the HTML as written.
Is the text in the PDF selectable?
Yes, with both options the PDF contains real text that can be selected and searched.
Which page size should I use?
A4 for most countries and US Letter for the United States and Canada. Landscape suits wide tables.
Can I upload an .html file?
Yes. Press Open .html file to load it into the editor.
Why does my PDF look different from the preview?
The quick download understands common HTML tags and inline styles but not full style sheets, so layouts built with CSS grid, flexbox or external fonts can look simpler. Use the print option to keep the exact styling.
Is my HTML uploaded?
No. The preview and PDF are created in your browser, so your code stays on your device.
How this tool works. These PDF tools run entirely in your browser using two widely used open-source libraries: PDF.js, the PDF engine built into Firefox, to read and render pages, and pdf-lib to create and edit files. Each tool is tested with typed documents, phone scans and photo-heavy files before it goes live, and nothing you open is sent to a server.
Built and reviewed by Hamza Farooq, founder and lead developer
· Last updated
· How we check our tools
· Report a problem