Skip to content
CastPDF
Free tool

HTML to PDF converter

Paste your HTML and CSS, press Convert, and download a PDF made by the same engine as our HTML to PDF API. It is free, needs no account and keeps nothing: your markup is rendered once and the file comes straight back to your browser.

  • No sign-up
  • Nothing stored
  • Updated

Try it now

A fragment or a full document, up to 200 KB with the CSS.

CSS (optional)

Added before your HTML, like a stylesheet.

Free, no sign-up. Nothing is stored. A short human check runs when you press the button.

Page one of the PDF this converter makes from its sample HTML: an autumn course catalogue with a table of four courses.
The sample HTML as a PDF, page one.

How to use the HTML to PDF converter

  1. Paste your HTML. A fragment such as a table, or a full document with its own <head>. The sample shows a course catalogue.
  2. Add CSS if you need it. Open the CSS box and paste your styles. They are added before your HTML, like a stylesheet.
  3. Pick the paper. Choose A4, Letter, A5 or Legal, and portrait or landscape.
  4. Convert and download. Press Convert to PDF. A short human check runs in the background, then the PDF downloads.

What this converter does

The converter loads your HTML in Chromium, the browser engine behind Chrome, and prints it to PDF. Fonts, flexbox, grid and modern CSS behave the way they do in your browser. What you see in a print preview is close to what you get.

It is meant for one-off documents: a page you built in a hurry, a table from a report, a printable version of an email. When the same document is needed again and again with new data, that is what the PDF generation API is for.

  • break-inside: avoid on a row or a card keeps it on one page.
  • break-before: page starts a new page, for a cover or a chapter.
  • thead repeats on every page when a table runs long.
  • @page { margin: 20mm; } sets the margins from your CSS.
  • @media print rules apply, so you can hide navigation or buttons.

The print CSS guide explains each rule with examples. Running headers and page numbers need print mode, which the API offers; this free converter uses the faster screen-style mode.

When the PDF does not look right

  • The page is cut off on the right. A fixed width such as width: 1200px is wider than the paper. Use percentages or max-width: 100% instead.
  • A table row is split in half. Add tr { break-inside: avoid; } so each row stays on one page.
  • The background colours are missing. Add -webkit-print-color-adjust: exact; to the elements that need their colour.
  • The text is tiny. Set a font size in points, such as body { font-size: 11pt; }, since paper has no screen width to scale to.

These fixes work the same in the API, so a page that looks right here will look right in production.

What the converter will not do

Scripts in your HTML do not run, and nothing is fetched from other websites. Images from the web are left out; embed them as data: URLs instead. These rules keep the free tool safe for everyone, and they mean a page renders the same way every time.

Every PDF carries a small "Made with CastPDF" line at the bottom of each page. PDFs from the API on a paid plan do not.

Limits of the free tool

Limits of the free tool
InputUp to 200 KB of HTML and CSS
OutputA PDF of up to 20 pages, A4, Letter, A5 or Legal
Not supportedScripts, and images or fonts from other websites
How often10 requests a minute and 100 a day from one address
On every PDFA small "Made with CastPDF" line in the footer

Automate this

Doing this every week? The same engine runs behind the CastPDF API, with no footer on paid plans and 100 free PDFs a month to start.

With the API

Send the same HTML and CSS to POST /v1/pdf with your API key. The quickstart has the request in curl, Node.js and Python.

From a spreadsheet

Save the HTML as a template with Liquid fields, then make one PDF per row of a CSV or XLSX file with a batch.

In a no-code workflow

Common questions

Is this HTML to PDF converter really free?

Yes. There is no account and no watermark across the page, only a small CastPDF line in the footer. The free tools allow 10 conversions a minute and 100 a day from one address.

Do you keep my HTML or the PDF?

No. The HTML is rendered once and the PDF is sent straight back. Nothing is stored, and the content is never written to our logs.

Why are the images missing from my PDF?

The free converter loads nothing from other websites. Put images in the HTML as data: URLs, or use the API, which can load images from the web.

Can I use JavaScript to build the page?

Not in the free converter: scripts are switched off. Render your page in a browser first, then paste the finished HTML.

How large can my HTML be?

Up to 200 KB of HTML and CSS together, and the PDF may have up to 20 pages. For bigger documents, use the API with a free account.
All free tools

Your first PDF in five minutes.

Pick a template, create a free test key and send one request. 100 PDFs a month are free, and you never need a card to start.