Data Tools

HTML to PDF Converter

Choose an .html file or paste the markup, pick the page size and press Convert. Your browser draws the page and saves it as a PDF, with the styles in the file kept. Nothing is uploaded, and nothing in the HTML is allowed to run or fetch anything.

Free · No sign-up · Files stay on your device

By Aditya Kr Sharma

  • Free
  • Instant
  • No sign-up

HTML to PDF

Or import from
Supports: HTMLHTMTXT

Files are not uploaded - everything happens in your browser.

Need the text out of a PDF? Convert PDF to TXT →

How to use the HTML to PDF tool

  1. Choose an .html file, or paste the HTML code into the box.
  2. Pick the page size (A4 or Letter), the orientation and the margin.
  3. Choose the sharpness: 150 dpi suits most pages, 200 dpi gives crisper text and a bigger file.
  4. Press Convert, then download the PDF.

What this converter does

An invoice template, a receipt from a web shop, a saved web page, a report generated by a script or a snippet a developer sent you: all of these are HTML, and very often the person who needs them wants a PDF. This tool takes that HTML, lets your own browser lay it out exactly as it would on screen, and then cuts the result into A4 or Letter pages and saves them as a PDF file.

Everything happens inside a sealed frame in this browser tab. The HTML is never uploaded to a server, there is no account, and the PDF is built on your device.

What carries over

The layout as your browser draws it: fonts, colours, borders, tables, backgrounds and the styles written inside the file, whether in a style block or on the elements themselves. Images embedded in the file as data URLs appear normally. If the page is longer than one sheet, it continues onto as many pages as it needs, and page breaks are placed at the nearest block boundary so a line of text is not cut through the middle.

You can choose A4 or Letter, portrait or landscape, and a margin from 0 to 40 millimetres. Landscape is the better choice for wide tables and dashboards; portrait suits letters, invoices and articles.

What is removed, and why

Before anything is drawn, scripts, iframes, event handlers and every reference to another website are stripped out. That means no JavaScript in the file can run, and no image, font or stylesheet is fetched from the internet. This is deliberate. An HTML file can contain code that tracks you or tries to read things it should not, and a converter that quietly loaded remote content would tell other servers what you are converting.

The practical effect is that pictures linked from the web, web fonts and external stylesheets do not appear. If an image matters, embed it in the HTML as a data URL, or save the page with your browser as a single file first. The page tells you how many remote references were removed, so you know if anything was left out.

Pages that build themselves with JavaScript, such as most modern web apps, will look empty or incomplete for the same reason. For those, open the page in your browser and use its own Print to PDF instead.

The honest limit: a picture-based PDF

Each PDF page is a picture of the rendered HTML. That is the reliable way to get an accurate result in a browser without a server, but it has a cost: the text in the PDF cannot be selected, copied or searched, and links are not clickable. The file is also larger than a text-based PDF would be. At 150 dpi a typical A4 page is a few hundred kilobytes.

If you need selectable text, there are two routes. Your browser's own Print dialog with "Save as PDF" produces a text PDF from any page you can open. Or you can run the PDF from this tool through OCR PDF on this site, which adds an invisible text layer so the words can be found and copied.

Tips for a clean result

Give the content a sensible width. A layout designed for a 1400-pixel screen will be scaled down to fit the page and may look small; a fixed width of around 800 pixels prints comfortably on A4 portrait. Avoid very tall single elements such as one huge image, since a page break cannot fall inside them. If text looks soft, raise the sharpness to 200 dpi.

For invoices and letters, set a white background in the HTML. Transparent areas are printed on white anyway, but a dark theme colour carried over from a website template will use a lot of ink.

Common uses

Small businesses use it to turn an HTML invoice or quotation template into a PDF they can attach to an email. Developers use it to check how a generated report looks on paper before wiring up a proper PDF library. Students and office staff use it to keep a copy of an HTML email or a saved receipt in a format that opens the same everywhere. In each case the input is already HTML, and the goal is a fixed, printable page that looks the same on every device.

Privacy

The HTML stays in this browser tab, and so does the finished PDF until you download it. Closing the tab clears both.

Frequently asked questions

Can I select the text in the PDF?

No. Each page is drawn as a picture, which is the honest limit of doing this in a browser. Use your browser's Print to PDF, or run the result through OCR PDF, if you need selectable text.

Why are the images from my page missing?

Images loaded from another website are stripped so nothing leaves your device. Images embedded in the HTML as data URLs do appear.

Can I paste HTML instead of choosing a file?

Yes. Paste the code into the box and press Convert.

Does JavaScript in the page run?

No. Scripts and event handlers are removed before the page is drawn, so pages that build themselves with JavaScript will look incomplete.

Which page sizes are available?

A4 and US Letter, each in portrait or landscape, with a margin you choose from 0 to 40 mm.

Why is the PDF quite large?

Because each page is a picture. Lower the sharpness to 120 dpi for a smaller file.

Is my HTML uploaded anywhere?

No. It is drawn and turned into a PDF entirely in your browser.

More in Data Tools All tools