Skip to main content
ToolsBay

HTML to PDF

Render raw HTML markup into a downloadable PDF.

Runs entirely in your browser — nothing is uploaded

1 line

Frequently asked questions

Is the text in the PDF selectable?

Yes. The PDF contains real text runs, so it can be selected, searched, copied and read by a screen reader. Tools that screenshot the page produce a PDF with none of those properties.

Does it apply my CSS?

No. It reads the document structure — headings, paragraphs, lists, tables, quotes, code — and applies a clean typographic layout. Colours, positioning and custom fonts are not reproduced.

What about images?

Images are not included. Since nothing is fetched, no external request is made and no CORS error can occur — which is what broke the previous screenshot-based version on any remote image.

Can I upload an .html file instead of pasting?

Yes — switch to "Upload a file" and drop in a .html, .htm or .xhtml file. Its contents load into the editor so you can review or edit them before converting, and the PDF takes its name from the file.

Can I paste a whole web page?

You can, and the readable content will come through, but navigation, ads and scripts will be stripped along with the styling. It works best on document-shaped markup: invoices, reports, articles.

How this converts markup to a document

The HTML is parsed into a document tree, walked into a list of blocks — heading, paragraph, list item, table row, quote, code — and each block is typeset onto A4 with real text. Nothing is rendered to a canvas, so the output is a genuine text PDF rather than a picture of one.

Parsing happens with DOMParser into a detached document, so nothing in the markup you paste can execute or touch the page you are on.

What you gain and what you give up

You gain selectable, searchable, accessible text and a file measured in kilobytes rather than megabytes. You give up visual fidelity: this will not reproduce a styled marketing page. For document-shaped content — an invoice, a report, an article, a set of notes — that trade is almost always the right one.

For the reverse, PDF to HTML extracts a PDF's text into markup. To tidy the HTML before converting, use the HTML beautifier. For plain text input, Text to PDF is more direct.

All pdf tools