HTML to PDF — Turn HTML Code into a Ready-to-Send PDF

Paste your markup or open an .html file and save it as a PDF with real, selectable text and working links, or as an exact picture of the layout. The conversion runs on your own device from start to finish.

  • Free
  • No sign-up
  • No watermark
  • Runs in your browser

Selectable text keeps real text and working links, using standard PDF fonts. Exact look captures each page as a picture: use it for non-Latin scripts, emoji, web fonts or very complex designs.

0%

Key points

The markup never leaves this browser tab and is not sent to our servers. How on-device processing works · Privacy Policy.

From markup to a PDF people can open

HTML is handy for laying out documents that look polished, like an invoice template, a newsletter, a café menu or a résumé you coded yourself, yet the people receiving it usually expect a PDF. Paste or upload the markup here and it is turned into PDF pages on your own device, with no build pipeline or headless browser to install.

Step by step, under the hood

The first thing that happens is a clean-up: every <script> element and inline event attribute (onclick, onload and the like) is deleted, so no code in the markup can execute. On Convert to PDF, your own browser lays the cleaned HTML out in a hidden, sandboxed frame exactly as wide as the page minus its margins (1 pt equals 1.333 CSS px, so 16 px text prints at 12 pt). Because the browser does the layout, flexbox, grid, tables and floats stay where they should.

With Selectable text, the tool then notes where each word ended up and writes it into the PDF through pdf-lib as genuine text, in the nearest standard PDF font (sans-serif becomes Helvetica, serif becomes Times, monospace becomes Courier, keeping bold and italic), at the same size and colour. Background colours, borders, underlines, bullets, <hr> lines and images are drawn in place, and <a href> links to http, https and mailto addresses become clickable. Page breaks never slice a line of text in half; page-break-before/after: always (or break-before: page) forces a new page, and table rows, images and break-inside: avoid blocks shorter than a page are kept in one piece.

With Exact look, html2canvas photographs the same layout at twice screen resolution and every page becomes an image. It stays truer to web fonts and unusual CSS, but the text cannot be searched or copied and links do not work.

Tick Add page numbers and a small grey "Page 1 of 3" style label goes at the bottom centre of every page. The download is named output.pdf. Preview shows the cleaned HTML at the same content width, but always open the saved PDF to be sure.

Content that comes out well

Content that causes trouble

Who finds it useful

Tips for better pages

HTML to PDF in four steps

  1. Put in your HTML. Paste the markup into the text area, or tap Upload HTML file to open an .html or .htm file.
  2. Set up the page. Choose the output (Selectable text or Exact look), then a page size, orientation and margin, and tick Add page numbers if you would like them.
  3. Preview it. Tap Preview to view the cleaned markup inside a sandboxed frame at the page's content width, and correct anything that looks off.
  4. Convert and review. Tap Convert to PDF and output.pdf saves on its own. Open it and look through every page before you send it.

Common questions

Can I type in a website address to convert it?

No. Only HTML that you paste or upload is converted. For a live web page, open it in your browser and choose Print, then Save as PDF.

Why have my images disappeared in the PDF?

Browser security normally blocks pictures pulled from other websites, and relative image paths cannot be resolved because only the HTML file itself is read. Embedding images as data URLs is the dependable fix.

Is the text in the PDF selectable, and do links work?

Yes, with the default Selectable text output. You can highlight, copy and search the words, and links to http, https and mailto addresses can be clicked. In Exact look mode each page is a picture, so neither works.

Why does the PDF use a different font?

Selectable text mode uses the standard PDF fonts: sans-serif fonts become Helvetica, serif fonts become Times and monospace fonts become Courier, with bold and italic kept. Every word stays where the browser put it. For a web font's exact appearance, choose Exact look.

Why do some characters turn into question marks?

The standard PDF fonts only cover Western European letters. Jawi, Chinese, Tamil and other non-Latin scripts, emoji and some symbols become "?" in Selectable text mode. Choose Exact look to keep them as they appear.

Will JavaScript inside my HTML be run?

No. Script tags and inline event handlers are stripped before previewing or converting, so only static HTML and CSS get rendered.

What paper sizes are offered?

A4, Letter and Legal, each in portrait or landscape, with margins anywhere from 0 to 200 points (72 points is one inch, about 25 mm). A4 is selected by default, as it is the normal paper size in Malaysia.

Can page numbers be added?

Yes. Tick Add page numbers before you convert, and a small "Page 1 of 3" style label appears at the bottom centre of every page.

Is my HTML sent to a server?

No. Cleaning, rendering and converting all happen in your browser, and the HTML never reaches our servers. It is free, with no account and no watermark.