# HTML to PDF converter

> A free online tool that prints HTML and CSS you paste into a PDF using headless Chromium, with no account and no watermark.

Paste HTML, pick a page size, get a PDF. It is rendered by headless Chromium, so modern CSS, web fonts and JavaScript behave much as they do in a browser.

## Key facts

- Input: an HTML document with CSS, up to 256 KB per conversion.
- Output: a PDF in A4, Letter, Legal, A3 or A5, with your margins (10 mm by default), landscape and background options.
- Prints up to 10 pages in the free tool; JavaScript and web fonts run as in a browser.
- Free without an account: up to 10 conversions per minute and 50 per day per visitor, no watermark. Signed in, each render costs 1 credit (100 free credits every month).
- Files are deleted automatically: 10 minutes after conversion without an account, 1 day with a free account.
- Developers can run the same render with POST https://api.aiipworld.com/v1/render and an API key (see the PDF API page).

## Sources

- [W3C: CSS Paged Media Module Level 3](https://www.w3.org/TR/css-page-3/)
- [MDN: Printing (CSS)](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_media_queries/Printing)
- [Chrome DevTools Protocol: Page.printToPDF](https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-printToPDF)

Last reviewed: 2026-10-15

## How it works

1. Paste your HTML into the editor. A complete document with a style block works best.
2. Pick the page size, margin and orientation.
3. Complete the human check, then press Convert to PDF.
4. Download the file. It is deleted automatically after the time shown under the result.

## What this HTML to PDF converter does

This html to pdf converter renders your HTML and CSS in headless Chromium and prints the result as a PDF. Web fonts and JavaScript are applied before the page is printed.

## Page size, margins and orientation

The default page size is A4, with a 10 mm margin on all four sides. Landscape turns the page sideways. Backgrounds print by default in the API, and the web tool lets you switch them on or off.

The API also takes a custom width and height. Turn on prefer_css_page_size to let an @page rule set the size.

## Controlling page breaks

Use break-before and break-after to start or end a section on a new page. Set break-inside to avoid to keep a figure or card on one page.

## Images, fonts and CSS in your HTML

Images and stylesheets can come from public http or https addresses. Addresses on private networks and localhost are blocked. The render server has Noto fonts, including CJK and emoji, but not the fonts on your own computer. Load other fonts with @font-face from a public URL or a data URL.

## HTML to PDF with the browser's Print dialog or with this tool

Your browser's Print dialog can also save the open page as a PDF. This tool takes HTML you paste, or a URL, and prints it on a server. The PDF can be previewed before you download it.

## When to use the API instead

Use the API for headers and footers, page ranges, scale, or documents built in code. Send one request per document, then check the job until the result is ready. Webhooks and templates are not available yet.

## Turning HTML code, files and CSS into a PDF

If you came here looking for htmltopdf, the job is the same: HTML in, PDF out. Paste the code of your page, and the converter prints it with the page size and margins you choose.

An html file to pdf conversion works a little differently, because the tool takes pasted code rather than uploaded files. Copy the contents of the file from a text editor and paste them in.

For html css to pdf jobs, keep the CSS in a style block inside the same paste. A complete document with its styles works well.

## If the PDF does not look right

Backgrounds are missing: backgrounds print by default in the API. In the web tool, check that the backgrounds option is switched on.

A page break falls in the wrong place: put break-before or break-after on the element that should start or end a page. Add break-inside: avoid to a block that must stay on one page.

Fonts differ from your screen: the render server has Liberation and Noto fonts, not the fonts on your computer. Arial, Times New Roman and Courier New map to Liberation fonts, while Segoe UI or Roboto fall back to Noto Sans. For other fonts, use @font-face with a public URL or a data URL.

The output differs from the screen: the PDF uses print styles. In the API, set media to screen to use the screen styles.

## Free HTML to PDF converter: what is free and what is not

People who search for an html to pdf converter free of charge usually mean three things: no signup, no watermark and nothing to install. The web tool meets all three. Anonymous conversions start with a human check, and signed-in users skip the check and use credits instead.

A free html to pdf converter still has limits. The web tool takes up to 256 KB of HTML per conversion and prints the first 10 pages. Whether you convert HTML to PDF online free in the web tool or send the same HTML to the API, the PDF comes from the same headless Chromium engine.

## HTM files, HTML5 and pasted HTML code

An .htm file is the older three-letter form of .html, and it is handled the same way. To convert htm to pdf, open the file in a text editor, copy everything and paste it into the editor here. The same steps cover htm to pdf for a page you saved from a website. Links to local images or stylesheets will not load, because only public http and https addresses can be fetched.

Chromium renders HTML5 markup and modern CSS as a current browser does, so an html5 to pdf conversion needs no special setting. The most common job is html code to pdf: paste one complete document with its style block, pick the paper size and press the button. That is how you save html as pdf when the page lives only in your editor, and it is also the quickest way to turn html into pdf for a one-off document.

## HTML in PDF format: what you get

HTML in PDF format means your page saved as a PDF file, which can be opened, printed or sent on any device. Paste the HTML and CSS, choose the paper size, margin and orientation, and the converter prints the page with headless Chromium.

The PDF is a new file. Your HTML is not changed. Images, fonts and styles that the HTML loads from public http and https addresses are fetched when the page is printed, while links to files on your own computer will not load.

## Page numbers and generating PDFs from code

The web tool does not print page numbers. For html to pdf page numbers, use the API with a footer template, as described in the question about page numbers below.

To generate pdf from html inside your own software, send the HTML to the API and poll the job. That is also the practical way to handle converting html to pdf for many documents, because the web tool takes one document at a time.

## Questions

### Why does my PDF look different from the page in my browser?

The PDF is printed from headless Chromium, so print styles apply. Use @media print rules and the CSS properties break-before, break-after and break-inside to control page breaks. With the API you can switch the media type to screen.

### Can the HTML load images, CSS or fonts from other sites?

Public http and https addresses can be fetched while rendering. Addresses inside private networks, localhost and cloud metadata addresses are blocked on purpose. Inline small assets with data URLs if you want no external dependency.

### Does JavaScript in my HTML run?

Yes by default. The API has a javascript option and wait options (wait_until, wait_for_selector, delay_ms) for pages that build themselves on load.

### How big can the HTML be?

The free web tool accepts up to 256 KB of HTML per conversion and prints at most the first 10 pages. API requests accept larger documents; the limits per plan are still being decided.

### How long is my PDF kept?

Web-tool results are deleted after 10 minutes. A record of each job is kept, and signed-in users can see their jobs in the dashboard.

### Can I convert many files at once?

Not in the free web tool, which takes one document at a time. The API is the way to batch: send one request per document.

### How do I add page numbers to a PDF made from HTML?

Use the API. Turn on display_header_footer and set header_template or footer_template. Add a span with the class pageNumber or totalPages where the number should appear, and leave room in the margin for it.

### Can I convert a web page by URL instead of pasting HTML?

Yes. For public pages, use the URL to PDF tool. Pages behind a login will show the login screen instead of the content.

### Which paper sizes can I use?

The web tool offers A4, Letter, Legal, A3 and A5. The API also accepts a custom width and height.

### How do I convert HTML to PDF?

Paste your HTML and CSS into the editor. A complete document with a style block works well. Choose the page size, margin and orientation, complete the human check if it appears, and press Convert to PDF.

### How do I convert an HTML file to PDF?

This tool takes pasted code, not uploaded files. Open the .html file in a text editor, copy everything and paste it into the editor here. Links to local images or stylesheets will not load, because only public http and https addresses can be fetched.

### How do I save HTML as a PDF?

If the page is already open, press Print and choose Save as PDF as the destination. If you have HTML code rather than an open page, paste it into this tool instead.

### How do I make a PDF from HTML in code?

Send your HTML to the API in a POST request to /v1/render, with output set to pdf and your API key as a Bearer token. The API replies with status 202 and a job_id. Poll GET /v1/jobs/:id until the status is succeeded, then download the PDF from download_url, which is a short-lived link.

### How do I change HTML to PDF?

Converting does not edit your HTML. To change the format, pick another page size, margin, orientation or background setting. To change the layout, such as where a section starts, edit the CSS, for example with break-before, and convert again.

### How do I turn HTML into a PDF?

Paste the HTML and CSS into the editor, choose a page size, margin and orientation, complete the human check if it appears, and press Convert to PDF. Download the file from the result. If you have a lot of documents, send them to the API one request at a time instead.

### Do Chinese, Japanese, Korean text and emoji print correctly?

Yes, in our test. On 2026-10-11 we converted a page with Simplified and Traditional Chinese, Japanese, Korean and emoji, and the PDF showed readable text and colour emoji, not empty boxes. The render server draws them with Noto Sans CJK and Noto Color Emoji, and the fonts used are embedded in the PDF. To use a typeface of your own, load it with @font-face from a public URL or a data URL.

## Related

- [URL to PDF](https://aiipworld.com/tools/url-to-pdf/index.md)
- [Invoice to PDF](https://aiipworld.com/tools/invoice-to-pdf/index.md)
- [CSV to PDF](https://aiipworld.com/tools/csv-to-pdf/index.md)
- [HTML to PNG converter](https://aiipworld.com/tools/html-to-image/index.md)
- [PDF generator API](https://aiipworld.com/pdf-api/index.md)
- [A wkhtmltopdf alternative: headless Chromium over an API](https://aiipworld.com/guides/wkhtmltopdf-alternative/index.md)
- [Markdown to PDF](https://aiipworld.com/tools/markdown-to-pdf/index.md)
- [Text to PDF](https://aiipworld.com/tools/text-to-pdf/index.md)
- [JSON to PDF](https://aiipworld.com/tools/json-to-pdf/index.md)
- [AIIPWorld as a DocRaptor alternative](https://aiipworld.com/alternatives/docraptor/index.md)
- [SVG to PDF](https://aiipworld.com/tools/svg-to-pdf/index.md)
- [HTML email preview: online email previewer](https://aiipworld.com/tools/html-email-preview/index.md)
- [Estimate Generator](https://aiipworld.com/tools/estimate-generator/index.md)
- [Purchase Order Generator](https://aiipworld.com/tools/purchase-order-generator/index.md)
- [HTML to Markdown](https://aiipworld.com/tools/html-to-markdown/index.md)
- [Print CSS for PDF: a practical guide](https://aiipworld.com/guides/print-css-for-pdf/index.md)
- [HTML to PDF Python: a requests guide](https://aiipworld.com/guides/html-to-pdf-python/index.md)
- [HTML to PDF nodejs: a Node.js API guide](https://aiipworld.com/guides/html-to-pdf-nodejs/index.md)
- [AIIPWorld as an html2pdf.js alternative](https://aiipworld.com/alternatives/html2pdf-js/index.md)
- [C# HTML to PDF, PHP and Java guide](https://aiipworld.com/guides/html-to-pdf-csharp-php-java/index.md)
- [Free Receipt Maker: Create a Receipt PDF](https://aiipworld.com/tools/receipt-maker/index.md)
- [Merge PDF: Combine PDF Files Online for Free](https://aiipworld.com/tools/merge-pdf/index.md)
- [Split PDF Online, Free](https://aiipworld.com/tools/split-pdf/index.md)
- [Rotate PDF Online for Free](https://aiipworld.com/tools/rotate-pdf/index.md)
- [Letterhead Maker](https://aiipworld.com/tools/letterhead-maker/index.md)
- [Price List Template](https://aiipworld.com/tools/price-list-template/index.md)

Page: https://aiipworld.com/tools/html-to-pdf/
