🌐 Free · Private · Client-Side

Convert HTML to PDF

Paste HTML code or upload an .html file, watch the live preview, then download a clean PDF. Custom page size, margins, page numbers, and quality control — all running in your browser with nothing uploaded.

🌐 HTML to PDF · ready
HTML source · editable 0 chars
Live preview A4 · Portrait
🌐

No HTML yet

Paste HTML code on the left, or click "Load sample" for a demo document you can edit and convert.

Tip: the preview shows the content flow. The final PDF uses the page size, margins, and quality settings from the sidebar. Add <div style="page-break-before: always;"></div> anywhere in your HTML to force a new page.

📋 Document summary

Characters—
Est. words—
Page size—
Rendered at—
PrivacyNothing uploaded

What HTML to PDF actually does 🌐

HTML is a description of content. A PDF is a fixed page. Converting HTML to PDF means taking the description, asking the browser to lay it out as if on a page, capturing that laid-out result as pixels, and placing those pixels into a PDF page.

That middle step — capturing the layout as pixels — is the key. Unlike Word to PDF (where the source has selectable text that can be transferred), HTML to PDF is inherently a rasterization step. The browser renders the HTML into a canvas, and the canvas is embedded in the PDF as an image. The result looks exactly like the preview, but the text is not selectable.

This tool uses html2pdf.js, which internally runs html2canvas (to capture the DOM as a canvas) and jsPDF (to write the PDF). Everything runs in your browser — no server renders your page, no template engine processes your HTML, no third party sees your content.

Honest note about text: the output PDF is image-based. You can select pixels, but you can't select words, copy a paragraph, or Ctrl+F search. If you need selectable text in the final PDF, use our Create PDF tool, or paste the content into Word and use our Word to PDF converter.

When HTML to PDF is the right tool 📋

There's a specific kind of content where HTML to PDF shines, and a specific kind where it doesn't. Knowing the difference saves time.

TaskHTML to PDF works well?Why
Printing an invoice layout built in HTML/CSS✅ YesLayout precision is what this tool is for
Turning a styled report template into a PDF✅ YesThe CSS styling carries through faithfully
Archiving a static web page's content✅ YesRendered as it appears in the browser
Creating a certificate or certificate-style document✅ YesBackgrounds, borders, images all render
Getting selectable/searchable text in the PDF❌ NoText becomes an image during rendering
Converting a live web page from a URL⚠️ PartialSave the HTML source first, then paste it here
Pages with heavy JavaScript content❌ NoScripts aren't run — only the static HTML renders
Documents with fixed headers/footers⚠️ PartialFixed positioning doesn't repeat across pages reliably

Supported HTML and CSS features 📐

CategorySupportNotes
Headings, paragraphs, lists✅ FullAny HTML tag works
Bold, italic, underline✅ FullInline and via CSS
Tables✅ FullWith borders, backgrounds, and cell spacing
Images (base64 or CORS-enabled)✅ FullRemote images without CORS headers may fail
Background colors, gradients✅ FullEnabled by the background graphics toggle
Borders, radius, box-shadow✅ FullRendered as expected
Flexbox and CSS Grid⚠️ PartialSimple layouts work; complex ones may shift
Web fonts⚠️ DependsFonts must be loaded before rendering
CSS transforms and animations❌ Not supportedStatic rendering only
position: fixed / sticky⚠️ PartialRenders once at the top of the first page
JavaScript-generated content❌ Not supportedScripts are sandboxed and won't execute
SVG graphics✅ FullInline SVG is captured like any other element

How to convert HTML to PDF — step by step 📋

  1. Paste your HTML or upload a file. The editor accepts any HTML — a full document, or just a fragment. Upload accepts .html and .htm files.
  2. Watch the live preview. As you type, the preview on the right re-renders with a 400ms debounce. This shows you the exact layout the PDF will capture.
  3. Adjust page size and orientation. A4 is the international default; Letter is the US standard. A3 is for wide tables or posters.
  4. Set margins. 15mm is a good default for most content. Reduce to 5mm for full-bleed designs, increase to 25mm for formal documents.
  5. Choose render quality. Standard (2×) is the sweet spot. Draft (1.5×) for faster generation on long documents. High (3×) for print-quality output.
  6. Toggle extras. Page numbers, background graphics, auto-fit width.
  7. Click Download PDF. The tool renders the preview, captures it as a canvas, and writes a PDF.

Page breaks in HTML content 📄

When content is longer than one page, html2pdf splits it at natural break points. You have two ways to influence this:

Tip: if a heading sits alone at the bottom of a page with its paragraph on the next, wrap them in a container with page-break-inside: avoid;. That's the standard CSS approach and html2pdf respects it.

Why a browser-based HTML to PDF tool matters 🔒

Most HTML to PDF services upload your HTML to a server, render it with headless Chrome, and return the PDF. That's fine for a public invoice template. It matters more when the HTML contains internal data — customer names, employee details, financial figures — that shouldn't be sitting on someone else's disk.

This tool never leaves your browser. The HTML is rendered in a sandboxed iframe on your device, captured as a canvas, and written as a PDF by jsPDF — all in the same tab. No upload step exists, so there's nothing to intercept.

Who uses HTML to PDF? 👥

Common problems and how to fix them 🛠️

"The output PDF looks different from the preview"

The preview and the final render should be identical since both use the same iframe. If they differ, the most common cause is images that finished loading after the render started. The tool waits for images, but very slow-loading assets or ones from unreliable servers can still miss the capture. Try running the download again.

"Images are missing or replaced with blank space"

Remote images need CORS headers on the source server. If a website blocks cross-origin image requests (which many do), the tool can't capture them. The fix: download those images and embed them as base64 data URIs in your HTML, or host them somewhere with permissive CORS (GitHub raw URLs work well).

"Web fonts don't render in the PDF"

If your HTML uses a web font (Google Fonts, Adobe Fonts, etc.), the font needs to finish loading before the render starts. The tool waits for document.fonts.ready but this only covers fonts that the browser actually fetches. If a font URL is broken, the fallback font is used. To guarantee rendering, embed the font as a base64 @font-face rule, or use system fonts (Arial, Helvetica, Georgia, Times).

"Page breaks happen in the wrong place"

Add explicit page-break controls to your HTML. Without them, html2pdf breaks at the nearest natural boundary — usually a margin between elements. Wrapping logical blocks in a container with page-break-inside: avoid; gives much better results.

"The output file is huge"

Rendered images always produce larger PDFs than vector text. Try reducing render quality to Draft, lowering JPEG compression, or reducing the number of large images. A typical one-page HTML invoice at Standard quality ends up around 200–400 KB.

"Long documents take a while"

Rendering 50+ pages of HTML at high quality can take 10–30 seconds. The progress bar shows what's happening. If it feels stuck, try lowering the quality to Draft for a first pass, then regenerate at High quality once you know the layout is right.

Is it safe to use this tool? 🔐

Yes. Here's exactly what happens when you use this tool:

  1. You paste or upload HTML locally.
  2. The HTML is injected into a sandboxed iframe (scripts are blocked).
  3. The rendered iframe is captured as a canvas on your device.
  4. The canvas is written into a PDF by jsPDF.
  5. You download the PDF back to your computer.

At no point does the HTML leave your device. No data is sent to SkillsInsider's servers. No tracking cookies watch your conversion. Turn off Wi-Fi after the page loads and it still works perfectly.

Frequently Asked Questions

Is this HTML to PDF converter free?+

Yes — completely free. No sign-up, no watermark, no page limits, no per-file fee.

Are my HTML files uploaded to a server?+

No. Everything runs locally in your browser using html2pdf.js. Your HTML never leaves your device.

What HTML and CSS features are supported?+

Headings, paragraphs, bold, italic, lists, tables, images, background colors, borders, and basic CSS layout. Complex features like JS-generated content, position:fixed elements, animations, and CSS transforms may not render correctly.

Can I convert a live website to PDF?+

Not directly — this tool works from HTML source, not a URL. If you want a live webpage as a PDF, use your browser's Print → Save as PDF feature. If you have the HTML source (for example, from View Source), you can paste it here.

Will the text be selectable in the PDF?+

No. HTML to PDF conversion is inherently a rasterization step — the HTML is rendered to a canvas, then the canvas is embedded in the PDF as an image. The output looks identical but the text is not selectable. If you need selectable text, use our Create PDF tool or export from a text-based source.

How do I add page breaks?+

Add <div style="page-break-before: always;"></div> anywhere in your HTML to force a new page starting at that point. You can also add page-break-inside: avoid to a div to keep its content on one page.

Can I upload an .html file?+

Yes. Click the upload box in the sidebar and select an .html or .htm file. The content is loaded into the editor and the preview updates automatically.

Does it work offline?+

Once the page has fully loaded, yes. Turn off Wi-Fi and it still converts.