HTML to PDF Converter — Paste HTML Code or Upload a File
Convert HTML code to PDF free online. Paste your HTML, upload a file or start from a template, check the live page preview, and download a PDF with selectable text and clickable links. 100% in your browser — your HTML is never uploaded.
Drop an HTML file here or click to browse
.html, .htm or .txt files, up to 10 MB
- Never uploaded — converting happens in your browser
- No sign-up
- No watermark
- HTML files up to 10 MB
- No sign-up, no watermark, hTML files up to 10 MB
HTML to PDF conversion turns HTML code into a fixed-layout PDF file. This converter accepts HTML typed or pasted into a built-in editor, .html or .htm files from your device, or .txt files that contain HTML. The live preview lays your HTML out on the page size you choose, with a dashed line wherever a new page starts, and the PDF uses the same layout. Sizes are true to paper: 12pt text prints at 12pt. Lines of text, pictures and table rows are kept whole at page breaks, the text in the PDF can be selected, searched and copied, and links stay clickable. Styles in a <style> block or style attributes are applied, including print styles, and so are style sheets, web fonts and pictures linked from other websites — your browser loads them straight from those websites, and the converter tells you if any couldn't be included. Everything runs in your browser — your HTML never leaves your device.
How it works
How to Convert HTML to PDF
Three steps. Three input methods. Browser-based — no server round-trip.
Step 1: Add Your HTML Content
Choose one of three ways to add your HTML. Drop an .html, .htm, or .txt file onto the upload area; click Paste HTML Code and type or paste your code into the editor (useful for code snippets, generated HTML, or content copied from a CMS); or click Start with Template to begin with a sample document and replace it with your own.
Step 2: Use the Live Preview and Set Page Size
The live preview updates as you edit and shows your HTML on the page size you choose, with a dashed line wherever a new page starts. Check how tables and text fall across pages. Choose the page size — A4 is the default, with US Letter, US Legal and A3 — portrait or landscape, and the margin.
Step 3: Download Your PDF
Click Convert to PDF. The PDF is laid out the same way as the preview and saved to your device, with text you can select and search and links you can click. No watermark is added. No account is required. Your HTML code and any file content remain in your browser throughout — nothing is transmitted to a server at any point in the process.
Developer features
What This HTML to PDF Converter Includes
Live preview of the real pages
The preview is laid out by the same routine that makes the PDF: the same page width, the same styles, and a dashed line wherever a new page starts. Change the page size, orientation or margin and it re-flows, so you see how tables and text fall across pages before you download.
Paste HTML code
A built-in editor lets you type or paste HTML code without uploading a file. Useful for snippets, generated templates, or code copied from a CMS or design tool. Fragments get clean default styling; a complete document keeps only its own styles.
Selectable text, clickable links
Each PDF page carries its words as real text, so the PDF can be searched, selected and copied, whatever alphabet it is written in. Web and email links stay clickable, and so do links to a place in the same document.
Clean page breaks
Pages end between lines, never through them: text, pictures and table rows stay whole. CSS page-break rules (break-before, break-after, break-inside) and print styles are followed, and content wider than the page is shrunk to fit.
Files stay in browser
Processing runs in your browser using JavaScript. Your HTML code and any file you open are never sent to a server, which matters for proprietary templates and documents with customer data.
Starter template
Click Start with Template to load a sample document with headings, a list, a table and a code block, then replace it with your own content. Or click Paste HTML Code to start from an empty editor.
Developer note — external resources
Style sheets, web fonts and pictures linked from other websites over https are loaded by your browser straight from those websites. A picture or font can be copied into the PDF only when its website lets other sites use it — most CDNs and Google Fonts do — and the preview and the finished PDF name anything that couldn't be included. Scripts, frames and videos from other websites are not loaded, and files referred to by a path such as style.css can't be found. To include those:
- • Inline CSS rules into a
<style>block in the HTML<head>section, or apply them asstyle=attributes on individual elements - • Embed images and fonts as base64 data URIs — files on your computer, or on a website that doesn't let other sites use them
- • A few CSS effects are not drawn: filters, blend modes, clip-path, conic gradients and text clipped to a background
What This HTML to PDF Converter Is Used For
- Developer document generation. Developers generating invoices, reports, or certificates programmatically in HTML often need a quick way to test how the output renders as a PDF without setting up a server-side PDF library. The live preview editor lets you paste generated HTML directly and see the PDF layout instantly. Browser-based processing means the test HTML — which may contain real customer data from a development environment — never leaves your device.
- Email template to PDF conversion. Marketing teams and developers who build HTML email templates often need a PDF version for print, archiving, or client approval. Pasting the email HTML into the editor and downloading the PDF is faster than setting up a headless browser or server-side rendering pipeline. Inline CSS support ensures email-style formatting is preserved.
- Content and document creation from HTML. Technical writers, content teams, and educators working with HTML content — course notes, guides, technical documentation, reference materials — can paste their HTML into the editor and produce a formatted PDF document. The template option provides a pre-structured starting point for users who don't write HTML from scratch.
- Sensitive or proprietary HTML. Legal teams, product teams, and agencies working with HTML containing unreleased designs, confidential business documents, or client-specific templates cannot use server-based tools that retain uploaded files. Browser-based conversion is the only option for this use case without deploying local software.
- Quick prototyping and layout testing. Designers and developers testing how an HTML layout renders at different page sizes can use the live preview to iterate without downloading and reviewing repeated outputs. Change the HTML, see the preview update, adjust the page-size setting, and download when the layout is correct.
How we compare
Private, instant, live preview
Type or paste HTML, see the preview live, and download a properly formatted PDF — all without leaving your browser.
| Feature | Ours | html2pdf.ws | CloudConvert | Sejda | web2pdfconvert |
|---|---|---|---|---|---|
| Free & unlimited | 25/day | 3/hr | 15/day | ||
| No account needed | |||||
| Files stay in browser | |||||
| Live preview | |||||
| Custom HTML editor | |||||
| Starter template | |||||
| Page size options | |||||
| Inline CSS support |
Competitor information was accurate at time of publication and may have changed.
Need a screenshot first?
Need a picture of a live website instead? ScreenSnap takes a full page screenshot in Chrome and saves it as PNG, JPG or PDF — free, and your screenshots never leave your browser.
Frequently Asked Questions
How do I convert HTML to PDF for free?
How do I convert HTML code to PDF without saving it as a file?
Does the live preview show exactly what the PDF will look like?
Is the text in the PDF selectable and searchable?
What HTML and CSS features are supported?
How do I control where the pages break?
Will my HTML code be uploaded to a server during conversion?
What page size options are available for HTML to PDF conversion?
Can I use an HTML template to get started?
What file formats can I upload to the HTML to PDF converter?
Can I convert an HTML document that uses external stylesheets?
Does JavaScript in my HTML run?
Can I convert a live web page by its address?
Can I convert HTML to PDF on a phone or tablet?
Guides & tutorials
How to Take a Full Page Screenshot in Chrome
Capture whole webpages as PNG, JPG or PDF in one click: full-page scroll, region, element and all-tabs capture. Free, no account, never uploaded.
Capture Any Webpage as PDF in Your Browser
Save any webpage as a PDF with a free Chrome extension: full page capture, your choice of page size, orientation and margins. Screenshots stay in your browser.
Related Tools
Markdown to PDF
Convert Markdown files to beautifully formatted PDFs with live preview.
Webpage to PDF
Capture any web URL as a PDF document.
Edit PDF
Click any text in a PDF and change it, in its original font where possible. Add text, images, shapes, links, and signatures — no upload, no software to install.
Compress PDF
Shrink large PDFs for email, web upload, or cloud storage. Our compression preserves image clarity and text sharpness — you choose the quality level.