How browser-based file compression works

See how files are checked, processed and downloaded in your browser, with clear limits and steps for checking the result.

Folders pass through a green press inside a browser-shaped frame.
Compression happens on your device. The browser downloads processing code when a tool needs it.

FileCompresser reads and processes selected files in your browser tab. The page downloads its interface and processing code, while the file itself stays on your device during processing.

Step one: the file is checked before anything is processed

The first thing that happens is not compression. Before an encoder is even loaded, the file is inspected: its size is checked against the limit for that tool, and its first bytes are compared against known file signatures — the PNG magic number, the JPEG SOI marker, the ZIP local file header.

This matters more than it sounds. A file called photo.jpg could be anything. Renaming a program to .jpg is trivial, and a tool that trusts the extension will happily hand it to a decoder. Checking the actual bytes is what makes "this looks like a PDF, which this tool does not support" a real answer rather than a guess.

Step two: an engine is loaded, and only the one you need

Image compression uses a Web Worker where supported, with browser canvas operations also used for decoding and target-size encoding. Heavy work can still affect responsiveness on constrained devices. Video, audio and GIF work uses a WebAssembly build of FFmpeg — about 21 MB of engine code, loaded when needed and available for browser caching.

The larger FFmpeg engine is fetched when you start a media job. An ordinary page view loads the page, styles, images and site JavaScript, using fonts already on your device. Engine downloads carry code; your selected file stays in the browser.

The full path of a file, from selection to download.

Step three: the output is a real file, or an honest failure

An encoder produces a Blob: actual output bytes in memory, with a measured size and detected format. Ordinary compression discards a candidate that is not smaller and returns the original unchanged with 0% reduction. Requested format conversions are described separately; any size increase is labelled honestly.

Outputs receive workflow-specific checks. A rewritten PDF is parsed again and its page count checked. ZIP entries are checked for unsafe paths, expansion limits and CRC integrity before downloads are offered. These checks do not prove every PDF feature is unchanged or that extracted files are free of malware.

Step four: keep or release the result

Downloading a copy does not remove the queue entry. You can review the applied settings, compare supported images and rerun from the retained original. Remove a result or clear the queue when finished. The application releases its references and temporary object URLs; the browser controls memory reclamation. Downloaded copies remain in the device location you selected.

Further reading