Skip to content
Toolvity

HTML to PDF converter

Paste HTML or open an .html file and turn it into a clean, paginated PDF with sharp, selectable text.

  • No upload
  • No sign-up
  • No watermark
  • Free

How to convert HTML to PDF

  1. Step 1

    Add your HTML

    Open an .html or .htm file, or choose Paste HTML code and paste it in. You can also copy part of a web page and paste it straight onto the tool.

  2. Step 2

    Check the preview

    The first pages of the PDF appear as you type. Switch to the HTML tab to edit the code and watch the preview update.

  3. Step 3

    Set up the page

    Pick A4 or US Letter, portrait or landscape, and margins. Lower the Scale if a wide layout looks squeezed.

  4. Step 4

    Convert and download

    Press Convert to PDF and save the file. The text stays selectable and links stay clickable.

Real text, not a screenshot

Your browser lays out the page and Toolvity redraws the text as text, so you can search, select and copy it in the PDF.

Clean page breaks

Pages break between lines and around pictures instead of slicing through them, and CSS page-break rules are honoured.

Nothing runs, nothing is uploaded

The HTML is rendered in a locked-down frame where scripts can’t run, right on your device.

How the conversion works

Toolvity loads your HTML into a hidden, sandboxed frame inside your own browser and lets the browser lay it out exactly as it would on screen, at the width of your chosen paper. It then reads where every line of text, picture, background and border ended up and draws them into a PDF.

Text is drawn with built-in sans-serif, serif and monospace fonts that match the shapes and widths of the originals closely, and each line is fitted to the width the browser measured. That keeps the layout faithful while the text stays searchable. Emoji and scripts the built-in fonts don’t cover, such as Chinese, Arabic or Hindi, are captured from the browser’s own rendering as sharp images instead, so they still look right.

The tall result is then cut into pages. Toolvity looks for a break point where no line of text or image would be sliced, and follows page-break-before, break-after and break-inside: avoid if your HTML uses them.

What to expect

  • Scripts never run. The frame has scripting switched off, so pages that build their content with JavaScript show only their static HTML. Inline event handlers and links that run code are removed.
  • Relative paths can’t be found. A single .html file doesn’t include the images and stylesheets next to it on your disk. Embed images as data: URLs, use full https:// addresses, or add a base href tag.
  • Online files load only if their server allows it. Images, fonts and stylesheets on other websites are fetched by your browser like any web page. Pictures can only be copied into the PDF when the server permits it; otherwise they’re skipped and the result tells you how many.
  • Simplified effects. Shadows, filters, rotations and blend modes aren’t reproduced, and text appears in the closest built-in font rather than a custom web font.

Wide layouts, such as a fixed 800-pixel email template, are scaled down to fit the paper. Lowering the Scale setting lays the page out wider before it’s fitted, which often gives a better result for desktop-style pages.

Good uses for HTML to PDF

Save an HTML email, receipt or invoice as a PDF for your records. Turn an exported report, a static documentation page or a snippet you’ve written into a document you can share or print. Designers and developers can paste a template and check how it paginates on A4 or Letter in a few seconds.

Writing in Markdown instead? Markdown to PDF handles it directly. To combine the result with other files, use Merge PDF, and Compress PDF if it needs to be smaller.

Private by default

Your HTML is processed entirely on your device and never sent to Toolvity. If you’d rather the page doesn’t contact any other website either, turn off Load online images & fonts and only the content inside your HTML is used.

Frequently asked questions

How do I convert an HTML file to PDF?

Open the .html file, check the preview, choose your page size and margins, and press Convert to PDF. The PDF downloads straight to your device.

Can I paste HTML code instead of uploading a file?

Yes. Choose Paste HTML code, or simply paste onto the tool. Copying part of a web page and pasting it works too, and you can edit the code in the HTML tab.

Is the text in the PDF selectable?

Yes. Text is drawn as real text with built-in fonts, so you can search and copy it. Only emoji and scripts those fonts don’t cover are placed as images.

Why are some images missing from my PDF?

Images referenced with relative paths can’t be found from a single file, and online images are only included when their server allows it. Embed them as data: URLs or use full https:// links.

Does JavaScript in my HTML run?

No. Scripts are switched off for safety, so content that JavaScript would normally create won’t appear. The static HTML and CSS are converted.

Can I convert a web page URL to PDF?

Not directly — browsers don’t let one site fetch another site’s pages. Save the page as HTML, or copy the part you need and paste it here. Your browser’s Print to PDF also works for live pages.

All PDF tools