BlogDada

Home / Tools / HTML to PDF Converter

HTML to PDF Converter Online

Paste your HTML or upload a file, see exactly how it will look on the page, and download a PDF. Free, instant, and your files never leave your device.

Tip: “Download PDF” keeps the layout exactly; “Print to PDF” keeps the text selectable.

Live page preview

A4 portrait · 12 mm margins

Convert HTML to PDF in your browser, free

PDF is the format everyone can open, and it looks the same on every device. HTML is how the web is written. Turning one into the other usually means installing software or trusting a website with your files. This HTML to PDF converter online does it differently: everything happens inside your own browser, so your invoices, reports and contracts are never uploaded anywhere.

Paste your HTML code or drop in an .html file. The preview immediately shows your content laid out on a real page, at the exact size and margins you choose. When it looks right, click Download PDF and the file saves straight to your device. There's no sign-up, no watermark and no limit on how many documents you convert.

It handles complete web pages as well as fragments, with CSS, tables, web fonts and images all supported. Whether you're producing a one-page invoice or a fifty-page report, the conversion takes seconds.

How to convert HTML to PDF

  1. Add your HTMLPaste the code into the editor, drag an HTML file onto it, or click Upload file. Tap Sample to see a working example first.
  2. Choose your page setupPick A4, Letter or Legal, portrait or landscape, and set the margin in millimetres. The preview updates instantly.
  3. Check the previewThe preview panel shows your content at the real page width, so you can catch anything that overflows before you convert.
  4. Download or printClick Download PDF for a pixel-perfect copy, or Print to PDF to use your browser's own PDF engine and keep the text selectable.

Two ways to make your PDF

The tool offers two conversion modes because they suit different jobs. Neither is better in every situation, so it's worth knowing the difference.

Download PDFPrint to PDF
How it worksRenders your page to an image, then places it in a PDF, splitting it across pagesSends the page to your browser's built-in print engine
TextPart of the image, so not selectableSelectable, searchable and copyable
File sizeLargerUsually much smaller
Layout fidelityExactly what you see in the previewVery good; the browser reflows text across pages
Page breaksAutomatic, by page heightFollows your CSS page-break rules
Best forCertificates, posters, designs, anything where layout matters mostReports, résumés, invoices, anything text-heavy

Tip: if you need to search inside the finished PDF or copy text out of it, use Print to PDF and choose "Save as PDF" as the destination in the print dialog.

What you can convert

  • Invoices and receipts generated from an HTML template, with your logo and totals.
  • Résumés and CVs written in HTML and CSS, exported cleanly to one or two pages.
  • Reports and dashboards with tables, headings and charts rendered as images.
  • Certificates, tickets and labels that need an exact layout.
  • Email newsletters saved as a PDF record before sending.
  • Documentation and blog drafts for offline reading, printing or sharing with a client.
  • AI-generated HTML from a chatbot or code editor, when you need a document you can send.

Preparing HTML that converts well

Keep the layout simple and fluid

A page designed for a wide screen rarely fits on a sheet of paper. Use relative widths such as percentages instead of fixed pixel widths, avoid very wide tables, and let text wrap. If something is cut off at the right edge of the preview, it will be cut off in the PDF too.

Put your CSS inside the file

Styles written in a <style> block or inline with the style attribute always work. A separate stylesheet hosted on a website will only load if that site allows it, so when in doubt, paste your CSS into the HTML.

Embed images where you can

Images on the same site, or embedded as data URIs (data:image/png;base64,…), always appear. Images pulled from another website may be blocked by that site's cross-origin rules in image mode. If a picture goes missing, embedding it fixes it.

Set a page size in your CSS for print mode

For the sharpest results in Print to PDF mode, add an @page rule to your HTML:

@page { size: A4 portrait; margin: 15mm; }
body { font-family: Georgia, serif; line-height: 1.5; }

Controlling page breaks

By default the content flows from page to page. When you want a section to start on a fresh page, or you want to stop a table splitting awkwardly, use the standard CSS print properties:

.chapter { break-before: page; }          /* start on a new page */
.keep-together { break-inside: avoid; }   /* don't split this block */
tr, img { break-inside: avoid; }
thead { display: table-header-group; }    /* repeat table headers */

These rules are followed in Print to PDF mode. In image mode the page is split purely by height, so add spacing where you want a natural break.

Building an HTML template for documents

If you generate documents regularly, it pays to build one HTML template and reuse it. Keep the structure simple: a header block with your logo and company details, a body section for the content, and a footer with terms or contact details. Use a table only where you genuinely have tabular data, such as line items, and set widths in percentages so the table always fills the page.

Set your base font size in points rather than pixels when the output is meant for print, because points map directly to what the printer uses. Around 11pt to 12pt suits body text, with headings at 16pt to 24pt. Give paragraphs a line height of about 1.5 so the page breathes, and keep your colour palette simple: dark text on white reads best and uses far less ink if the file gets printed.

When the document is data-driven, such as an invoice or a certificate, keep placeholder markers like {{name}} in the template and replace them before you paste the HTML in. Many people generate the finished HTML from a spreadsheet, a script or an AI assistant and then paste it straight into this converter.

Keeping your PDF file small

File size matters when you're emailing a document or uploading it to a portal with a size limit. A few habits keep PDFs light:

  • Use Print to PDF for text-heavy documents. Text stored as text takes a fraction of the space of an image of that text.
  • Resize images before embedding them. A photo 4,000 pixels wide adds megabytes and looks no better on an A4 page than one 1,600 pixels wide.
  • Lower the image quality setting to Standard when the document is a draft or will only be read on screen.
  • Avoid full-page background colours and images unless the design needs them; they are the single biggest cause of large files.
  • Split very long documents into sections and convert them separately, then merge them if you need one file.

Why convert HTML to PDF at all?

HTML is designed to adapt. It reflows to fit a phone, a tablet or a widescreen monitor, and it changes with the browser, the fonts installed and the reader's settings. That flexibility is perfect on the web and a problem when you need a fixed record.

A PDF freezes the layout. The recipient sees the same page you saw, with the same fonts, spacing and page breaks, whether they open it on Windows, macOS, Android or iPhone. PDFs are also the standard for anything official: invoices, quotes, contracts, application forms, school assignments and reports. They can be printed reliably, archived, signed and attached to an email without anything shifting.

There's a practical reason too. HTML files depend on their stylesheets, images and fonts. Send someone an .html file and half of it may be missing. A PDF is a single self-contained file that always opens.

Your files stay private

Most online converters work by uploading your file to a server, converting it there and sending it back. That's fine for a public web page, but it means handing your data to a third party, which can be a problem for invoices with customer details, medical documents, legal drafts or anything covered by privacy rules.

This converter never uploads anything. The HTML is rendered inside a sandboxed frame in your own browser, and the PDF is assembled on your device before the download starts. You can even load the page once and then use it offline. For extra safety, JavaScript inside your HTML is disabled unless you switch it on, so pasted code can't run anything unexpected.

Troubleshooting common problems

ProblemWhy it happensFix
Content is cut off on the rightThe layout is wider than the pageUse percentage widths, switch to landscape, or reduce the margin
Images are missingThey're hosted elsewhere and blocked by cross-origin rulesEmbed them as data URIs or use Print to PDF
Fonts look differentThe web font didn't loadKeep the Google Fonts link in your HTML, or choose a system font
Text isn't selectableImage mode was usedUse Print to PDF instead
The page is blankThe content is built by JavaScriptTick "Run JavaScript inside the HTML", then refresh the preview
Colours are missing when printingBrowsers skip backgrounds by defaultTurn on "Background graphics" in the print dialog
A big document is slowVery long pages take time to renderLower the image quality setting, or split the document

Converting a live web page

For security, browsers don't let one website read the contents of another, so no in-browser tool can fetch a URL and convert it. There are two easy ways around this. Open the page you want, press Ctrl+S (Cmd+S on a Mac) and save it as a complete web page, then upload the saved .html file here. Or open the page and use your browser's own Print, then choose Save as PDF.

Developers who need to convert pages automatically, on a server, usually reach for headless Chrome through Puppeteer or Playwright, or a tool such as wkhtmltopdf or WeasyPrint. Those run outside the browser and can fetch any URL, but they need installation and a server. For one-off documents, an online converter like this one is faster.

Frequently asked questions

Is this HTML to PDF converter online free?

Yes. It is completely free, has no watermark, no sign-up and no daily limit.

Are my files uploaded to a server?

No. The conversion happens entirely in your browser, so your HTML never leaves your device. That makes it safe for invoices, contracts and other private documents.

What is the difference between Download PDF and Print to PDF?

Download PDF renders the page as an image inside the PDF, which preserves the layout exactly. Print to PDF uses your browser's own print engine, so the text stays selectable and searchable and the file is usually smaller.

Can I convert a web page by entering its URL?

Browsers block reading other websites' pages for security reasons, so the tool works with HTML you paste or upload. To convert a live page, open it, save it with Ctrl+S, then upload the saved HTML file.

Does it support CSS and images?

Yes. Inline and internal CSS, web fonts and images all work. Images hosted on other sites may be skipped in image mode if that site blocks cross-origin access, so embed images as data URIs for best results.

How do I control page breaks?

Add CSS such as .new-page { break-before: page; } to the element that should start a new page. Page breaks are respected in Print to PDF mode.

Does it run JavaScript in my HTML?

Not by default, for safety. Tick the Run JavaScript option if your page builds content or charts with scripts.

Which page sizes are supported?

A4, US Letter and US Legal, in portrait or landscape, with margins you can set in millimetres.

Make your PDF now

Whether it's an invoice, a résumé or a report, this HTML to PDF converter online turns your markup into a finished document in seconds, without uploading a thing. Go back to the converter, paste your HTML and download your PDF.

More free tools from BlogDada