Convert HTML to PDF

Paste HTML or open an .html file and turn it into a tidy, text-based PDF. Headings, paragraphs, lists, tables, code blocks, links and embedded images are kept; scripts never run and nothing is fetched from the web. Live website URLs are not supported.

Drag & drop an HTML file here

or paste HTML code

HTML, HTM

Overview

What is HTML to PDF?

HTML to PDF turns HTML code into a PDF document. You can paste the code or open an .html file, check a safe preview, and download a PDF with real, selectable text. Headings, paragraphs, bold and italic text, bulleted and numbered lists, tables, code blocks, quotes, clickable links and embedded images are all carried over.

There is one thing this tool does not do. It does not take a live website address and capture the page. Doing that safely needs a sandboxed browser running on a server, plus protection against requests to private networks, and that is not available here. To convert a page you can see in your browser, save it as an HTML file first, or use the browser's own Print → Save as PDF.

How it works

How to convert HTML to PDF

  1. Add the HTML

    Open an .html file, paste code, or start from the example.

  2. Preview safely

    The Page preview tab renders the HTML in a sandbox with scripts disabled and remote loading blocked.

  3. Convert

    Pick A4, Letter or Legal and a body text size, then convert. The PDF tab shows every page.

  4. Download

    Save the PDF, or continue to Add Page Numbers or PDF Compressor.

Examples

Examples: input and output formats

In the HTMLIn the PDF
<h1>–<h6>Bold headings at decreasing sizes
<p>, <b>, <i>, <u>, <sup>Wrapped paragraphs with inline styles
<ul>, <ol start="3">, nested listsBullets and numbers with indentation
<table> with <th>Bordered table; header row repeated on new pages
<a href="https://…">Clickable link
<img src="data:image/png;base64,…">Embedded image
<img src="https://…">Skipped (nothing is downloaded)
<script>, <iframe>, forms, CSSNot used

Safety

Why scripts never run

HTML from an unknown source can contain scripts, tracking pixels or embedded pages. The converter never executes the code. It reads the HTML as a document tree and keeps only the content elements. Scripts, iframes, forms, objects and event handlers are dropped.

The preview is a sandboxed frame with scripts, forms and pop-ups disabled. Its content security policy blocks every request except inline data: images. Converting a page therefore sends nothing anywhere, including to tracking pixels.

Kept
Text structure, links, data: images.
Dropped
Scripts, iframes, forms, event handlers, remote images.
Not applied
CSS colours, fonts, layout, floats, grids.

Use cases

Use cases

Generated reports

Scripts and dashboards often export HTML. Turn that into a PDF to attach to an email or ticket.

report.htmlreport.pdf

Saved web articles

Save an article as "Webpage, HTML only", open it here and get a clean, ad-free reading copy.

Ctrl+Sarticle.pdf

Documentation snippets

Paste HTML produced by a Markdown converter and get a printable handout.

Markdown → HTMLPDF

Tips

Tips for good results

  • Use real heading tags (<h1>, <h2>) rather than large styled <div> text, so headings come through as headings.
  • Mark the first table row with <th> cells so it repeats as a header when the table continues on the next page.
  • Embed small images as data: URLs if they must appear in the PDF; image converters can produce them.
  • When saving a page from your browser, choose "Webpage, HTML only" so you get a single .html file.
  • For a pixel-exact copy of a styled page, use the browser's Print dialog and "Save as PDF" instead.
  • Long tables split across pages automatically; rows are never cut in half.

Limitations

Limitations

No live URLs

Web addresses cannot be converted. Save the page as HTML first, or use the browser's Print → Save as PDF for an exact visual copy.

CSS is not applied

The PDF uses a clean document style. Colours, custom fonts, columns, flexbox and grid layouts are not reproduced.

Images

Only images embedded as data: URLs (PNG or JPEG) are included. Linked images are not fetched.

Fonts and size

Text is set in Liberation Sans (Latin, Greek, Cyrillic) and code in Courier. HTML up to 5 MB is supported.

Privacy

Privacy

The HTML is parsed and the PDF is created in your browser. Nothing is uploaded, and the preview cannot contact other sites.

Related tools

Related tools

Frequently Asked Questions

Can I convert a website by entering its URL?

No. Converting live web addresses needs a secure server-side browser, which is not available here. Save the page as an .html file and open it in this tool, or use your browser's Print → Save as PDF.

Why does my PDF look different from the web page?

CSS is not applied. The converter keeps the content and structure (headings, lists, tables, links, images) and lays it out in a clean document style, so colours, fonts and page layouts are not copied.

Is it safe to paste HTML from an unknown source?

Yes. Scripts are never run, iframes and forms are dropped, and the preview is sandboxed with all network requests blocked, so the HTML cannot load trackers or contact other sites.

Why are some images missing?

Only images embedded in the HTML as data: URLs are included. Images linked by web address are not downloaded, to keep the conversion offline and private.