📄 File and Document Free Forever

HTML to PDF Converter

Turn raw HTML markup into a paginated PDF with a live preview, custom margins, headers, footers, and page numbers. Renders your HTML safely in a sandboxed frame before conversion.

HTML Source
Live Preview
Page Settings
About This Tool

How This HTML to PDF Converter Works

This tool loads your HTML markup into a sandboxed iframe, both for a live preview as you type and for the final render, so it displays exactly the way a real browser would, including any inline styles or style tags you provide. Once rendered, html2pdf.js walks through the content page by page and rasterizes it into a genuine, paginated PDF using html2canvas and jsPDF.

After the base PDF is generated, the tool makes a second pass over every page to stamp on your custom header text, footer text, and page numbers, giving you a finished document that looks like it came from a proper page layout engine, not a rough print to PDF screenshot.

What This Tool Does

Paste HTML directly or upload an .html file
A4, Letter, or Legal page size, either orientation
Adjustable margins and render scale
Custom header and footer text on every page
Automatic page numbering across the full document
Sandboxed rendering, your markup never runs unsafely

How to Convert HTML to PDF

1

Choose your source

Paste raw HTML, or switch to the From URL tab.

2

Set page options

Pick page size, orientation, margin, and scale.

3

Add header or footer text

Optional, appears on every page along with page numbers.

4

Convert and download

Click Convert to PDF and save the finished document.

HTML Input Examples

This converter accepts full HTML fragments, including inline CSS and style tags. A couple of examples of markup that convert cleanly.

Styled section
<div style="padding:20px;background:#f5f5f5;"> <h2>Invoice #1042</h2> <p>Amount due: $420.00</p> </div>

Inline styles are preserved exactly as written since the rendering pass uses a real browser engine.

Table layout
<table> <tr><th>Item</th><th>Qty</th></tr> <tr><td>Widget</td><td>3</td></tr> </table>

Tables, including borders and cell padding defined in a style tag, render and paginate correctly.

Common Questions

FAQ: HTML to PDF Converter

Switch to the From URL tab and paste the page address. The tool will attempt to load it inside a sandboxed frame. Some sites set headers that block being embedded this way, in which case pasting the page HTML directly is the reliable option.

Yes. Both inline styles and style tags included in your HTML render exactly as a browser would display them, since the conversion uses an actual browser rendering pass rather than a simplified parser.

Yes. Enter text in the Header Text and Footer Text fields in Page Settings, and leave Add Page Numbers checked. All three are stamped onto every page of the resulting PDF.

Your markup is rendered inside a sandboxed iframe with scripting restricted, so the tool focuses purely on visual layout, fonts, colors, and structure, rather than running arbitrary code.

No. Rendering and PDF generation both happen locally in your browser. The only exception is if you choose the From URL option, which asks your own browser to load that address directly.

Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful. Check our detailed privacy policy here.