HTML to PDF

Convert HTML to PDF online for free — paste HTML code or open an .html file and save it as a PDF, keeping your inline styles and <style> blocks. Choose A4, Letter or Legal and margins, preview the result, then save with selectable text. 100% in your browser.

100% private — everything runs in your browser. Conversion happens on your device; nothing is uploaded.

100% private — runs in your browser

Inline styles and <style> blocks are kept; scripts are removed for safety, so pages that need JavaScript to draw their content won’t convert fully. Images must be absolute URLs (https://…) or data URIs. “Save as PDF” keeps text selectable. Your code never leaves your device.

How to convert HTML to PDF

  1. Paste your HTML, or open an .html file.
  2. Choose page size, margins and whether to add default styles.
  3. Check the preview.
  4. Click “Save as PDF”, or download an image PDF.

What you can use it for

  • Turn HTML invoices, receipts and reports into PDFs
  • Save HTML email templates as PDF for approval
  • Archive a page of code output or a generated report
  • Print styled HTML documents with proper page sizes

More free tools

Working with PDFs?

Merge, split, compress, protect and convert PDFs with our free, private PDF tools.

See all free PDF tools →

Frequently asked questions

How do I convert an HTML file to PDF?

Open the .html file (or paste its code), choose a page size, and click Save as PDF. In the print dialog choose “Save as PDF” as the destination.

Is CSS supported?

Yes — inline styles and &lt;style&gt; blocks are kept, including print rules. External stylesheets load if they're on a public https:// address.

Does JavaScript run?

No. Scripts are removed for safety, so pages that build their content with JavaScript won't convert fully. Use your browser's own print on the live page for those.

Can I convert a web page by URL?

Not directly — browsers block reading other sites' pages. Open the page, then use your browser's Print → Save as PDF, or save the page's HTML and open it here.

How do I control page breaks?

Add CSS such as <code>break-before: page</code> to an element to start it on a new page. Tables, images and code blocks are kept together automatically where possible.

Is my code uploaded?

No. Everything runs in your browser.

Is this HTML to PDF converter free, and does it add a watermark?

Yes. It's free, with no sign-up, no paid tier and no watermark: the tool adds nothing of its own to your HTML. You can use the PDFs for anything, including business invoices and reports, and no credit is needed. The sample invoice in the box is ours and free to adapt. If your HTML uses third-party fonts or images, their own licences still apply.

Which page sizes and margins can I choose?

Pick A4 (210 × 297 mm), US Letter (8.5 × 11 in), US Legal (8.5 × 14 in) or A5 (148 × 210 mm), with Narrow (10 mm), Normal (18 mm) or Wide (25 mm) margins on every side. A4 with Normal margins is the default. Your choice is written into the page's print settings for Save as PDF, used directly for the image download, and the preview updates straight away.

What's the difference between Save as PDF and Download PDF (image)?

Save as PDF opens your browser's print dialog with the page size and margins already set, and keeps text selectable. Download PDF (image) builds the file in the tool: each page is a JPEG picture rendered at double scale, so its text can't be selected or searched. Pages are cut at a blank gap near the bottom where possible, and the file is named after your HTML file, or document.pdf for pasted code.

Why are my images missing from the PDF?

Images need a full web address (https://…) or a data URI built into the code. Relative paths such as images/logo.png don't work, because the HTML is previewed on its own, without the folder it came from, so those files can't be found. Upload the images somewhere public and use their full links, or embed them as data URIs, then check the preview before you save.

What does “Add clean default styles” do?

It adds a simple stylesheet before your own CSS: a 16 px system sans-serif font with 1.6 line spacing, a thin rule under H1 and H2 headings, bordered tables with a shaded header row, grey code blocks, blue links and images scaled down to fit the page width. Your own style blocks come after it, so your rules generally take over where both set the same thing. Choose “Keep the page's own styles” to leave all of this out.

Why does the preview show one long page?

The preview shows your document at the width of the chosen page size, inside its margins, as one continuous sheet you scroll through, scaled down to fit a narrow screen. Pages are split when you save: Save as PDF breaks them at the chosen page size, and the image download cuts each page at a blank gap near the bottom where it can, so check the saved PDF for final page breaks.