HTML to PDF Converter Turn a saved web page or a block of markup into a paged document on your own machine
Drop an HTML file into the zone below, or paste your markup straight into the options rail. Headings, data tables, lists and clickable links all survive the trip. Set your page size, orientation and text size, and watch a layout built for a scrolling window reflow onto sheets of paper. Nothing is uploaded. The parser, the layout engine and the PDF writer all run on your own processor.
Files never leave your device
No installation, no watermark
Works offline once the page is open
Webpage to PDF Live
HTMLPDF
Privacy
100% private
Your plan
Free to use
You get
Single PDF
Select an HTML fileor drop them anywhere on this page
HTML, HTM, XHTML - drop images alongside it - up to 20 files - 100 MB per batch
Your files are read by JavaScript running on your own machine. There is no upload, no queue, and no copy on our server to delete later.
Drag a card to reorder it, or use the arrows under each card. The order here is the order in the output. Each card is a preview of the finished page, so what you see is what the PDF will contain.
Esc close ←→ move R rotate
Working on your files
Starting
0%
This is your processor doing the work, so the time it takes depends on your machine and not on how many other people are on the site.
Your PDF is ready
Continue with
The converter above works right now, and it takes typed markup as readily as a saved file. The documentation below tells you what your PDF will actually look like - which CSS rules apply, why a layout designed for a 1920 pixel monitor has to be rebuilt rather than photographed, where images come from when the engine refuses to touch the network, and what happens to the parts of a web page that have no business on paper.
How to Convert HTML to PDF Online for Free
Two minutes, nothing to install, and no account for your first run. This HTML to PDF converter executes inside the page you are reading, which is why none of your markup crosses the network.
1
Load your HTML file or paste the code
Click the drop zone above, drag your file onto this page, or paste markup into the text field in the options rail. A complete document with a doctype works, and so does a bare fragment, which the engine wraps for you. Anything pasted wins over a dropped file, so you can test one snippet after another without clearing the queue.
2
Drop the local images alongside it
A saved web page is an HTML file plus a folder of pictures, so select both at once. A relative image source is matched against the files you dropped, on the bare file name, which means a src of assets/img/logo.png finds your logo.png wherever it sits. Images written as data URIs need nothing extra. Pictures on remote servers are blocked rather than fetched, and that is deliberate.
3
Set the paper size, margins and text size
Pick a page size such as A4 or US Letter, an orientation, one of the three margin presets, and a body text size between 9 and 12 point. These settings are what force a fluid screen layout into a fixed column. Leave Print background colors switched off unless you really want a solid block of ink on every sheet.
4
Convert and read the result screen
Click Convert to PDF and your own processor runs the layout engine. The result screen reports the page count and counts what failed: remote images the engine refused to fetch, and CSS selectors outside what it implements. Read that report before you send the file to anyone.
Drop several HTML files at once and the engine joins the batch into one PDF, in card order, which is what you want when a set of exported articles has to read as a single document. It is the wrong thing entirely when each file is a separate invoice. Switch off Merge all pages into one PDF for that, and you get one file per input, listed separately on the result screen.
A batch holds 20 files and 100 MB on a free account, and a visitor who is not signed in gets 1 conversion every 12 hours against 2 for a free account. CartHacker Premium takes each batch to 100 files and 500 MB and removes the conversion counter, which is the difference between exporting one invoice template and exporting the month.
Pasting beats saving a file when you only have a snippet. An email template, half an invoice, a block of markup a system generated for you: paste it into the options rail rather than saving it to disk first. The engine wraps a fragment in a proper document, so you never write a doctype just to see how something prints.
The Engineering Behind HTML to PDF Conversion
HTML and PDF disagree about the most basic property a document can have: its size. HTML reflows into whatever width it is handed and scrolls forever downward. A PDF is a stack of rectangles with fixed, unmoving edges. Going from one to the other means measuring and re-laying out every line, not photographing the result, and the tools that take the photograph are the ones that hand you a single absurdly tall page or a document that stops two thirds of the way down.
This converter parses your markup into a document model: blocks, styled text runs, lists, tables, images. That model goes to a paginating layout engine which measures each line against a real page box and breaks when the sheet runs out. It is the same engine that paginates Word files on our Word to PDF tool. Orphan control, slicing a table across a page boundary and embedding font subsets are hard problems that were solved once, for the Office suite, and reused here rather than rebuilt worse.
The processing pipeline, in order
Parse the DOM. Your markup goes through the browser's own HTML parser, so malformed markup recovers exactly the way the web recovers it. An unclosed tag is repaired instead of throwing the fatal error a strict XML parser would.
Collect the cascade. Rules inside style elements are read and sorted by specificity, then combined with inline style attributes. Presentational attributes that old CMS templates and email builders still emit, align and bgcolor among them, are kept at the lowest priority.
Walk the node tree. Block elements become paragraphs, headings and table rows. Inline elements pass weight, slant, size and color down by value, which is what makes an unclosed bold tag stop bolding at the right character rather than at the end of the page.
Resolve the images. Data URIs are decoded in memory. Relative sources are matched against the picture files you dropped in alongside the markup. Anything on an external scheme is blocked and counted.
Run the layout math. Every line is measured against the column width in points, wrapped, and placed. When the vertical cursor reaches the bottom margin a new page starts. Tables split across the break and redraw their header row on the next sheet.
Write the file. Fonts are subset and embedded, anchors become real PDF link annotations, and the document is serialized as a Blob your browser downloads from itself.
Typography and embedded fonts
A PDF can show any typeface on earth, but only if the font file travels inside the document. To keep that weight down, this converter ships three families under the SIL Open Font License: Liberation Sans, Liberation Serif and Liberation Mono. Your CSS font stack is read left to right and mapped to whichever of the three it asks for first. Ask for Georgia and you get the serif. Ask for Consolas and you get the monospace. Everything else lands on the sans.
We would rather state that reduction than hide it. The alternative is fetching font files from somebody else's server at conversion time, which raises a redistribution question and breaks the promise that nothing leaves your machine. The three faces are metrically compatible with Arial, Times New Roman and Courier New, so the letter widths match the fonts most pages are designed around and your line breaks land where you expect.
Characters outside Western European Latin are fully supported. The standard fonts built into a PDF reader give up past Latin-1, which is how a Polish contract or a Czech invoice turns into a row of question marks. This engine covers the full Latin range, Central European, Baltic, Turkish and Vietnamese included, and downloads the subset your document actually needs.
Which CSS This Converter Applies, and Which It Ignores
Almost no HTML to PDF converter publishes this list, because the honest version of it is a catalog of modern web features that do not work on paper. A browser runs a fluid layout algorithm that took two decades and thousands of engineers to build. A local converter runs the part of it that puts static words on a sheet. Knowing where that boundary sits turns an afternoon of guesswork into a five minute export.
Selectors that resolve correctly
Type selectors.p, h2, td and the rest of the structural elements.
Class selectors..invoice-total, including compound forms such as td.numeric.
Id selectors.#summary-table.
The style attribute. It overrides everything in a stylesheet, exactly as it does in a browser.
Comma-separated lists of any combination of the above.
Specificity is honored in the normal order, id over class over type, with source order settling ties. What the engine does not implement is anything that needs a live walk of the tree per node: descendant and sibling combinators, attribute selectors, pseudo-classes and pseudo-elements. Rules using those are counted and reported on the result screen instead of failing quietly, so a broken layout comes with a reason attached.
Declarations that change the output
Property
Effect on the PDF
Technical Notes
font-size
Sets the type size for that node and its children.
px, pt, pc, in, cm, mm, em, rem and percentages all convert. One pixel is exactly 0.75 pt.
font-weight
Switches to the bold face at 600 and above.
Two weights per family, not nine. 300 and 400 print as regular, 600 through 900 as bold.
font-style
Switches to the italic face.
Oblique and italic are treated the same, because the embedded families carry true italics.
font-family
Maps to sans, serif or monospace.
The stack is read left to right and the first family the engine recognizes wins.
color
Text color.
Hex, rgb(), rgba() and named colors work. The alpha channel is dropped, since the output avoids transparency groups.
background-color
Paragraph and table cell shading.
Off by default to save ink. Turn on Print background colors if you want it.
text-align
Left, right, center and justified.
Justification distributes space between words rather than stretching the gaps between letters.
margin and padding
Vertical spacing and horizontal indentation.
Horizontal padding becomes indentation. The full box model is not reproduced, so a padded div draws no visible box.
text-indent
First line indent.
A negative value gives you a hanging indent, which is what keeps definition lists readable.
line-height
Leading, the space between lines.
A unitless number multiplies the type size. An absolute length sets the leading exactly.
list-style-type
Bullet glyph or numbering format.
disc, circle, square, decimal, lower and upper alpha, lower and upper roman.
page-break-before
Forces a hard page break.
The most useful print property on this list. Put it on a chapter heading or the top of each invoice.
display: none
Removes the element from the layout entirely.
visibility: hidden does the same. This is how you strip a navigation menu or a cookie banner.
What is not implemented
Flexbox, CSS Grid, floats, absolute and fixed positioning, transforms, multi-column layouts, box shadows, gradients, border radii and generated pseudo-element content have no equivalent in a paged model. Elements using them still appear with their text and typography intact, but they fall back to document order. A three column flex row comes out as three stacked blocks.
Media queries are skipped whole, @media print included, and counted in the report. If the page you are converting keeps its real layout in a print stylesheet, copy those declarations into a plain style block and convert that - it is a two minute edit that usually fixes the entire output.
Deleting the web furniture is the highest-value edit you can make. Sidebars, navigation bars, cookie banners, chat widgets and comment threads cost you real pages and wreck the layout on the ones that are left. Putting display:none on a handful of wrapper classes takes about a minute and changes the output more than any setting on this page.
Images, Privacy, and Why We Refuse to Fetch Remote URLs
An image tag holds a pointer rather than a picture. The markup says where the file lives and the browser is expected to go and get it. That model is fine on the web and a serious problem for a converter built on local processing. Honoring a remote image source would mean making a network request on your behalf, to a server we do not control, handing it your IP address and telling it exactly which document you are converting.
So images resolve from two local sources, and the third is refused:
Data URIs are decoded in memory. A src beginning data:image/png;base64, carries the picture inside the markup itself, so there is nothing to fetch. This is why a self-contained HTML file exports perfectly every time.
Relative paths are matched against the files you dropped. Select the HTML file and its image folder together and a src of assets/img/logo.png finds your logo.png. Matching is on the bare file name, so the directory structure in the src does not have to survive the download.
Absolute URLs are skipped and counted. Any src on http://, https:// or another external scheme is dropped, and the result screen reports how many. That is a privacy feature and not an oversight.
When an image cannot be resolved the engine prints its alt text in grey italics rather than leaving a hole, so a proofreader can see what is missing and where. Markup with no alt attribute draws nothing at all, which is its own small argument for writing them.
Supported formats and re-encoding
A PDF natively carries two raster encodings: JPEG, and the deflate stream that PNG uses. Everything else has to be decoded first. JPEG and PNG files are passed straight through with their original bytes, so there is no second round of compression and no generation loss. GIF, BMP and WebP are decoded by the browser and rewritten as PNG, which changes the byte count and not the pixels. SVG is not supported: rasterizing vectors in a browser script produces soft, blurry output, so export your SVGs to high resolution PNG first.
Scaling follows your CSS and HTML attributes. A width or height becomes a measurement in points. An image with no stated size prints at its natural resolution, shrunk to fit the column if it is too wide, and never enlarged. Blowing a small image up to fill a column looks far worse on paper than on screen, so the engine declines to do it.
How to Convert a Live Website to PDF, and When to Stop Trying
Most people arrive here looking for a box to paste a URL into. This tool does not have one, on purpose. Fetching a live page needs a headless browser running on a server, and the moment that exists, the promise that your data stays on your machine is gone. What the tool converts instead is markup you already have, and for the job people actually want done, that works better.
Getting the markup onto your machine
Save the page properly. In your browser choose Save Page As and pick Web Page, Complete. You get an .html file and a folder of assets. Drop the HTML and the images into the zone above together.
Save from Reader View. Firefox and Safari both have a reading mode that removes ads, sidebars and navigation before you save. What you convert is the article, not the furniture around it.
Copy the element you actually want. Open developer tools, right-click the article or main node in the inspector, choose Copy outer HTML, and paste it into the options rail. This is the method worth learning, because it exports the content and nothing else.
That third method is what people who do this regularly use. The thing you want is almost never a whole website: it is one invoice, one contract, one page of documentation. Copying a single DOM node sidesteps every layout problem responsive design creates, because the sidebar and the sticky header never reach the engine in the first place.
When your browser print dialog is the better tool
Your browser contains a layout engine of several million lines that implements Grid, Flexbox and print stylesheets properly. If what you need is a faithful picture of a live page as its designers built it, press Ctrl+P and print to PDF. No script-based converter will beat it, and we are not going to pretend otherwise.
Use this tool instead when one of these is true:
You have markup, not a rendered page. Database exports, email templates and system-generated invoices have no page to print in the first place.
You need the same output every time. Print dialogs vary by operating system, browser and driver. This engine produces the same pages from the same input, offline, on any machine.
You need selectable text. Some print paths rasterize text into an image. Everything here is written as real text with real link annotations behind it.
You are running a batch. A print dialog cannot take twenty files at once. This does.
The content is confidential. A URL-based online converter is told your private URL and fetches it from its own server. This engine works in your RAM and tells nobody anything.
Scaling Up: Batch Processing and Lifting Constraints
One email template or a handful of documentation pages is a trivial job and the free tier handles it without complaint. Exporting several hundred system records is a different problem, and the wall you hit is not our policy but the memory ceiling of a single browser tab.
CartHacker Premium raises each batch from 20 files and 100 MB to 100 files and 500 MB, and removes the conversion counter that limits a free account to 2 runs every 12 hours. The tab memory limit is still real, so a very large archive is best queued in several runs. Two clean batches always beat one crashed tab.
Zero-Trust Architecture: Your Data Stays Local
The standard build for a free HTML to PDF converter is an upload form feeding a headless Chrome instance on somebody else's server. Your markup crosses the network, lands on a disk, renders in a container you know nothing about, and sits there until a cleanup script gets to it. For a blog post that is fine. For an invoice carrying client addresses, a contract in draft, or an email template with live auth tokens in the links, it is a leak with a progress bar on it.
This tool has no upload endpoint at all. Your file is read through the browser File API, parsed by the DOM engine already in your browser, laid out by JavaScript on your own processor, and returned as a Blob. The markup exists on your hard drive and in your RAM, and nowhere else.
Verify the engineering in 30 seconds
Open developer tools, go to the Network panel, and clear the log.
Drop an HTML file into the converter and watch what the page requests.
You will see the engine scripts load once, a font file download only if your text needs glyphs the standard faces lack, and a small ping that counts the operation. No request carries your markup, and nothing outbound is anywhere near the size of your file.
The decisive test: load this page, disconnect the machine from the internet, and convert. It still works, which is structurally impossible for a cloud tool.
That architecture has one consequence worth stating plainly: anything your markup expects to fetch from the network will not arrive. A link rel="stylesheet" pointing at an external CSS file is ignored, exactly like a remote image. Inline the CSS into a style block before you convert, and the problem disappears.
When the Output Looks Wrong, and How to Fix It
Files are parsed the moment they land in the drop zone, so anything unreadable is rejected before it costs you a conversion. Everything in this table is a rendering problem that shows up in the finished PDF instead.
Symptom
Technical Cause
Engineering Fix
The layout collapsed into one stacked column.
Flexbox, Grid and floats are not implemented, so those nodes fall back to document order.
Accept the stack if the document only has to be read, or rebuild the part that matters as a table, which does paginate properly.
None of my CSS applied.
The CSS lives in an external file pulled in by a link tag, and the engine never fetches from the network.
Move the CSS into a <style> block inside the head, or put it in style attributes on the elements themselves.
Some styling applied, the complex parts did not.
Rules using combinators, pseudo-classes or attribute selectors are skipped, and counted in the report.
Rewrite the critical rules with flat class selectors, or set those few declarations inline where nothing can override them.
Images are missing.
The src values are absolute URLs, or the image folder was not included in the batch.
Drop the picture files alongside the HTML, or convert the sources to data URIs. Remote URLs are blocked by design.
A line of text runs off the right edge.
An unbroken token, usually a long URL or a hash, sits in a container with nowhere to break.
The engine breaks long tokens on its own in most cases. If one escapes, remove the fixed width from the container around it.
The whole document came out as one endless page.
That is what an unpaginated article is. A long scrolling page is genuinely dozens of sheets.
Add page-break-before: always; to your wrapper class or to h2 elements and the document divides where you want it to.
The PDF is a dark unreadable block.
The source uses a dark theme, and the engine paints on white by default to avoid flooding the page with ink.
Turn the dark rules off in your CSS, or switch Print background colors on if the dark version is genuinely what you want.
Accented or Central European glyphs are missing.
The extended font subset failed to download.
Check the Network panel for blocked requests to /assets/fonts/ and allow them. Everything else runs offline, but those glyphs are a real file.
The browser tab ran out of memory.
A single enormous document, or a batch full of uncompressed inline images.
Split the job into smaller runs. A tab has a hard memory ceiling that no account tier can raise.
Best practice for system-generated markup
Never run the whole batch blind. Convert one representative file first.
Read the result screen and note which selectors were skipped and which images failed.
Open the PDF and check the page breaks, the tables and the lists. Those three are where paginating engines go wrong.
Fix the template once: inline the CSS, hide the furniture with display:none, force the page breaks you need. Then convert the same file again.
Run the full batch only when that one file is right. Catching the problem on file one costs a minute. Catching it after five hundred invoices costs your afternoon.
Frequently Asked Questions
How do I convert an HTML file to PDF for free?
Drop your HTML file into the zone at the top of this page, or paste the markup into the options rail. Choose a page size, margins and orientation, then click Convert to PDF. The whole conversion runs in your browser on your own processor, needs no account for a first run, and produces a file with no watermark on it.
Can I convert a live website to PDF by pasting a URL?
No, and that is a deliberate design decision. Fetching a URL means our system makes a network request for you, which ends the guarantee that your data never leaves your machine. Save the page locally with Save Page As, or copy the specific element you want out of your browser developer tools, and convert that instead. You also skip the sidebars and navigation that way.
Is my private HTML uploaded to your server for processing?
No. Parsing, layout and PDF writing all happen inside your browser, and there is no upload endpoint to send anything to. Your markup never crosses the network. The simplest way to confirm it is to load this page, disconnect from the internet, and run a conversion offline.
Which CSS properties does the layout engine support?
Font size, weight, style and family, text color, background shading, alignment, margins, padding, text indent, line height, list style and page breaks, applied through type, class and id selectors. Flexbox, CSS Grid, floats and positioning are not implemented, and rules using combinators or pseudo-classes are skipped and counted on the result screen.
Why are the images missing from my generated PDF?
Because those image tags point at absolute URLs on a remote server. The engine resolves data URIs and relative paths matched against picture files you drop in alongside the HTML, and it refuses to make outbound requests, which would leak your IP address and the document you are converting. Drop the local image files into the queue and they appear.
Can I paste raw HTML code instead of saving and dropping a file?
Yes, and for a snippet it is the faster route. The text field in the options rail takes a complete document or a bare fragment, and a fragment gets wrapped in a proper document structure automatically. You do not have to write a doctype or a body tag just to see how a table prints.
Are the HTML anchor links still clickable in the final PDF?
Yes. Anchor elements become real PDF link annotations, so they work in any standard reader rather than merely looking like links. If the document is going to print and you would rather not have the underlines, switch off Keep links clickable in the options rail.
Does the PDF engine use the web fonts defined in my stylesheet?
No. It embeds three families of its own: Liberation Sans, Liberation Serif and Liberation Mono. Your CSS font stack is read left to right and mapped to whichever of the three it names first. Those faces are metrically compatible with Arial, Times New Roman and Courier New, so line breaks fall where the page was designed for them, and no font is fetched from an external server.
Will Central European or accented characters render correctly?
Yes. Generic converters tend to stop at Latin-1 and print question marks for anything beyond it. This engine covers the full Latin range, including Central European, Baltic, Turkish and Vietnamese, and it embeds only the glyph subset your document actually uses so the file stays small.
How do I force a page break in the PDF?
Put page-break-before: always on the element that should start a new sheet. It is the most useful print property the engine supports, and applying it to your top level headings or to the wrapper around each invoice is the fastest way to control pagination in a long document.
Why did the converter drop the background colors from my layout?
Background shading is off by default, which is what your browser does when it prints, and it is the reason a dark themed page comes back readable instead of as a black rectangle. Turn on Print background colors in the options rail if you need table shading or a colored panel in the output.
Can I process multiple HTML files at once?
Yes. A batch holds 20 files and 100 MB, and by default they are merged into one PDF in card order. Switch off Merge all pages into one PDF to get a separate file for each input. CartHacker Premium raises the batch to 100 files and 500 MB and removes the counter that limits a free account to 2 conversions every 12 hours.
Does the system add a watermark to the finished document?
No. The output holds your markup and nothing else: no stamped logo, no trial banner, no attribution link. The file is cleared for commercial use, and there is no paid tier that removes a mark, because there was never a mark to remove.
Should I use this tool or my browser Print to PDF function?
For a faithful picture of a live web page as its designers built it, press Ctrl+P and use the browser. Its layout engine implements Grid and Flexbox properly and this one does not. Use this converter when you are working from raw markup, running a batch, needing identical output every time, or handling data that must not touch an external server.
The rest of the PDF suite
All of these run the same way: your file is read by JavaScript on your own machine, the work happens on your processor, and the result is handed back to you as a download that never existed anywhere else.
Free speed test and trust badges for Shopify and WooCommerce stores
Find the apps that slow your store down, by name and in milliseconds, then answer shoppers' doubts with trust badges under Add to cart. Both are free, with no card and no access to your store admin.
Change the link after printing and count the scans. 5 tracked codes on a free account, static codes unlimited.
Logo and colors
SVG for print
Wi-Fi and business cards
Free allowance used
That was your free operation for the next 12 hours. A free account doubles it in fifteen seconds.
Anonymous visitors get one operation per 12 hours, per network address. That is not a sales tactic, it is the only lever we have: this tool runs on your processor, not ours, so the run itself earns us nothing. An account tells us who you are, and the ceiling goes up the moment you have one. Your allowance resets in 12 h.
Two operations every 12 hours instead of oneEnough to finish a job. Merge the contract, then convert the scans, without waiting out a timer between the two.
Bigger batches, bigger filesTwenty files per batch and 100 MB in total. Whole scan folders stop bouncing off the drop zone.
The rest of the toolkitThe QR code generator with editable destinations and scan analytics, plus every tool we ship next, on the same account.
Still nothing uploadedAn account changes what you are allowed to run. It does not change where your files are processed, which is still your own machine.
No credit card, no trial period, no sales call. Join with Google, GitHub, Facebook or email.
Both free operations used
You have used both operations in this 12 hour window. Premium removes the counter entirely.
Free accounts get two operations per 12 hours, and yours reset in 12 h. Waiting costs you nothing and is a completely reasonable choice. If PDF work is a weekly job rather than a one-off, the counter is the wrong tool for you and Premium takes it off the page.
No operation counter at allMerge four hundred purchase orders on a Tuesday afternoon. Premium removes the 12 hour window instead of widening it.
100 files and 500 MB per batchBuilt for the archive job nobody wants: a year of invoices, a full product photo shoot, an entire scanned lease.
Still nothing uploadedPremium changes how much you can run. Every file is still read and written on your own machine.