HTML to PDF
Convert HTML pages into print-ready PDFs.
Scripts and inline event handlers are removed before rendering — the tool never executes pasted markup.
How to use HTML to PDF
What is HTML?
HTML (HyperText Markup Language) is the format every web page is
written in. It uses nested tags — <h1>, <p>, <table>, <ul> and
hundreds more — to describe the structure and content of a document,
with CSS layered on top to control how it looks. Where a Markdown
file is a hint to a converter, HTML is the actual rendered language
of the web. Every browser, every email client and every modern
e-reader speaks it natively, which makes it the universal source
format for anything that started life on the internet.
What is a PDF?
A PDF (Portable Document Format) is a self-contained document file, created by Adobe in the early 1990s and now an open ISO standard. Where HTML re-flows to fit whatever screen it lands on, a PDF carries the finished, fixed-size layout — paper, page breaks, fonts, margins and all. When you want a piece of writing to look identical on every device, print cleanly and be archived in a single file, PDF is the format you hand someone.
Why convert HTML to PDF?
The most common reason is printing or archiving a web page. Browser print-to-PDF is fine for simple pages, but it strips the custom CSS, mangles backgrounds, drops images and re-flows the layout in unhelpful ways. A dedicated converter that takes the HTML you actually want — perhaps copied from your browser’s DevTools — and renders it to a PDF gives you full control over what ends up on the page.
The next reason is reports and invoices. Many small business tools, internal dashboards and prototype apps build their report layout in HTML/CSS because that is what their stack is best at. Turning that HTML into a downloadable PDF on demand — in the browser, with no server-side render pipeline to maintain — is a common need.
The third reason is certificates, badges and one-pagers. Whether it is a course certificate, an event ticket, a meal voucher or a marketing one-pager, HTML is the easiest way to lay out a visually rich single page, and a PDF is the right format to send it.
The fourth reason is email-friendly snapshots. Pasting an HTML
snippet into an email is brittle (clients rewrite the markup) and
attaching a .html file looks unprofessional. A PDF rendered from
the same HTML drops cleanly into any mail thread.
How to use this HTML to PDF converter
- Paste your HTML into the HTML markup box, or drop an
.htmlfile onto the dropzone above it. Full documents and partial snippets both work — if you drop a complete page, the converter automatically extracts the<body>content. - Pick a paper size — A4 if you are in Europe, India or most of the world, US Letter in the United States and Canada, US Legal for very tall pages.
- Pick an orientation — portrait for typical pages, landscape for wide tables and dashboard-style layouts.
- Optionally edit the filename — the result downloads as
your-name.pdf. - Click Convert to PDF. The HTML is rendered to a hidden canvas via html2canvas, sliced into page-sized JPGs and assembled into a PDF by pdf-lib. The download starts when it is finished.
Quality tips for HTML to PDF
Because the renderer takes a snapshot of the HTML at the width of
your chosen paper, the snippet you paste should already be
styled — colours, fonts, padding and table widths all come from
the inline CSS you provide. If you copy from a styled page, also
copy the relevant <style> block or inline the styles into each
element’s style="..." attribute. External stylesheets and web
fonts will not load.
System fonts (Arial, Helvetica, Times, Georgia, system-ui) are
safest. If you need a specific brand font, embed it as a data:
URI inside an inline @font-face rule. Otherwise html2canvas falls
back to the closest system font on the rendering machine, which is
usually fine but never pixel-identical to your design.
For long documents, add a comfortable margin-bottom to headings
and sections — page breaks fall at fixed pixel intervals and will
sometimes land inside a paragraph. A bit of vertical space gives
the renderer a sympathetic place to split.
If you need the output text to be selectable and searchable, this is not the right tool — use Markdown to PDF instead. This tool is for visual fidelity; selectable-text PDFs are a different trade-off.
Privacy
Your HTML never leaves your browser tab. The html2canvas render, the JPG slicing and the pdf-lib assembly all run in JavaScript on your device. The libraries are loaded once from this site and then cached — after that, conversion works completely offline, which you can verify in your browser’s Network panel or by switching off Wi-Fi before clicking Convert to PDF.
Browser compatibility
The output is a real PDF 1.7 file with embedded JPG page images. It opens identically in Adobe Acrobat, Apple Preview, the built-in PDF viewers in Chrome, Edge, Firefox and Safari, mobile readers on iOS and Android, and on every mainstream Linux distribution. html2canvas itself works in every modern evergreen browser; the only failure mode is when a snippet references resources (images, fonts, stylesheets) that cannot be fetched, in which case those resources are simply omitted from the render.
Frequently asked questions
Is the text in the output PDF selectable and searchable?
Which CSS works, and which doesn't?
style="..." attributes) and <style> blocks inside the snippet you paste both work. Layout properties — colours, padding, margins, flex, grid, borders, font sizes, line heights — render the way they look in a normal browser. What does not work: external stylesheets fetched by <link rel="stylesheet">, web fonts loaded with @font-face from a CDN, JavaScript-driven layout (any script is stripped before rendering), and CSS that depends on parent elements outside the snippet. If you want a specific font, embed it as a base64 data: URI in the snippet, or fall back to system fonts.How does pagination work for long documents?
Why does my JavaScript-driven layout look wrong?
<script> tags and inline onclick-style event handlers before rendering — for safety, it never executes pasted markup. So anything your page builds in JavaScript at load time (charts, dynamic tables, framework-rendered components) will be missing from the output. The fix is to capture the rendered HTML from your browser's developer tools (Elements → copy outerHTML) and paste that static snapshot into the converter instead.Is my HTML sent to a server?
.html file you drop, never travel across a network. The libraries are loaded once from this site and then cached. After loading you can disconnect from the internet and the converter still works.Related tools
HTML to JPG
Render an HTML snippet as a JPG screenshot.
Markdown to PDF
Convert Markdown files into formatted PDFs.
Word to PDF
Convert DOCX Word documents into PDFs.
PDF to HTML
Convert a PDF into basic HTML.
PDF Merger
Combine multiple PDF files into one document.
PDF Compressor
Reduce PDF file size for easier sharing.