By · Updated

HTML to PDF

Convert HTML Markup to a Clean PDF Online

No ratings yet

OneTask is free, with no sign-up, and built by one person.
If this tool saved you time, a coffee helps keep new ones coming.

How the HTML to PDF works

Convert HTML to PDF by pasting the markup: headings, paragraphs, bulleted and numbered lists, bold, italic, code blocks, quotes, simple tables and clickable links are laid out on proper pages. Pick a page size and font and download. It runs in your browser, so nothing is uploaded.

HTML is how most text is written today: email templates, CMS exports, help articles, generated reports and notes from tools that save as .html. When that content needs to be sent, printed or filed, a PDF is the expected format. It keeps its layout, it opens everywhere and it cannot be edited by accident.

How HTML to PDF works

Your markup is read by the browser's own HTML parser into an inert document. Nothing in it runs: scripts, styles, forms, frames and embedded media are ignored. The tool then walks the document and turns each element into a block of text with a style.

HTML In the PDF
<h1> to <h6> Bold headings at 2× down to 0.9× the body size
<p>, <div>, <section> Paragraphs with a gap after each
<ul>, <ol>, <li> Bullets or numbers, indented per level, start respected
<b>, <strong>, <i>, <em> Bold and italic
<code>, <pre> Courier, with spacing and line breaks kept in <pre>
<blockquote> Indented block
<a href> Blue text with a clickable link
<table> One line per row, cells separated by a bar
<hr>, <br> A thin rule, a line break

Text is measured with the real widths of each font and wrapped between the margins. Mixed bold, italic and code words share a line. Long URLs or words wider than the page are broken across lines instead of running off the edge, and new pages start automatically as the text fills each one.

Links with http, https or mailto addresses become real PDF link annotations, so they can be clicked in any reader. Links to javascript or relative paths are shown as plain text because they would not work outside the original site.

What it is good for, and what it is not

This is a document converter, not a browser screenshot. It produces clean, searchable, selectable text that prints well and keeps files tiny, often a few kilobytes a page. It is a good fit for:

It does not apply CSS, so colours, columns, custom fonts, backgrounds and exact pixel layout are not reproduced. Images are left out and counted in the note. For a pixel-perfect copy of a styled web page, open it in your browser and use Print, then Save as PDF.

Tips and pitfalls

Paste the source, not the rendered page. Use View Source or your editor's HTML mode and copy the markup. Copying the rendered page gives plain text, which the text to PDF tool handles better.

Character set. The built-in PDF fonts cover Western European languages, curly quotes, dashes and the euro sign. Other scripts, such as Chinese, Arabic or Cyrillic, and emoji are replaced with a question mark, and the note lists each one. HTML entities such as &amp; and &eacute; are decoded first, so they come out correctly.

Tables. Complex tables with merged cells flatten into rows of text. Keep them short, or put wide tables on a landscape page.

Title. If you leave the title blank, the page's <title> tag is used for the PDF's title and the file name.

How to read the result

The stats show the number of pages, headings found, text blocks laid out (paragraphs, list items, rows and code blocks), links kept and the file size. Press Download to save the PDF.

FAQ

How do I convert an HTML file to PDF?

Open the .html file in a text editor, or use View Source in your browser, then copy all the markup and paste it into the HTML box. Choose a page size and font, check the stats, and press Download to save the PDF.

Why do my styles and images not appear?

The tool builds a clean text document and does not run CSS. Images are counted but left out. For an exact visual copy of a styled page, open it in your browser and use Print, then choose Save as PDF as the printer.

Are the links clickable in the PDF?

Yes. Links that start with http, https or mailto become clickable areas over the blue link text. Relative links and javascript links are kept as plain text, because they only work inside the site they came from.

Is it safe to paste HTML from an unknown source?

Yes. The markup is parsed as an inert document, so scripts never run and nothing is fetched. The PDF is made on your device and the HTML is never sent to a server.

See also: all Documents tools, Units, Images, Audio & Video, Data & Code.

Related tools