HTML to PDF
Convert HTML pages and web content to PDF format online for free. Perfect rendering, instant conversion. No signup, no software download required.
HTML to PDF converts web content, HTML strings, or entire web pages into cleanly rendered PDF documents. The tool includes 5 pre-built CSS themes — Default (browser styles), Dark Mode (inverted), Print-friendly (serif fonts, no shadows, optimized for physical printing), Minimal (content-only, no decoration), and Custom (bring your own CSS). The rendering pipeline captures your HTML in a hidden container at the target page dimensions, then converts to PDF via pdf-lib with full support for margin presets and custom page sizes.
Unlike Puppeteer-based server tools (which require Node.js and Chromium), our converter runs entirely in the browser and applies CSS page-break markers automatically — add .page-break classes to force breaks at specific points. The theme system is genuinely useful: "Print-friendly" automatically strips box shadows, unifies fonts to serif, removes background colors, and adds margin whitespace, so websites that look fine on screen come out actually readable on paper. The Custom theme accepts arbitrary CSS injected before rendering.
Features
- 5 built-in CSS themes — Default, Dark Mode, Print-friendly, Minimal, Custom
- Runs in browser — no Puppeteer, no Chromium, no server dependency
- Custom CSS injection — paste your own styles to override anything
- 4 page sizes (A4, Letter, Legal, A3) plus custom dimensions in points
- 4 margin presets (None, Normal, Wide, Minimal) plus custom margins
- Automatic page break support via .page-break CSS class
- Handles embedded images, tables, lists, and most CSS layouts
- Applies print media query stylesheets automatically for better paper output
How to use HTML to PDF
- Paste your HTML source, drop an .html file, or enter a URL to convert
- Pick a theme (Print-friendly is the best default for physical printing)
- Pick the page size and margin preset — A4 with Normal margins works for most use cases
- Optionally inject custom CSS for fine-grained control over the output
- Click Convert. The tool renders your HTML in a hidden container at the target width, captures each page region, and writes them into the PDF.
Frequently asked questions
What makes the "Print-friendly" theme different from regular browser printing?
Regular browser printing uses the website's screen stylesheet with minor adjustments — background colors still render, shadows still show, fancy fonts still apply. Print-friendly actively strips decorations: unifies all text to a serif font for readability, removes box shadows and gradients that don't photocopy well, removes background colors to save ink, and adds proper margin whitespace. The result is closer to a printed book or report than a screenshot of a webpage.
How do I force a page break at a specific point in my HTML?
Add <div class="page-break"></div> (or class="page-break" on any element). The converter detects these markers and forces a new PDF page at that position. Useful for multi-chapter documents where each section should start on its own page.
Does it handle complex CSS like flexbox and grid?
Mostly yes — the renderer supports modern CSS including flexbox, grid, transforms, and most media queries. Some edge cases (CSS filters, backdrop filters, some animation states) don't translate to PDF. For critical-layout documents, preview the output before sending to print.
Will images embedded in the HTML appear in the PDF?
Yes, as long as the images are accessible (either absolute URLs, data: URIs, or same-origin relative paths). For security reasons the converter won't fetch cross-origin images without explicit CORS headers — if an image is missing from the output, it's usually because the source blocks cross-origin fetches.
Can I convert a whole website or just individual pages?
One page at a time: paste the HTML of each page you want to convert. The tool does not crawl or fetch websites.