← Back to blog
Blog2 min read

How PDF Tools Can Work Without Uploading Your Files — Explained Simply

WebAssembly, pdf-lib, and why your PDF can be merged or compressed without ever leaving your machine.

WebAssembly, pdf-lib, and why your PDF can be merged or compressed without ever leaving your machine.

When a website says "your file never leaves your device," it usually sounds like marketing. For browser-based PDF tools, it's literal — and the reason it works is WebAssembly.

WebAssembly (Wasm) is a compact, fast binary format that runs inside the browser at near-native speed. The libraries needed to read and rewrite PDFs — pdf-lib for editing, pdf.js for rendering, browser-image-compression for re-encoding embedded JPEGs — all compile to JavaScript or Wasm and ship as a few hundred kilobytes of code with the page. When you drop a PDF onto the page, the file is read into memory using the standard FileReader API, handed to the library, and the modified bytes are returned to you as a downloadable Blob. There is no network request for the file itself at any point.

You can verify this. Open DevTools → Network tab, drop a 30 MB PDF onto a browser-based tool, and watch: no POST request, no upload bytes, nothing. The only network activity is the initial download of the page and its Wasm bundles, which is cached after the first visit.

The catch is memory. Your browser tab runs in a sandbox with a soft memory ceiling — roughly 2 GB on most desktops, less on phones. A 500 MB PDF being merged with another 500 MB PDF can briefly hold 2–3x that in memory while pdf-lib parses the object graphs. On a 16 GB MacBook this is fine; on a 4 GB Chromebook it can crash the tab. Server-based tools don't have this limit because they have actual servers.

The other tradeoff is processing speed for very specific tasks. OCR on a 200-page scanned PDF is heavy enough that Tesseract.js in the browser is slower than a server with a GPU. For merge, compress, and JPG-to-PDF — the three things 95% of users actually need — the browser is fast enough that you won't notice.

For everything privacy-sensitive — payslips, contracts, medical scans, tax documents — browser-based processing isn't just a nice-to-have. It's the only architecture where the tool provider literally cannot see your file, because the file never reaches their servers. #webassembly #privacy #how it works