Skip to content
RightYantra
Document converters

HTML to PDF

Drop an .html file or paste markup and get a clean PDF of its content — headings, paragraphs, lists, tables and clickable links. The document's structure is read by your browser's own HTML parser, and nothing is uploaded or fetched.

Processed entirely on your device — nothing is uploaded

How to use the html to pdf

  1. 1Drop an .html file into the box above, or paste your markup into the text area.
  2. 2Choose page size, typeface, text size and margin.
  3. 3Press Convert to PDF.
  4. 4Download the PDF — links stay clickable and the text stays selectable.

Be clear about what this converts

This is the important paragraph on the page, and it is deliberately at the top. This tool converts an HTML document's *structure*, not its appearance. It reads headings, paragraphs, lists, tables, quotes, code blocks, rules and links, and typesets them as a clean document. It does not apply your stylesheet, run your JavaScript, or reproduce your layout. A page converted here comes out looking like a well-set document, not like a screenshot of that page in a browser.

If a picture of the rendered page is what you want, your browser already does it better than any converter could: Ctrl+P or Cmd+P, then "Save as PDF". That path uses the real rendering engine with your CSS applied, which is exactly the thing a structural converter is not attempting.

What this is for is the other case, which is more common than it sounds: an exported email, a saved article, a report generated as HTML by some system, a chunk of markup you have been handed — where you want the content as a readable document and you specifically do not want the site's navigation, cookie banner, sidebar and advertising baked into it.

How the structure is read

Parsing HTML properly is famously difficult — real markup is full of unclosed tags, mis-nested elements and attributes in shapes no specification describes. Rather than write a parser and get it subtly wrong, this uses `DOMParser`, the browser's own HTML parser: the same code that renders every page you visit, and by a wide margin the most battle-tested HTML parser available. It costs nothing to use and it handles broken markup the way a browser does.

From the resulting tree, the converter walks the document body. Anonymous containers — div, section, article — are descended into rather than treated as content, because on a modern page almost everything is wrapped in several of them. Headings become headings at their level; ul and ol become real lists with sublists nested inside their parent item; tables become ruled tables, with a th row recognised as a header and repeated across pages; blockquote, pre, hr and the inline elements strong, em, code, u and a all map onto their document equivalents. Script, style, iframe, svg, canvas and media elements are skipped entirely.

Whitespace is collapsed the way CSS would collapse it, which matters more than it sounds: markup indented for readability otherwise converts with ragged gaps in the middle of sentences.

Images and the request this tool will not make

Images embedded directly in the file as data URLs are decoded and included. Images referenced by URL are not, and the reason is a principle rather than a limitation: fetching one would mean this page making a network request, and the entire premise of this site is that your document's contents never leave your device. A converter that quietly fetched every image in your file would also be quietly telling those servers what you are converting and when.

In practice this affects saved web pages more than anything else. If you need the images, most browsers offer "Save Page As → Web Page, Single File" (or an .mhtml export), which inlines the images as data URLs; converting that file includes them.

The same reasoning is why there is no box here to paste a URL. Fetching a page would be a server-side operation, which would mean a server, which would mean your reading list going through it.

Links, tables and what a converted page is good for

Links survive as real PDF link annotations with their targets intact, so a converted article keeps its references working. Only external targets are kept — http, https and mailto — since an in-page anchor points at a fragment that does not exist once the page becomes a document.

Tables are worth a note because they are the element most likely to look better after conversion than before. A wide HTML table on a fixed page gets columns sized from their content, a shaded header row that repeats on every page, and cell text that wraps rather than overflowing. A table that scrolls sideways in a browser becomes one you can actually read on paper.

The natural companions to this page are the Markdown converter, which handles the same job for Markdown sources, and the Word converter — because if what you actually need is an editable document rather than a fixed one, converting the HTML here and then using PDF to Word gets you there in two local steps.

Frequently asked questions

Will the PDF look like the web page?

No, and that is deliberate. This converts the document's structure — headings, text, lists, tables, links — into a clean typeset PDF. It does not apply your CSS or run JavaScript. For a visual copy of a rendered page, use your browser's own Print → Save as PDF.

Can I give it a URL instead of a file?

No. Fetching a URL would require a server, and this tool makes no network requests at all. Save the page to a file first, then drop it in.

Are images included?

Only images embedded in the file as data URLs. Images referenced by URL are not fetched, because fetching them would send a request off your device. Saving the page as a single file first inlines the images and works.

Do links still work in the PDF?

Yes. External links become real clickable annotations with their URLs intact. In-page anchors are kept as text, since a PDF has no equivalent of an HTML fragment anchor.

Is my markup uploaded?

No. Parsing uses your browser's own HTML parser and the PDF is built in the same tab. Nothing is transmitted.

Does it handle a whole saved website with CSS files?

It reads the HTML file itself. External stylesheets are not applied, since the output is structural rather than visual, and external images are not fetched. A single-file save (.mhtml or "Web Page, Single File") converts most completely.

Related tools