HTML to PDF Converter
Paste HTML with its styles, choose paper size, orientation, and margins, then save it as a PDF with selectable text. Runs entirely in your browser.
🔒 This tool runs entirely in your browser. Your files are never uploaded to a server.
Paste HTML here, not a web address. A page cannot fetch someone else's site from your browser — that is blocked by the same-origin rules every browser enforces — so there is no URL field. Copy the HTML you want printed, or write it directly.
Example shown — replace it with your own. Inline <style> blocks are respected.
"Save as PDF" opens your browser's print dialog for the document below — choose Save as PDF as the destination. Only the document prints, not this page.
Preview
Rendered in an isolated frame with scripts disabled, so pasted HTML cannot run code on this page.
How it works
- Paste your HTML, styles included. The preview updates as you type.
- Set paper size, orientation, and margins — these become a real @page rule, not a guess.
- Press "Save as PDF" and choose Save as PDF as the destination.
- Or take the finished document as a standalone .html file instead.
Why there is no URL field
This is the question people arrive with, and the answer is a browser rule rather than a missing feature:
fetch('https://example.com/invoice') → blocked by the same-origin policy
Unless a site explicitly opts in with CORS headers — and almost none do — your browser refuses to let one page read another's content. That rule is why a random website cannot read your webmail while you have it open, so it is worth keeping. Services that offer URL-to-PDF have their own server fetch the page, which means the page and anything in it passes through their infrastructure. A URL box here would fail on nearly every address you tried, so there isn't one.
How the sandbox lets it render anything safely
Rendering HTML that someone pasted is normally a security problem: a <script> tag, or an
onerror attribute, would run with the same privileges as this page. There are two ways out, and only
one of them keeps your markup intact:
strip to an allowlist → safe, but your CSS and layout are mangled
sandboxed frame → safe, and renders exactly as written
The preview is an iframe with sandbox set and script permission withheld, so any script in your HTML
simply never executes. Because the frame has no network access either, remote trackers and external stylesheets
cannot load. And since printing targets the frame rather than the page, the PDF contains only your document — no
body-hiding CSS tricks needed, and none of this page's navigation leaks in.
A few sensible print defaults are applied underneath your styles: table rows, code blocks, and quotes are kept whole rather than split across a page break, headings are not stranded at the bottom of a page, and background colours are preserved rather than dropped as browsers normally do when printing.
FAQ
Why can I not just paste a web address?
Because a page in your browser is not allowed to read another site's content. That restriction — the same-origin policy — is what stops any website you visit from quietly reading your webmail, and it applies to us too. Tools that do accept a URL have a server fetch the page for them. This runs entirely on your device, so it works with HTML you supply.
Is my HTML uploaded anywhere?
No. It is rendered in an isolated frame inside this page and printed by your own browser. Nothing is uploaded, which matters when the HTML is an invoice, a contract, or a report with real figures in it.
Will my CSS be applied?
Yes. Include a <style> block in what you paste and it is used as-is — it is loaded after the defaults, so your rules win. External stylesheets and remote images will not load, since the frame has no network access.
Can pasted HTML run scripts on this page?
No. The preview frame is sandboxed without script permission, so any <script> in your HTML is inert. That is deliberate: it means the tool can render your markup faithfully rather than stripping it down to a safe subset.
How do I control page size and margins?
Use the three controls above — they write a CSS @page rule into the document, which is the only thing that genuinely sets paper size, orientation, and margins for printing. Your browser's print dialog can override them at the last moment if you need.
Why does it use the print dialog instead of just downloading?
Because your browser's print engine produces a far better PDF: real fonts, selectable and searchable text, and a few kilobytes rather than a screenshot weighing hundreds. The cost is one extra click to choose "Save as PDF".
How we compare
| Feature | Online Tool Store | Server-side HTML-to-PDF services | Printing from the browser directly |
|---|---|---|---|
| Your HTML never leaves your device | ✓ | ✗ | ✓ |
| Selectable, searchable text in the PDF | ✓ | ✓ | ✓ |
| Set paper size and margins explicitly | ✓ | ✓ | Only what the page's CSS allows |
| Pasted scripts cannot run | ✓ | Runs on their server, not your device | Not applicable |
| Accepts a live URL | ✗ | ✓ | Only the page you are on |
| Loads external stylesheets, fonts, and images | ✗ | ✓ | ✓ |
| Saves the file with no dialog | ✗ | ✓ | ✗ |
Right for HTML you already have and would rather not hand to a service — an invoice, a receipt, a report, an email template — where you want real paper dimensions and text that stays selectable. It genuinely cannot fetch a live URL or load remote assets; if you need either, a server-side service is the honest answer.