HTML to PDF Converter – Save Web Content as a PDF

Paste HTML or open an .html file, check a safe preview, and save the rendered content as a searchable PDF. Processing stays in your browser.

No HTML uploadScripts never runNo accountNo watermark

HTML source

HTML and inline CSS are preserved. Scripts, event handlers, embedded frames, plug-ins, and automatic redirects are removed.
0 characters · 2 MiB maximum
Private by default: source and cleaned HTML stay in this tab and are never sent to Starlight Tools. External resources are blocked unless you opt in. Normal site analytics and advertising may load subject to your consent choices, but this tool does not send HTML, filenames, URLs, or conversion details to analytics.

Advertisement

Safe preview

No preview built
Your rendered HTML will appear hereAdd HTML and choose Build preview. Links are non-interactive in the preview.

How to convert HTML to PDF

  1. Add the HTML. Paste source into the editor or open a .html or .htm file up to 2 MiB.
  2. Choose print settings. Select A4, Letter, or Legal paper, orientation, margins, and a filename. Only allow external resources when you trust their hosts.
  3. Build and inspect the preview. The converter removes executable content and renders the cleaned document in an isolated frame.
  4. Save the PDF. Choose Save as PDF, select a PDF destination in the print dialog, confirm its settings, and save.

What is preserved and what is removed

HTML featureConverter behaviorWhat to check
Text, headings, tables, lists, SVG, and inline CSSPreserved for browser rendering and printingPage breaks, overflow, colors, and font fallback
Embedded data imagesPreserved without a network requestImage resolution and file size
HTTPS styles, images, and fontsBlocked by default; optional when explicitly enabledHost availability, privacy, CORS/font rules, and print backgrounds
JavaScript, event handlers, frames, plug-ins, and redirectsRemoved and additionally blocked by the preview sandbox and Content Security PolicyContent that originally depended on scripts will not appear
Forms and interactive controlsRendered as static, non-interactive contentCurrent values and print styling

Print and pagination tips

Use print CSS

The converter keeps your @media print rules. Add break-before, break-after, or break-inside where sections need controlled pagination.

Check backgrounds

Many browsers omit background colors and images unless “Background graphics” is enabled in the print dialog.

Avoid clipped content

Wide fixed layouts, large tables, and elements positioned off-page can clip. Try landscape orientation or responsive CSS such as max-width:100%.

The selected paper, orientation, and margin are added through a CSS @page rule. A browser or system print dialog can override those settings. The suggested filename also depends on browser behavior.

HTML to PDF converter FAQ

Is my HTML uploaded?

No. The HTML is parsed, cleaned, previewed, and printed inside your browser. Starlight Tools does not receive or store the source or output.

Does the converter run scripts in my HTML?

No. Script elements, event-handler attributes, embedded frames, plug-ins, refresh directives, and executable URLs are removed. The preview also uses a sandbox and restrictive Content Security Policy.

Why does Save as PDF open the print dialog?

Web browsers create PDFs through their native print dialog. Choose Save as PDF or a PDF printer, confirm paper size, orientation, margins, and backgrounds, then save.

Will the PDF text be searchable and selectable?

Usually yes. Browser printing preserves ordinary HTML text and vector content instead of converting the whole page to a screenshot.

Do CSS, images, and web fonts work?

Inline CSS and embedded data images work. HTTPS stylesheets, images, and fonts are blocked by default; enable external resources if you trust their hosts and need them.

Can relative image and stylesheet URLs work?

Yes when external resources are enabled and you provide an HTTPS base URL for the original page. Local sibling files cannot be read automatically from a selected HTML file.

Will the PDF exactly match the original web page?

Not always. Scripts and interactive embeds are intentionally removed, print CSS may change the layout, external resources can fail, and browsers paginate content differently. Review the preview and final PDF.

What is the HTML size limit?

The source limit is 2 MiB and the cleaned document is limited to 50,000 elements to reduce browser memory problems. Very complex pages may still print more reliably on a desktop computer.

Does it work on phones and tablets?

The editor and preview are responsive, but the final PDF workflow depends on the mobile browser and operating system. Desktop browsers generally provide more complete print controls.

Explore more tools