HTML to PDF Converter

Convert HTML code or any webpage URL to a PDF document. Preview before downloading — free, no watermarks, no signup.

How it works

1Paste HTML or enter a URL
2Set page size & options
3Preview & download PDF
Live Preview

Page Settings

Print Background Colors

Include CSS background colors & images

Clean Mode

Strip complex CSS & fix broken layouts (ideal for InDesign/exported HTML)

Output Mode
Alt engine — try if both modes fail

Live Preview

PDF preview will appear here

Generate a PDF to preview it before downloading

Preview Before Download

See your PDF exactly as it will look before saving to your device.

HTML & CSS Support

Full CSS rendering including flexbox, grid, fonts, and colors.

No Watermarks

Clean PDF output with no branding or watermarks added.

Multiple Page Sizes

A4, Letter, A3, Legal, A5 — portrait and landscape orientations.

When to Use HTML to PDF Conversion

Common Use Cases

  • Generating invoices, receipts, and reports from HTML templates
  • Converting blog posts or documentation to shareable PDFs
  • Saving styled web content for offline reading or archiving
  • Creating printable flyers, certificates, and tickets from HTML
  • Exporting email templates and newsletters to PDF format

Supported Features

CSS Layout

Flexbox, CSS Grid, floats, absolute positioning, and multi-column

Typography & Fonts

System fonts, Google Fonts (via @import), custom web fonts

Images & Media

Inline base64 images, SVGs, and externally-hosted images

Print CSS

@media print rules, page breaks, and CSS page size declarations

Tips for Best PDF Results

1

Use inline or embedded CSS

Place styles in a <style> tag or as inline attributes. External CSS files won't load unless hosted at a public URL.

2

Enable "Print Background"

Turn on background printing to preserve colored sections, dark themes, and banner backgrounds in your PDF.

3

Use @media print rules

Add CSS like page-break-before: always to control where new pages start in multi-page documents.

Why Your PDF Doesn't Look Exactly Like the Browser

The most common surprise with HTML-to-PDF conversion is that print rendering follows different rules than screen rendering. When the server-side browser engine paginates your HTML, it switches to the print media type: any @media print rules in your CSS take effect, and rules scoped to @media screen are dropped. Viewport units like vh and vw now resolve against the paper size rather than a monitor, and background colors are stripped by default print convention — which is exactly what the "Print Background Colors" toggle overrides.

Pagination itself is the other big difference. A web page is one infinite scroll; a PDF is a stack of fixed boxes, and the engine has to decide where to cut. You can control those cuts with CSS: break-before: page (or the older page-break-before: always) forces an element to start a fresh page — ideal before each <h1> or invoice. break-inside: avoid keeps a table row, figure, or signature block from being sliced in half at a page boundary, and the orphans and widows properties stop single lines of a paragraph from being stranded alone at the top or bottom of a page.

The three output modes trade fidelity against usability. Normal uses the browser engine's print pipeline, producing real vector text that is selectable, searchable, and compact — the right default. High Fidelity screenshots each page to a PNG and assembles those images into the PDF: pixel-identical to the live preview, but text can no longer be copied or indexed and files get noticeably larger. WeasyPrint is a dedicated CSS paged-media engine with strong support for @page rules, but it does not execute JavaScript, so it suits static, print-oriented documents.

Frequently Asked Questions

Why did my background colors and images disappear?

Browsers omit backgrounds when printing to save ink, and PDF generation inherits that behavior. Enable the "Print Background Colors" toggle in Page Settings — it is on by default here, so if backgrounds are still missing, check whether your CSS applies them only inside an @media screen block.

A table or image gets chopped in half at a page boundary. How do I stop that?

Add break-inside: avoid (and page-break-inside: avoid for older engines) to the element's CSS. For long tables, repeat headers by using a real <thead> element rather than styled <div> rows.

Does JavaScript in my HTML run before conversion?

In Normal and High Fidelity modes the page is rendered in a real browser engine on the server, so scripts execute before the capture — charts drawn on load will appear. WeasyPrint mode does not run JavaScript at all; anything generated client-side will be missing there.

Can I convert a page that requires a login?

No. URL mode fetches the page as an anonymous visitor with no cookies or session, so it only works for publicly reachable pages. For content behind a login, open the page yourself, save the HTML (or copy the relevant markup), and use the HTML Code tab instead.

Why is the generated PDF so much bigger in High Fidelity mode?

High Fidelity stores every page as a full-resolution PNG image, while Normal mode stores compact vector text and drawing commands. A ten-page text document might be 100KB in Normal mode and several megabytes as images. Use High Fidelity only when Normal mode visibly breaks the layout.

Is my HTML or URL stored on the server?

The input is sent over HTTPS, rendered server-side, and the finished PDF is returned directly in the response. Nothing is retained after the conversion completes.

Related PDF Tools

More PDF tools you might need

Discussion

Start the conversation

Leave a comment

For notifications only, never displayed

Markdown supported0/2000

Be respectful and constructive

Loading comments...

Report something?