HTML to PDF Converter

Paste HTML code or open an .html file, check it in a safe preview, and save it as a PDF with the paper size and margins you choose.

Paper
Orientation
Margins

Preview

Print → Save as PDF best quality

  1. Press Open print window.
  2. Choose Save as PDF as the printer or destination.
  3. Under More settings, untick Headers and footers.
  4. Press Save.

Real text you can select and search, and working links. Paper size and margins are set for you.

Download PDF

Works in every browser, including phones. Each page is saved as a picture of the preview, so the text can't be selected or searched.

Your HTML stays in your browser: it is shown in a locked-down preview with scripts off and nothing loaded from the internet.

How to convert HTML to PDF

  1. Open an .html file, or paste your HTML code into the box. The preview updates as you type.
  2. Choose the paper (A4 or US Letter), the orientation and the margins. Dashed lines in the preview show where pages end.
  3. Save it: Open print window and choose Save as PDF for the best result, or press Download PDF.

Print to PDF or download: which to use

FeaturePrint → Save as PDFDownload PDF
Text you can select, search and copyYesNo (pictures of pages)
Clickable linksYesNo
File sizeSmallLarger: each page is a picture, a few hundred KB
PhonesBest on a computer; phones may print the whole page or a blank oneWorks everywhere
Page breaksChosen by your browserAs shown by the dashed lines

Printing uses your browser's own engine, the same one that shows the preview, so the PDF has real text in the fonts you see. We looked at JavaScript libraries that write PDFs directly; they redraw HTML with their own, simpler layout rules and limited fonts, so they would lose more of your design than the browser does. That is why the print route is the recommended one, and the download is there for phones and quick results.

Example: an A4 page with 10 mm margins

A4 is 210 mm wide. Taking 10 mm off each side leaves 190 mm, which is 538.6 points or 718.1 CSS pixels (a CSS pixel is 1/96 inch), and the page holds 1047 pixels of height. A 900-pixel-wide email is wider than that, so it is shrunk by 718.1 ÷ 900 = 0.797, about 80%, the way a browser shrinks a page that doesn't fit when printing. Page breaks are moved up to the top of any line of text, picture or table row they would cut through.

What works in your HTML

  • CSS in <style> tags and style attributes, including tables, flexbox, grid and colours. Backgrounds are kept when printing.
  • Images and fonts embedded as data: URLs. Files on other websites or in folders aren't loaded.
  • Page breaks you set with break-before: page (or the older page-break-before: always).
  • Scripts don't run, so content that JavaScript would add won't appear. Save the finished page from your browser first.

Going the other way? Use PDF to HTML. For plain text, Text to PDF is simpler, and Markdown to HTML makes HTML you can paste here.

Frequently asked questions

Can I select and search the text in the PDF?

Yes if you use Print → Save as PDF: your browser writes real text and keeps links clickable. The Download PDF button saves each page as a picture, so its text can't be selected or searched, but it works on every phone and browser.

Why are my images or styles missing?

Files the HTML loads from elsewhere (an image's web address, a linked .css file, web fonts) are not fetched, so your HTML can't reach other servers from this page. Put the CSS in a <style> tag and images as data: URLs (base64), or open the original page in your browser and print it from there.

Can I convert a web page by its URL?

Not here. Browsers don't let one website read pages from another (the cross-origin rule, CORS), so a tool that runs in your browser can't fetch them, and fetching them on our server would mean visiting the page on your behalf. To save a page you are looking at, use your browser's own Print → Save as PDF, or save its HTML and open the file here.

Is it safe to preview HTML someone sent me?

The preview is locked down: scripts are switched off, forms and links don't work, and nothing is loaded from the internet, so the HTML can't track you or run code. Your HTML is never uploaded.

How do I remove the date and web address at the top and bottom?

Those are the browser's print headers and footers. In the print window, open More settings and untick Headers and footers. The Download PDF button never adds them.

Why does my page look different from the website?

The page is laid out at the width of the paper, which is narrower than most screens, so responsive sites show their mobile layout. Print → Save as PDF also applies the page's own print styles (@media print), as any browser does when printing.

More PDF tools

See all PDF tools →