Convert an HTML File to PDF in Your Browser

Convert an HTML file to PDF locally in your browser. Your HTML is sanitized and rendered in a sandboxed frame, and the file never leaves your device.

Tap to select a file

Files are processed on your device only.

How it works

  1. Drop or select your .html file. It is read on your device only.
  2. The HTML is sanitized and rendered safely in a preview.
  3. Click Print or Save as PDF, then pick your printer or PDF target.

Sandboxed rendering: how your HTML is isolated

An arbitrary HTML file is the most dangerous thing a converter can be asked to open, because it can contain scripts. This tool defends against that in two independent layers. First, the HTML is run through DOMPurify, which strips scripts, inline event handlers like onclick and onerror, and other unsafe constructs. Second, the cleaned HTML is placed inside an iframe that is sandboxed with no script permission at all.

So even in the unlikely case that something evaded the sanitizer, the frame cannot run it. The same isolation protects the notebook and email tools; the methodology page describes the pipeline in full.

External assets (images, CSS): what loads and what doesn't

Anything the HTML references by URL, remote images, external stylesheets, web fonts, is deliberately not fetched. That keeps a converted page from phoning home and preserves the privacy guarantee: nothing about your file leaves the device. As a result, a page that depends on an external CSS framework will render in a plainer form.

What is preserved: inline CSS in a style tag, inline style attributes, and images embedded as data URIs. To get a faithful PDF, inline the styles and embed the images before converting. For Markdown source instead of raw HTML, the Markdown to PDF converter renders structure with a built-in theme.

Frequently asked questions

Do scripts, remote images, and external stylesheets work?
No, by design. Scripts and inline event handlers are stripped for safety, and resources referenced by URL, remote images, external CSS, and web fonts, are not fetched. To keep a graphic or style, embed it: use a data-URI image and inline CSS in a style tag, which are preserved.
How is my HTML kept safe while it renders?
Two layers. The HTML is first cleaned with DOMPurify, which removes scripts, event handlers, and dangerous tags. It is then displayed inside an iframe sandboxed without script permission, so even if something slipped past, nothing can execute. This is the same pipeline the notebook and email tools use.
What HTML features are rendered?
Structure and inline styling: headings, paragraphs, lists, tables, links, inline or embedded CSS, and images embedded as data URIs. Layout that depends on external stylesheets or JavaScript will look plainer, since those are not loaded.
Is my file uploaded to a server?
No. The HTML is read, sanitized, and rendered in your browser on your device. Nothing is sent to a server, there is no account, and it keeps working offline.

Related tools