HTML to PDF Converter – Convert HTML Files and Code to PDF Free

Convert HTML pages and code to PDF documents.

or drop a file here

🔒 Files are processed on your device and never uploaded.

Files stay on your deviceProcessing runs in your browser. Nothing is uploaded to a server.
100% free, no sign-upNo account, no watermark, no daily limit, no "share to unlock".
Long PDFs welcomeNo page or file-size cap — only your device memory sets the limit.

How do I convert HTML to PDF?

To convert HTML to PDF, upload an .html file (saved with "Save page as" in your browser) or paste HTML code, choose the orientation and click "Convert to PDF". The page is rendered and split into A4 pages without cutting lines in half.

About HTML to PDF

Turn invoices, email templates, receipts, documentation or saved web pages into PDF for printing and archiving. Paste raw HTML from your app or upload a saved page.

Styles inside the HTML are applied and images that allow cross-origin access are included. For a live website, save the page from your browser first and upload the .html file.

Why use LucyPDF to convert HTML to PDF

File upload or paste

Inline and <style> CSS supported

Smart page breaks

Scripts are never executed

How do I convert HTML to PDF in 4 steps

Step 1

Upload an .html file or paste HTML.

Step 2

Choose orientation.

Step 3

Click "Convert to PDF".

Step 4

Download the PDF.

When to use HTML to PDF

  • Save an HTML invoice or receipt as PDF
  • Archive documentation
  • Test email templates

LucyPDF vs. upload-based sites vs. desktop software

LucyPDF HTML to PDFTypical upload-based websiteDesktop PDF software
PriceFreeFree with limits, paid for moreOften paid license
Account neededNoOften for large filesInstall + license
Where your file goesStays on your deviceUploaded to their serversStays on your device
File size / page limitNone (device memory)Usually cappedNone
Install requiredNo — any browserNoYes
WatermarkNeverSometimes on free planOn trials
Batch (many files at once)Yes, freeOften paidUsually yes
Install as an app / works offlineYes (installable web app)NoYes
AI (summarize, translate, chat)Free, on your deviceCloud AI, often paidVaries, often paid

Is HTML to PDF on LucyPDF safe?

Yes. Most online PDF services upload your document to their servers and delete it later. LucyPDF works differently: the html to pdf tool is JavaScript running inside your own browser tab, so the file is read, processed and saved on your device. Close the tab and nothing remains anywhere else — which makes it suitable for contracts, ID documents, bank statements and medical records.

What is HTML to PDF conversion and why do people use it?

HTML to PDF conversion turns a web page or a piece of HTML code into a paginated PDF document. HTML is perfect for screens, but it is hard to print neatly, archive or attach to an official email. A PDF keeps the content fixed, splits it into pages and opens anywhere.

Developers use it to turn HTML invoices, receipts and reports from their apps into PDFs. Marketers check how an email template looks as a printable document. Small businesses save online order confirmations and booking receipts for their records. Students save documentation pages and articles for offline reading. Office staff archive internal web forms and notices for audit files.

LucyPDF lets you either upload a saved .html file or paste HTML code directly. Styles inside the HTML are applied, the content is split into A4 pages without cutting lines in half, and the text in the PDF stays real and selectable.

It is especially useful for developers who want to preview how generated HTML will look as a document, without setting up a separate PDF library or server first.

What the HTML to PDF tool supports

You can upload one .html or .htm file, or paste HTML into the text box if you do not have a file. Choose portrait or landscape orientation, then convert. Inline styles and CSS inside <style> tags are applied, so headings, colors, tables and spacing look the way you designed them.

For safety, scripts are never run. That means pages that build their content with JavaScript, such as dashboards and web apps, may come out mostly empty. Images are included when they are embedded in the HTML or hosted on servers that allow cross-origin access. You cannot type a website address, because browsers do not let one site read another directly.

When you paste code, the PDF is saved with a default name, while uploaded files keep their own name with a .pdf extension. Long content is split across as many pages as it needs, with page breaks placed between lines rather than through them.

  • Input: .html or .htm file, or pasted HTML code
  • Portrait or landscape A4 pages
  • Inline and <style> CSS supported
  • Smart page breaks that avoid splitting lines
  • Scripts are not executed
  • Images from servers that block cross-origin access cannot be drawn

How to convert HTML to PDF on Windows, Mac, Android and iPhone

Windows: to save a web page first, press Ctrl+S in Chrome or Edge and choose Webpage, HTML only or Webpage, Single File. Then open LucyPDF, drag the .html file in, pick the orientation and click Convert to PDF.

Mac: in Safari or Chrome, press Cmd+S to save the page as HTML, then drop it onto the converter. You can also copy HTML from your code editor and paste it straight into the text box.

Android: Chrome on Android cannot always save a page as HTML, so the easiest route is to paste HTML code into the text box, or pick an .html file from Files or Drive. The PDF saves to Downloads.

iPhone and iPad: in Safari, choose an .html file from the Files app, or paste your HTML into the box. The PDF appears in Files › Downloads.

On any device, it helps to open the saved .html file in your browser once before converting. If it looks right there with scripts turned off, it will look very similar in the PDF.

Tips for the best HTML to PDF output

HTML written with print in mind converts beautifully. These tips help.

If you control the HTML, adding simple print-friendly CSS, such as avoiding breaks inside table rows, gives you even more control over where pages split.

  • Put all CSS in a <style> block or inline styles; external stylesheets on other sites may not load
  • Embed images as data URLs, or host them on a server that allows cross-origin access
  • Use landscape for wide tables and dashboards, portrait for letters and invoices
  • Avoid fixed heights on containers so content can flow across pages
  • Use simple, widely available fonts or web-safe font stacks
  • For content built with JavaScript, use your browser's Print › Save as PDF instead
  • Test with a short sample first, then convert the full page

Common HTML to PDF problems and fixes

Most issues come from how the HTML loads its resources.

A simple way to debug is to paste a small part of the page into the text box and convert just that. Once it looks right, add the rest of the content back step by step.

  • The PDF is almost blank — the page relies on JavaScript; print it from the browser instead
  • Images are missing — they are on another server that blocks cross-origin access; embed them as data URLs
  • Styles are not applied — the CSS is in an external file; copy it into a <style> tag
  • Content is cut on the right — the layout has a fixed width; switch to landscape or use max-width
  • I entered a URL and nothing happened — save the page as .html and upload the file instead
  • Fonts look different — the font is not available in the browser; add a fallback font family

HTML to PDF online vs browser print and server tools

Your browser's Print › Save as PDF is handy for live websites and runs scripts, but it often adds headers, footers, URLs and dates, and its page breaks can split lines or images. Server-side HTML to PDF libraries are powerful for automated systems, but they need setup and hosting. Upload-based converter sites send your HTML, which may include customer data, to an external server.

LucyPDF is the quick option for a saved page or a snippet of HTML: paste or upload, choose orientation and download a clean A4 PDF, all inside your browser.

For developers, it is also a fast way to check print layouts while building a template. Paste the latest HTML, convert, look, adjust and repeat, all without leaving the browser.

Privacy and security of HTML to PDF on LucyPDF

HTML invoices and receipts often contain names, addresses and order details. The converter renders your HTML and builds the PDF within your own browser. Nothing you paste or upload is sent to LucyPDF's servers or stored anywhere.

Scripts in the HTML are blocked during conversion, which protects you from running unknown code from a saved page. The only network requests are for images or resources that your HTML itself points to, just as when you open the file in a browser.

HTML to PDF for receipts, records and documentation

A lot of important paperwork in the US now arrives as HTML: email receipts, order confirmations, online invoices, rent payment confirmations, benefits enrollment pages and newsletters. Keeping a PDF copy makes record-keeping much easier when you need proof of a purchase for a warranty, a reimbursement from your employer, or supporting documents at tax time.

Developers and writers use HTML to PDF in another way. They draft a one-page report, an email template, a certificate or a simple invoice in HTML and CSS, then turn it into a PDF to send or print. Because the content is written as real PDF text, the result is searchable and easy to file.

Save the HTML of a receipt or message to a file, or paste the code into the text box, choose portrait or landscape, and convert. Everything happens in your browser, so personal details in a receipt are not uploaded anywhere.

  • Name files with the date and vendor, for example 2026-03-14-hardware-store.pdf
  • Keep receipts for tax and warranty records in one folder
  • Merge a month of receipts into one file with Merge PDF

Checklist for clean, print-ready HTML to PDF output

HTML to PDF applies your inline styles and the CSS in style tags, but it does not run scripts. A little preparation in the HTML makes the PDF look right the first time, whether you are saving a receipt for your records or producing a certificate, a one-page flyer or a simple invoice to send to a client.

If you write the HTML yourself, keep the structure simple. Plain headings, paragraphs, lists and tables convert most predictably, and long content flows onto as many A4 pages as it needs, with breaks placed between lines rather than through them.

Use this checklist before converting:

  • Put the CSS inside a style tag or inline, not in a linked stylesheet on another server
  • Embed key images as data URIs so they always appear
  • Avoid content that is built by JavaScript; paste the final rendered HTML instead
  • Use widths in percent so content fits A4 in portrait or landscape
  • Choose landscape for wide tables
  • Use dark text on a light background for readable printing
  • Use real headings (h1, h2) and alt text on images so the content stays clear and accessible
  • Preview the PDF and adjust font sizes if lines wrap awkwardly

HTML to PDF — frequently asked questions

Can I enter a website URL?

Browsers block reading other websites directly, so save the page with Ctrl+S (or "Save page as") and upload the .html file.

Is JavaScript on the page run?

No. For safety, scripts are disabled while rendering. Pages that build their content with JavaScript (dashboards, web apps) will come out mostly empty — print those from your browser with Ctrl+P → Save as PDF instead.

Why are some images missing?

Images on other servers that do not allow cross-origin access cannot be drawn. Embed them as data URLs or host them on the same page.

Can I convert a website URL to PDF?

Not directly, because browsers block one site from reading another. Save the page as .html with Ctrl+S or Cmd+S and upload the file, or use your browser's Print › Save as PDF.

Does HTML to PDF run JavaScript?

No. Scripts are disabled for safety, so content created by JavaScript will not appear. Print such pages from the browser instead.

Can I paste HTML code instead of uploading a file?

Yes. Paste your HTML into the text box and click Convert to PDF. The PDF downloads as webpage.pdf.

Is CSS supported?

Yes. Inline styles and CSS inside <style> tags are applied. External stylesheets from other servers may not load, so copy them into the page.

Why are some images missing in the PDF?

Images hosted on servers that do not allow cross-origin access cannot be drawn. Embed them as data URLs or host them alongside the HTML.

Is the text in the PDF selectable?

Yes. The converter writes real PDF text, so you can select, copy and search the content of the PDF.

Can I save an email receipt as a PDF with HTML to PDF?

Yes, if you can save or copy the email as HTML. Many email apps let you save a message as an .html file or view its source. Upload that file or paste the code, then convert. Images hosted on servers that block cross-origin access may not appear.

Written and tested by the LucyPDF team · Last updated