HTML to PDF converter
Convert HTML files, saved web pages, and HTML code into PDFs with real text, working links, and your page's own styles. Everything runs in your browser, so pages never leave your device.
Drop an HTML, MHTML, or ZIP file here, or click to choose
Add the page's images and stylesheets at the same time. Everything stays on this device.
HTML to PDF
Convert to see the PDF pages here.
How to convert HTML to PDF
- 1
Add your HTML
Drop an .html file with its images and stylesheets, a .zip of a saved site, a single-file .mhtml web page, or paste HTML code.
- 2
Check the preview
The page appears as it will be laid out, at the paper width or a desktop, laptop, tablet, or phone width scaled to fit.
- 3
Set up the page
Choose Letter or A4, orientation, margins, page numbers, a header, print styles, and backgrounds.
- 4
Convert and download
Select Convert to PDF, review the pages, and download a PDF with real text, working links, and bookmarks from the headings.
Four ways to bring in a page
An HTML file with its files
Drop the .html file together with its images and .css files, or choose the whole folder. Relative paths such as images/logo.png and ../css/site.css are matched to the files you added.
A single-file web page (.mhtml)
Chrome and Edge save a page with all its images and styles in one .mhtml file. It captures the page after its scripts ran, so it is the most faithful way to convert a live website.
A ZIP archive
Zip a page with its folders, such as a documentation export, a test report, or an email template package. The converter opens index.html, and you can pick another page.
Pasted HTML code
Paste a full document or just a fragment like an invoice table or an email body. Styles in <style> tags apply, and the preview updates as you edit.
How to save a web page for conversion
Chrome and Edge
Press Ctrl+S (Cmd+S on a Mac), set the type to "Webpage, Single File," and save. Drop the .mhtml file here.
Firefox
Press Ctrl+S and choose "Web Page, complete." Firefox saves an .html file and a _files folder; choose both, or zip them.
Safari
Choose File, then Save As, and pick "Page Source." Add the page's images if it needs them. Safari's .webarchive format is not supported.
Settings that shape the PDF
- Page layout width. Fit to page lays the content out at the paper width, like a browser's print. Desktop, laptop, tablet, and phone widths keep a site's responsive layout and scale it down to fit.
- Print styles. With this on, @media print rules apply and screen-only elements such as menus and cookie banners can drop out, if the site defines them.
- Backgrounds. Keep background colors and images, or turn them off for a printer-friendly, ink-saving PDF.
- Page numbers and header. Add "Page 1 of 9" footers and the page title and date in the header, in the margins outside your content.
- Bookmarks. Every heading from h1 to h6 becomes a bookmark, nested by level, and links to #anchors jump to the right page.
CSS for print-ready HTML
If you write the HTML yourself, a few CSS rules give you control over the pages. Elements set to break before or after start a new page, and break-inside: avoid keeps a block on one page. Lines of text, images, and table rows are never cut in half, and headings stay with the paragraph after them.
@media print {
nav, .ads, .cookie-banner { display: none; }
a { color: inherit; }
}
h2 { break-after: avoid; } /* keep headings with the text below */
.chapter { break-before: page; } /* start chapters on a new page */
figure, tr { break-inside: avoid; } /* never split figures or table rows */What does not carry over
- Scripts never run, so content a script would add is missing. Save the page as .mhtml from your browser to capture it.
- Videos print as their poster image, and embedded frames such as maps and social posts are left out.
- Form fields print with their current values as plain text, and checkboxes as drawn boxes.
- Web fonts and icon fonts are replaced, and emoji or Chinese, Japanese, Korean, Arabic, and Hindi text are not available in the PDF fonts. The converter tells you when characters were left out.
- Web images from sites that block reuse cannot be embedded. The .mhtml format includes them.
Common uses
Invoices and receipts
Turn HTML invoices, order confirmations, and statements into PDFs for records and accounting.
Reports and exports
Convert HTML exports from test runners, analytics tools, and Jupyter notebooks into shareable documents.
Articles and documentation
Save web articles, help pages, and email newsletters as PDFs to read offline or keep for reference.
Why not just print to PDF?
A browser's print dialog works for a quick copy, and it is the better choice for pages that only render correctly with their scripts running. This converter adds what print leaves out: bookmarks from the headings, a consistent result on every device including phones, page numbers without the browser's URL and date stamps, and a preview of every page before you download. It also converts HTML you have as a file or as code, not just pages open in a tab.
More tools for your PDF
Writing from scratch is easier in Markdown to PDF, which adds themes, math, and diagrams. Word documents convert with Word to PDF. After converting, merge several saved pages into one file, compress an image-heavy PDF for email, or edit the PDF to fix a detail.
Frequently asked questions
Is my HTML uploaded to a server?
No. The HTML is laid out and turned into a PDF by your browser on your device. Your files are never sent to LocalPDFLab. If the page links to images or stylesheets on the web, your browser loads them like any web page, and you can turn that off to stay completely offline.
Can I convert a web page by its URL?
Not directly. Browsers do not let one site read another site's pages, so a converter that takes a URL has to fetch the page on its own server, which means your request leaves your device. Instead, open the page, press Ctrl+S (Cmd+S on a Mac), and save it as "Webpage, Single File" in Chrome or Edge. Then drop the .mhtml file here. Pages behind a login work this way too.
Why is part of my page missing?
Scripts never run during conversion, for your safety, so anything a script adds after the page loads is not there, such as charts, comments, or content loaded while scrolling. Saving the page from your browser as an .mhtml file captures it after the scripts have run, which usually fixes this.
Is the text in the PDF selectable and searchable?
Yes. Every word is real text in an embedded font, placed exactly where the browser laid it out. You can select, copy, and search it, links stay clickable, and the headings become bookmarks in the PDF reader's sidebar.
Do my fonts carry over?
Each font is replaced with the closest of five embeddable families: Arial or Helvetica, Times New Roman, Calibri, Cambria, and Courier New styles. Web fonts and icon fonts are not embedded. The layout is computed with the replacement font, so lines never overlap, but text can wrap a little differently than on the original site.
Does it use my print stylesheet?
Yes, by default. Rules inside @media print apply and screen-only rules are skipped, the same as when a browser prints. CSS break-before, break-after, and break-inside are honored. Page size and margins come from the settings, not from @page rules.
What is the page layout width setting?
Web pages are designed for screens. Fit to page lays the page out at the paper width, like printing from a browser. Desktop, laptop, tablet, and phone widths lay it out as on that screen and then scale it down to fit the paper, which keeps multi-column layouts intact.
Which files can I convert?
.html, .htm, and .xhtml files, .mhtml and .mht single-file web pages, and .zip archives of a page with its files. Add images and .css files alongside an HTML file, or choose a whole folder. If a folder or ZIP holds several pages, you can pick which one to convert.
Next steps
Related PDF tools
Choose another private, browser-based tool for the next step in your document workflow.