How to Convert HTML to PDF: A Practical Guide
Turn HTML code or an .html file into a PDF. Learn which CSS works, why external images do not load and how to design printable pages.
HTML is how most invoices, certificates, reports and email templates are designed. But you cannot send someone raw HTML and expect a good result: it changes with the browser, the screen size and the fonts installed. A PDF freezes the design into a fixed, printable page. This guide shows how to convert HTML into PDF and explains why some things, like external images, behave differently here than in your browser.
What the converter does
Your HTML is loaded in a real browser engine running on our servers, then printed to PDF using the page size, orientation and margins you choose. Inline styles and style blocks are applied, so what you designed is what you get.
How to convert HTML to PDF
HTML to PDF — free online tool
Render HTML as a PDF. No sign-up needed.
- Open the HTML to PDF tool.
- Upload an .html file, or paste your HTML.
- Choose the page size, orientation and margin.
- Decide whether to print background colours and images.
- Tick Add page numbers if needed.
- Press Create PDF and download.
What works, and what does not
The conversion runs in a locked-down browser. This protects our servers and your data, and it affects what can appear on the page.
| Feature | Supported? |
|---|---|
| Inline CSS and style blocks | Yes |
| Tables, lists, headings, borders | Yes |
| Background colours | Yes, when you tick the option |
| Images embedded as data URLs | Yes |
| Images or CSS loaded from the internet | No (blocked for security) |
| Web fonts from the internet | No; common system fonts are used |
| JavaScript | No (switched off) |
Making your HTML print-friendly
- Put all CSS in the page. Use a style block in the head instead of linked stylesheets.
- Embed images. Convert pictures to data URLs (base64) so they travel inside the HTML.
- Use common fonts. Arial, Georgia, Times New Roman, Courier New and similar are safe.
- Think in pages, not screens. Use percentage or millimetre widths instead of fixed pixel layouts that assume a screen.
- Control page breaks with the CSS properties for page-break-before and page-break-inside to avoid a table row being cut in half.
- Use high contrast. Light text on a dark background uses a lot of ink if printed, and may not show if background printing is off.
Print backgrounds: yes or no?
Browsers normally skip background colours when printing to save ink. If your design uses coloured headers or shaded table rows, tick Print background colours and images. If you simply want a plain, ink-friendly document, leave it off.
Common uses
- Invoices and receipts generated by your own system.
- Certificates and tickets designed in HTML.
- Reports from templates.
- Email templates saved as documents.
- Documentation exported from static site tools.
Why can't I convert a live URL?
Loading arbitrary web addresses from our servers would be a security risk, so the converter works with the HTML you give it. To convert a page you can see in your browser, save it as an HTML file (and embed its images if you need them), or copy the relevant code.
Real-world examples
A developer generates invoices. The billing system produces an HTML invoice for each customer. For a quick test, the developer pastes one into the tool to see how the page breaks and margins look as a PDF before building automation.
A teacher designs a certificate. A certificate template with a coloured border is saved as HTML with inline CSS. With background printing switched on, the border and colours appear exactly as designed.
A marketer archives an email. The HTML of a newsletter is saved and converted so that a fixed copy of the campaign can be stored with the project files.
Mistakes to avoid
- Linking stylesheets and images. Anything loaded from the internet is blocked. Inline your CSS and embed images.
- Relying on JavaScript to build the page. Scripts do not run, so the HTML must already contain the final content.
- Using fixed pixel widths larger than the page. Content may be cut off. Use percentages or millimetres.
- Forgetting to turn on background printing. Coloured headers and shaded rows disappear when it is off.
- Ignoring page breaks. Use CSS page-break rules so a table row or heading is not split across two pages.
Quick checklist
- All CSS is inside the file
- Images are embedded as data URLs
- Fonts are common system fonts
- Page size and margins match the intended print
- Background printing is on if your design needs colour
Free limits
- 3 uses per tool every 24 hours on the free plan, with or without an account (Pro is unlimited).
- Files up to 10 MB each on the free plan; Pro allows larger files.
Final thoughts
HTML to PDF gives you full design control with a fixed, shareable result. Keep your CSS inline, embed your images and choose backgrounds on or off. Convert your HTML now, or try the simpler Markdown to PDF guide if you prefer writing in plain text.
Frequently asked questions
Why are my external images and fonts missing?
For security the converter loads nothing from the internet. Embed images as data URLs and keep your CSS inline or in a style block.
Does JavaScript run in the page?
No. JavaScript is switched off so untrusted pages cannot do anything unexpected.
Can I convert a live web page?
Not directly. Save the page as an HTML file or paste its code, then convert that.

