🌐

Convert HTML to PDF Online Free

Convert HTML files to PDF documents online for free. Preserve styling and layout when archiving web pages or generating reports.

🌐

Drop file here or browse

Maximum file size: 50 MB

HTML

Converting HTML files to PDF is useful for archiving web content, generating reports from HTML templates, and creating print-ready versions of web pages. CocoPDF converts HTML files to PDF using a server-side document engine, which renders HTML and creates a properly formatted PDF document.

For best results, use self-contained HTML files with inline CSS and Base64-encoded images. External resources such as Google Fonts, CDN stylesheets, and JavaScript are not loaded during the conversion, because the server has no internet access during processing to ensure your files remain private.

To convert a web page to PDF, first save it from your browser as "Webpage, HTML only", then upload the saved file here. Your PDF downloads immediately after processing. No account required, no watermarks, files deleted within one hour.

The single most important thing to know is that the conversion has no internet access, which is deliberate and keeps your files private. The practical consequence is that anything the page would normally fetch while loading will not arrive. A stylesheet linked from a CDN, a web font pulled from Google Fonts, an image hosted elsewhere, and any content drawn by JavaScript after load are all absent from the result. A page that looks correct in your browser can therefore convert looking unstyled.

The fix is to make the HTML self-contained before uploading it. Put the CSS inline in a style tag rather than linking it, embed images as Base64 data URIs, and make sure the text you want is present in the markup rather than generated at runtime. If you are converting a page from the web, saving it from your browser as a single-file archive usually bundles the styling and images correctly. For control over where pages divide, use the standard CSS print properties, which the renderer honours.

What HTML to PDF is usually used for

Templates drive most of this. Invoices, certificates, packing slips, and statements are usually easier to lay out in HTML and CSS than in a word processor, especially when the content is being pulled from a database. Rendering the finished markup to PDF turns that template into something you can email, file, or print and have it look identical everywhere.

Archiving is the other big reason. Pages change. An order confirmation, a published article, or a support thread that later matters to a dispute can quietly become something else, and a PDF made on the day fixes the content as it stood. Save the page from your browser first, then convert the saved file here.

The third case is printing things that were never designed to be printed. Web reports and dashboards tend to come out of the browser print dialog badly, with content clipped at the page edge or a navigation bar wedged into the middle of a table. A small print stylesheet plus a conversion gives you control the print dialog simply does not offer.

Controlling how the document paginates

Once the file is self-contained, pagination is where the remaining effort goes. HTML has no pages, so the renderer has to invent boundaries, and left alone it will put them wherever the paper runs out. That is how you end up with a heading alone at the foot of one page and its paragraph on the next, or a four-row table split after row one.

Standard CSS print properties fix this and are honored during conversion. Setting page-break-inside to avoid on a table row or a card keeps it whole. Setting page-break-after on a section heading starts each section on a fresh sheet. Applying page-break-before to a chapter div does the same job from the other direction. These are ordinary print stylesheet techniques and they behave here the way they do in a browser print preview.

A print stylesheet is also where you remove what does not belong on paper. Navigation bars, sidebars, cookie notices, and share buttons all make sense on screen and none of them make sense in a filed document, so hiding them in a print media query gives a much cleaner result than cropping them out afterwards. Set explicit widths while you are there, since a layout built around a browser window has no window to size itself against.

How the renderer handles your markup

Conversion runs through a full document engine on our server, which lays out the HTML the way a browser would and writes the result as real PDF content. Text becomes embedded glyphs rather than a picture of text, so you can still select and search it afterwards, and the file stays small even across a long document.

Standard HTML and CSS layout are supported, including tables, floats, and the usual typographic properties. Anchor tags survive as working links in the finished PDF, which means a linked table of contents in your markup becomes navigation in the document. Page size follows whatever the HTML specifies and falls back to A4 when nothing is set.

Because everything happens server-side, nothing depends on your browser or machine, and files up to 50 MB convert at native speed rather than grinding through in-page JavaScript. The HTML you upload and the PDF it produces are both deleted within one hour, and no watermark or attribution is added to the output.

How to HTML to PDF Online in 3 Simple Steps

  1. 1

    Upload your file

    Drag and drop your file onto the upload box, or click to browse. CocoPDF accepts a file up to 50 MB each.

  2. 2

    Adjust the settings

    Choose the options you need for HTML to PDF. The default settings work well for most documents.

  3. 3

    Download the PDF file

    Click the process button. The file is generated on our server and your PDF download starts automatically.

Frequently Asked Questions

What HTML features are supported?

Standard HTML and inline CSS are supported. External stylesheets and JavaScript-rendered content are not loaded. For best results, use self-contained HTML files with inline or embedded CSS.

How do I convert a web page to PDF?

Save the web page as an HTML file from your browser (File → Save Page As → Webpage, HTML only), then upload the saved HTML file to this tool.

Will images in the HTML file be included?

Images referenced by external URLs will not be fetched during conversion. Embed images as Base64 data URIs in the HTML file if you need them included in the PDF.

What is the page size of the output PDF?

The converter uses the page size defined in the HTML, or defaults to A4 if no page size is specified.

Why is my page missing its styling?

External resources are not loaded during conversion, so a stylesheet linked from a CDN or a web font pulled from Google Fonts will not be applied. Use a self-contained HTML file with the CSS inline in a style tag, and the layout converts exactly as written.

Can I convert a web page that requires a login?

No. The conversion works on an HTML file you upload rather than a live URL, and it has no session or cookies. For a page behind a login, save it from your browser first, ideally as a single-file archive so the styling and images travel with it.

Does JavaScript run during conversion?

No. The page is rendered as it exists in the file, so anything drawn by a script after load, such as a chart or content fetched from an API, will not appear. Content that is present in the HTML itself converts normally.

How do I control where pages break?

Use the standard CSS print properties in your stylesheet. Setting page-break-after or page-break-inside on an element gives you control over where the content divides, which is worth doing for tables and headings that would otherwise split awkwardly.

Can I paste a URL instead of uploading a file?

No. The tool converts an HTML file you upload. Fetching a live URL would require the conversion server to reach out to the internet, which is exactly what we prevent so that uploaded files stay isolated. Save the page from your browser first, then upload it.

Do links in the HTML still work in the PDF?

Yes. Anchor tags become clickable links in the output, both those pointing to external addresses and those pointing to an id within the same document. This makes a linked table of contents at the top of the HTML a practical way to add navigation to the finished PDF.

Is the text in the output selectable, or is it an image?

It is real text. The renderer lays out the markup and writes actual glyphs into the PDF, so the result is selectable, searchable, and copyable. Only images embedded in the HTML arrive as images.

Why do my web fonts fall back to a default typeface?

Because the font file is fetched over the network at render time and no network is available. Embedding the font as a Base64 data URI inside an @font-face rule keeps it in the file, and it will then be embedded in the PDF as well. Otherwise the renderer substitutes whatever standard face is closest.

Related Tools