HTML to PDF Converter
Paste HTML or open an .html file, check the live preview, and download a PDF that keeps the styles, tables and images.
or drop it anywhere on this page, or paste
Opens in your browser. Nothing is uploaded.
Create PDF saves each page as a sharp image with a hidden text layer, so the PDF looks like the preview and its text can still be searched and copied. Scripts never run, and images, fonts and stylesheets from other websites are not loaded. Embed images as data: URLs to keep them.
Need clickable links and vector text? Print, then choose Save as PDF as the destination.
!Paste some HTML or choose a file
HTML to PDF Converter, free and private
This HTML to PDF converter turns HTML code or an .html file into a PDF that looks like the page in your browser. Styles, colours, tables and embedded images are kept. A live preview of the pages, with their page breaks, updates while you edit.
Paste the HTML or open a file, set the page size, orientation and margins, and download the PDF. The conversion runs in your browser, so your HTML is never uploaded. Scripts in it never run.
How to convert HTML to PDF
- 1
Paste HTML or choose a file
Paste HTML into the box, or choose an .html or .htm file. A loaded file appears in the box, and edits you make there go into the PDF. Your original file is not changed.
- 2
Check the preview
The preview shows each page with your margins and page breaks, and updates shortly after you stop typing. It draws the first 12 pages; the download has all of them.
- 3
Set the page
Under Page, choose A4 or Letter. Under Orientation, choose Portrait or Landscape. Set Margin (mm) anywhere from 0 to 40. The default is 15.
- 4
Create and download
Press Create PDF. The summary shows the page count. Open Preview to check the result, then press Download PDF.
Why use PDFToolz for this
Looks like the browser
Your browser lays out the HTML with its own engine. CSS, web-safe fonts, flexbox, grids, tables and background colours come out as they do on screen.
Clean page breaks
Pages end between lines of text, images and table rows, not through them. Only something taller than a whole page is split. The PDF follows the CSS rules page-break-before, break-before: page and break-inside: avoid.
Searchable text
Each page is saved as a sharp image at about 192 DPI with an invisible text layer on top, so you can search the PDF and copy its text.
Scripts never run
Scripts are removed and the page is shown in a sandbox where code can't run. Nothing is fetched from other websites, and the HTML never leaves your device.
What the converter keeps
The PDF matches the preview. This is how each part of the HTML is handled.
- Inline styles and <style> blocks are applied. Screen styles are used, so rules inside @media print only apply when you use Print.
- Images embedded as data: URLs are kept. Images, stylesheets and fonts linked from other websites are not loaded, so the PDF never depends on another server.
- Fonts installed on your device and fonts embedded with @font-face and a data: URL are used. Web fonts linked from a font service fall back to a similar font.
- Content wider than the page, such as a wide table, is scaled down to fit the page width. It can shrink to a third of its size.
- Scripts, iframes, embedded objects and event handlers like onclick are removed before the page is shown.
Create PDF or Print
Browsers can't save HTML straight to a PDF file from code, so the tool offers two routes. Create PDF draws each page and builds the PDF file for you. The text can be searched and copied, but links are not clickable.
Print opens your browser's print dialog with the same page size, orientation and margins. Choose Save as PDF as the destination to get vector text that stays sharp at any zoom and links that still work. Background colours are kept, and rules inside @media print are applied.
Fixing common problems
Most problems come from files the HTML links to but does not contain.
- Images are missing. They are linked from a website or from a folder next to the file. Embed them as data: URLs, or open the page in your browser and use Print there.
- The layout looks unstyled. The CSS is in a separate .css file. Paste it into a <style> block in the <head>.
- A page ends too early. A table row, image or block with break-inside: avoid did not fit, so it moved to the next page. Lower the margins or switch to Landscape.
- Create PDF fails because your browser can't draw the page. Use Print and choose Save as PDF instead.
- The PDF is too big to email. Run it through Compress PDF.
Frequently asked questions
Paste your HTML or open an .html file, choose the page size, orientation and margins, and press Create PDF. The HTML to PDF conversion is free and runs in your browser.
Yes. There is no account, watermark or page limit, and the HTML is converted on your device.
Yes. Choose an .html or .htm file and it loads into the editor. Images and stylesheets stored next to the file are not read, so embed them in the HTML first.
Yes. Create PDF adds an invisible text layer, so you can search and copy the text. For vector text and clickable links, use Print and choose Save as PDF.
No. The tool never fetches anything from the internet. Open the page in your browser and use its print dialog, or paste the page's HTML here.
No. Scripts and event handlers are removed, and the preview runs in a sandbox with scripts turned off. Content that JavaScript would build on a live site will not appear.
Add style="break-before: page" to the element that should start a new page. Older CSS written as page-break-before: always works too. Use break-inside: avoid to keep a block together.