HTML to PDF Converter
Convert HTML to PDF: turn HTML code or an HTML file into a PDF directly in your browser.
HTML input
PDF preview
Loading preview…
Converted in your browser: your HTML isn't uploaded. Scripts in the document aren't run. Pages are high-resolution images with selectable text and clickable links; for vector text, use Print / Save as PDF.
Convert HTML to PDF online
This HTML to PDF converter turns HTML code or an HTML file into a PDF you can download, share and print. Paste the code, and the preview shows the document on a page of the size you pick, with dashed lines where each page will end, so you see the result before you convert.
It suits anything written in HTML that should end up as a fixed document: an invoice or receipt template, a report, a letter, a résumé, a printable checklist or a saved web page.
How to convert HTML to PDF
- Paste HTML into the editor, or click Open .html file to upload an HTML file.
- Check the document in the PDF preview on the right.
- Choose the page size (A4 or Letter), orientation and margins, and whether to keep background colors and images.
- Click Convert to PDF.
- Click Download PDF to save the file.
Convert an HTML file to PDF
To convert an HTML file to PDF, open it with the Open .html file button or drag it onto the converter. Files ending in .html and .htm are supported, up to 5 MB. The file is read on your device, the code appears in the editor so you can adjust it, and the PDF gets the same name as the file.
An HTML file on its own doesn't include the images and stylesheets it points to with relative paths such as images/logo.png. Use full URLs or embed images as data URLs to include them.
HTML and CSS to PDF
Your HTML and CSS are rendered by your browser's own engine, so modern CSS works: flexbox and grid layouts, web fonts, gradients, shadows, rounded corners, tables and colors. To control page breaks, use break-before: page (or the older page-break-before: always) to start a new page and break-inside: avoid to keep a block together. The converter also avoids splitting lines of text, images and table rows on its own.
Good to know:
- Scripts in the document are not run, so content that JavaScript would add is missing. Render the final HTML first, for example in the HTML compiler.
- Each page is stored as a high-resolution image with an invisible text layer: text stays selectable and searchable for Latin-script languages, and links stay clickable, but text is not vector text.
- Stylesheets, fonts and images from other websites are only included when that website allows cross-origin access. Embedded content such as iframes and videos is not included.
@pagerules and@media printstyles apply to Print / Save as PDF; Convert to PDF uses the page settings above and your screen styles.
For vector text and resources from any website, use Print / Save as PDF: it opens your browser's print dialog with the same page size and margins.
Browser-based HTML to PDF conversion
The conversion runs entirely in your browser. Your HTML is not uploaded to HTMLSuite or to a conversion service, and the PDF is created on your device. The only network requests are the ones your HTML makes itself, for images, stylesheets or fonts it links to.
The document is rendered in an isolated, sandboxed frame that can't access this site, and scripts inside your HTML are blocked, so pasting HTML from an unknown source is safe to preview and convert.
HTML to PDF for developers
Developers use an HTML to PDF converter to check and share documents built in HTML:
- Invoices and receipts: test an invoice template with sample data and see how it breaks across pages.
- Reports: turn a generated HTML report into a PDF to send or attach.
- Documentation: save a documentation page or README as a PDF for offline reading. Write it in Markdown and use the Markdown to HTML converter first.
- Printable pages: tickets, labels, certificates and checklists.
- Prototypes and templates: share a static mockup or an email template with someone who doesn't open HTML files.
This tool converts one document at a time by hand. To generate PDFs automatically on a server, for example for every order, use a server-side library or headless browser in your own application.
Need to fix the HTML first? Edit it with live preview in the online HTML editor, tidy it with the HTML formatter, or check it in the HTML viewer. Coming from Word? The Word to HTML converter turns a .docx file into HTML, and the HTML to text converter extracts just the words. To sign the finished PDF or add notes to it, open it in the PDF editor.
Frequently asked questions
- What is an HTML to PDF converter?
- An HTML to PDF converter turns a web page or a piece of HTML code into a PDF document with fixed pages, so it can be shared, printed or archived and looks the same on every device. This one renders your HTML in the browser and splits it into pages of the size you choose.
- How do I convert HTML to PDF?
- Paste your HTML into the editor or open an .html file, check the preview, choose the page size, orientation and margins, then click Convert to PDF. When the PDF is ready, click Download PDF.
- Can I convert an HTML file to PDF?
- Yes. Click Open .html file or drag an .html or .htm file onto the converter. The file is read in your browser and the PDF file name is taken from it, which you can change before downloading.
- Does CSS work when converting HTML to PDF?
- Yes. Styles in <style> elements and style attributes are used, as are stylesheets and web fonts from sites that allow cross-origin access, such as Google Fonts and common CDNs. Layout, colors, gradients, shadows, tables, flexbox and grid render the way your browser renders them, and page-break CSS such as break-before: page is respected. Scripts in the document are not run.
- Can I convert HTML to PDF for free?
- Yes. The converter is free, without an account, watermarks or a limit on how many PDFs you create. A single PDF can have up to 100 pages.
- Is my HTML uploaded to a server?
- No. The HTML is rendered and converted to PDF inside your browser, and the PDF is created on your device. Only resources your HTML itself links to, such as images, stylesheets or fonts on other websites, are loaded from those websites, just as when you open the page in a browser.
- Can I create a multi-page PDF?
- Yes. Long documents are split into pages automatically. Page breaks avoid cutting through lines of text, images and table rows, keep headings with the text that follows, and you can force a new page with the CSS rule break-before: page. The preview marks where each page will end.
- Can I convert HTML with images to PDF?
- Yes. Embedded images (data URLs) and images from websites that allow cross-origin access are included. If a website blocks this, the image is left empty in the PDF and the converter tells you; Print / Save as PDF includes it. Images with relative paths from an uploaded file can't be found, because the browser only has the HTML file itself.
- What is the difference between Convert to PDF and Print / Save as PDF?
- Convert to PDF creates the PDF directly: each page is a high-resolution image with an invisible text layer, so text can still be selected and searched and links stay clickable. Print / Save as PDF opens your browser's print dialog with the same page size and margins; choose Save as PDF there for vector text and images from any website, with output that depends on your browser.
Related tools
- Online HTML editorEdit HTML, CSS and JavaScript with a live preview.
- HTML viewerPaste or open HTML and see it rendered.
- HTML formatter and beautifierBeautify and indent messy or minified HTML.
- Word to HTML converterConvert Word documents to clean HTML.
- online PDF editorAdd text, sign, annotate and organize PDF pages.