Skip to content
JustTools

HTML to PDF

Paste HTML or open an .html file, preview it at its printed width with page breaks marked, pick the page size and margins, and save a crisp PDF with selectable text — without uploading anything.

Runs in your browser Free · no sign-up

At a glance

  • Turns HTML code or an .html file into a PDF using your browser’s own print engine, so text stays selectable and searchable and links stay clickable.
  • Works with a full page (with its own <style>) or a fragment such as <h1>Hello</h1>, which gets clean default styling.
  • Page sizes A4, Letter, Legal, A3 and A5, portrait or landscape, with none, narrow, normal or wide margins.
  • A live preview shows the page at its printed width, with dashed lines where the page breaks will fall.
  • Keeps background colours, and can stop images, table rows and code blocks being cut in half across pages.
  • JavaScript in the HTML is not run, for safety: pages that build their content with scripts need to be saved from the browser instead.
  • The HTML never leaves your device — nothing is uploaded to a server.

Step by step

How to convert HTML to PDF

  1. 1

    Add your HTML

    Paste HTML into the editor, click Open file to load an .html file, or try the Sample invoice.

  2. 2

    Set up the page

    Choose the page size, orientation and margins, and check the preview and its page-break lines.

  3. 3

    Save as PDF

    Click Save as PDF. In the print window, set the destination to Save as PDF and turn off Headers and footers.

  4. 4

    Download

    Click Save and choose where to keep the PDF. Its name is taken from the file name box or the page’s title.

Features

Everything you need, nothing you don’t

Real text, not a screenshot

The PDF is made by the browser’s print engine, so text is sharp at any zoom, can be searched and copied, and links work.

See page breaks first

The preview is drawn at the exact paper width and marks where each new page starts, so you can fix the layout before saving.

Invoices and templates

Ideal for HTML invoices, receipts, email templates, reports and resumes. Try the sample invoice to see how it works.

Clean page breaks

Images, table rows and code blocks move to the next page instead of being sliced across two.

Your page setup wins

The page size and margins you choose here override any @page rules in the HTML, so the PDF comes out as you expect.

Private and safe

Everything happens in your browser, and scripts in the HTML are blocked so pasted code can’t do anything unexpected.

Getting a perfect PDF

Use absolute links for images and styles. A relative link like images/logo.png only works if you set the Base URL to the site the HTML came from, for example https://example.com/. Images embedded as data: URLs always work.

Turn off headers and footers in the print window (under *More settings* in Chrome and Edge) to remove the date, title and page URL printed at the edges.

Force a new page anywhere by adding <div style="break-before: page"></div> to the HTML. Headings are kept with the paragraph that follows them.

For the most faithful result, use Chrome or Edge on a computer — they follow the page size and margins exactly. Other browsers work too but may ignore some print settings.

Which page size to choose

Page sizeDimensionsTypical use
A4210 × 297 mmIndia, Europe and most of the world
Letter8.5 × 11 in (216 × 279 mm)USA and Canada
Legal8.5 × 14 in (216 × 356 mm)US legal documents and contracts
A3297 × 420 mmPosters, wide tables and diagrams
A5148 × 210 mmBooklets, receipts and small notices

FAQ

Frequently asked questions

Is the text in the PDF selectable?

Yes. Unlike converters that take a screenshot of the page, this uses the browser’s print engine, so text can be selected, searched and copied, and links remain clickable.

Why doesn’t my JavaScript run?

Scripts are blocked so that pasted code can’t act on this site or your device. If a page builds its content with JavaScript, open it in your browser and use Print → Save as PDF there instead.

Can I convert a website URL to PDF?

Not directly — browsers don’t allow one site to read another site’s pages. Open the website and press Ctrl + P (Cmd + P on a Mac), or save the page as HTML and open that file here.

Why are my images missing?

The images probably use relative links. Enter the website address in Base URL, or change the links to full https:// addresses. Images on your computer must be embedded as data URLs.

How do I remove the date and URL at the top and bottom?

Those are the browser’s headers and footers. In the print window open More settings and untick Headers and footers.

Does it work on a phone?

Yes. On Android, choose Save as PDF as the printer. On iPhone, open the share sheet from the print preview and save it to Files.

Keep going

Browse every tool

Last updated Report a problem or suggest a feature