3 min read

HTML to PDF Free — Convert Files or Raw Code

Convert HTML files or raw code to PDF free — paste or upload .html, CSS fully preserved. No upload, no watermark. Works offline in your browser.

When you need to convert HTML to PDF

HTML to PDF conversion is useful for developers generating invoices or reports from HTML templates, saving web page content as a permanent archived PDF, converting email template designs to PDF for review and approval, archiving web articles before they go offline, or sharing HTML-based documents with people who won't be viewing them in a browser.

How to convert HTML to PDF free — step by step

  1. Open ihatepdf.cv/html-to-pdf — no sign-up required
  2. Paste your HTML code into the editor, or upload a .html file
  3. Preview renders in real time showing how the PDF will look
  4. Click Convert to PDF and download — no watermark, no server upload

What CSS is supported?

Inline styles and embedded CSS inside a <style> tag are fully applied. External stylesheets linked via <link> tags pointing to remote URLs also work when you have an internet connection. For best results with complex layouts, inline all your CSS before converting to ensure nothing depends on external resources.

Tips for better HTML to PDF output

Convert a saved webpage to PDF

Save a webpage as an HTML file (File → Save Page As → Webpage, Complete in your browser), then upload the .html file to the converter. This captures the rendered layout including all styles applied by the website's CSS.

Generate invoices, receipts and reports from a template

This is the developer's shortcut for turning an HTML template into a deliverable document without spinning up a headless-browser PDF service. Build your invoice, receipt, certificate, or report as a self-contained HTML file with the data filled in and the CSS inlined, paste it in, and download a pixel-faithful PDF. Because conversion runs entirely in your browser, it is a fast, private way to produce one-off documents — or to prototype the exact markup you will later wire into an automated pipeline.

Print-ready HTML: page size, margins and backgrounds

A few CSS rules make the output behave like a real printed page. Use an @page rule to set the size (for example @page { size: A4; margin: 20mm; }) so the PDF matches standard paper. Because PDF generation does not print background colours by default the way a browser does, add -webkit-print-color-adjust: exact to elements whose fills must appear. Combine that with @media print rules and explicit page breaks, covered above, to get clean, predictable pages every time.

Frequently asked questions

Why does my page look different in the PDF than in the browser?

Usually because something depended on the live web — JavaScript, a CDN font, or an external stylesheet that was not reachable. Inline your CSS and fonts and avoid JS-rendered content, and the PDF will match your preview.

Can I set the PDF to A4 or Letter size?

Yes — control it from your CSS with an @page size rule. Using pt or mm units for fonts and layout keeps everything scaled correctly for print.

Does the converted PDF have a watermark?

No. ihatepdf never adds watermarks.

What about JavaScript in the HTML?

JavaScript is not executed during conversion. Content that requires JavaScript to display (dynamic charts, lazy-loaded images) may not appear in the PDF. For these cases, take a screenshot of the rendered page and use Images to PDF instead.

Use these tools

HTML to PDF → Markdown to PDF → Create PDF from scratch →

Try all tools free — no sign-up, no watermark

40+ free PDF tools. Files never leave your device.

Open ihatepdf →

Related guides

Markdown to PDF Free Online

Simpler conversion if you write in Markdown.

Create PDF Free Online — Rich Text Editor

Visual editor alternative to HTML-based creation.

Word to PDF Free Online

Convert Word documents if HTML is not your workflow.