Initializing, please wait a moment

How to Compress a File Online (Step by Step)

Last reviewed: 2026-07-01

Compressing a file online shrinks it in the browser so it clears an email size cap or uploads faster, with no software to install. There is no single best tool - the size win comes from matching the compression method to the file type.

File typeTypical input sizeTypical compressed sizeSize saving
JPG photo (quality 80)5 MB1-1.5 MB70-80%
HEIC photo - convert to JPG2 MB2-3 MB JPG (opens everywhere)0-50% depending on quality
Text-heavy PDF (forms, revision history)12 MB2-3 MB75-83%
DOCX with embedded screenshots12 MB4-5 MB58-67%
Plain-text source code (.zip)4 MB0.8-1.2 MB70-80%

30-second answer. Identify the file type first, then pick the matching tool. JPG / PNG photo: Compress Image at quality 80 typically saves 50-70%. HEIC photo: HEIC to JPG - the conversion is the size win. PDF: Flatten PDF when forms / annotations bloated the file. Single video: re-encode at lower bitrate (browser tools handle short clips). Document / spreadsheet / source-code file: ZIP it - DEFLATE cuts text-heavy files by 50-80%. If your input is a folder, not a single file, jump to how to compress a folder for email instead.

Step 1 - identify the file type

Identify file type before compressing to pick the right path
Match your file extension to its compression route before you start

The "compress a file online" search returns generic tools that try to handle every type with the same algorithm. That works for some inputs and badly underperforms for others. Look at your file's extension first:

  • .jpg / .jpeg / .png -> image-compression path (Step 2A).
  • .heic / .heif -> convert to JPG first; the conversion is the bigger size win than any compression run (Step 2B).
  • .pdf -> PDF-specific flatten / re-save path (Step 2C).
  • .mp4 / .mov / .mkv -> re-encode at lower bitrate (Step 2D).
  • .docx / .xlsx / .pptx / .csv / .txt / .json / .xml / source code -> ZIP-it path (Step 2E).
  • .mp3 / .wav / .flac -> audio re-encode (Step 2F).

If you have a folder rather than a single file, ZIP is the answer because ZIP both bundles and compresses in one step. File compressor vs ZIP covers folder-vs-file decisions in detail.

Step 2A - JPG / PNG photos

Step 2A - JPG / PNG photos on How to compress a file online: open Image Compressor, drop the still, pick a quality target, then download the smaller file and compare bytes before you replace the original.

PNG is a lossless format. If your "PNG photo" is actually a photograph, save it as JPG instead - the size cut is much bigger. PNG should be reserved for screenshots, UI mockups, line art, and any image that needs transparency. JPG vs PNG for the web walks through the format choice.

Step 2B - HEIC photos

HEIC files from iPhone are already small (HEVC encoding), so re-compression rarely helps. The bigger problem is compatibility - HEIC does not open on Windows, older Android, most browsers, and most email clients without a paid codec install. Open HEIC to JPG, drag in the .heic file, download the .jpg. The JPG copy is similar size or slightly larger but opens everywhere. For batch HEIC work see how to convert 100 HEIC photos to JPG.

Step 2C - PDF files

PDFs come in two flavours. A scanned-document PDF (large because each page is a high-resolution image) compresses by re-saving at lower image quality - that path needs dedicated PDF software outside the scope of browser tools. A text-PDF that has been bloated by form fields, annotations, or revision history compresses well via Flatten PDF - flattening removes the editable layers, dropping a 12 MB form PDF to 2-3 MB. If you have a stack of small PDFs to send to one person, merging them into one is often the goal rather than compressing each individually - use Compose PDF.

For more PDF routing see the PDF editing ladder.

Step 2D - video files

Browser-only video compression is feasible for short clips (under 60 seconds at 1080p). Open Video Converter, set output bitrate to 1500 kbps for 1080p or 800 kbps for 720p, and re-encode. A 60 MB phone clip typically lands at 8-15 MB. For longer videos or 4K source, browser memory limits become a problem; use FFmpeg locally instead - FFmpeg online vs local FFmpeg covers the boundary case.

Step 2E - documents and source code

Step 2E - documents and source code on How to compress a file online: zip folders with Zip Compressor, or minify CSS/JS when the payload is text - name the archive after the project so you can find it later.

Step 2F - audio files

Browser ZIP does not help because audio formats are already compressed. The right path is format conversion - WAV to MP3 at 192 kbps, or FLAC to OGG. Browser tools for audio re-encoding are limited; dedicated software (Audacity, fre:ac) is faster for this case. The exception: if you have a single 5 MB WAV that needs to fit a 2 MB upload limit, online conversion is fine.

Step 3 - verify the output

Step 3 - verify the output after How to compress a file online finishes: open the result, check size and readability, and keep the original until you confirm nothing important was lost.

  • Open the compressed file once. Image compressors can rarely produce a corrupt JPG, but a corrupt PDF or video looks fine in the file manager and only fails when the recipient opens it.
  • Check the size against the limit you needed. Email caps are typically 25 MB attachment, sometimes 10 MB. Some web forms cap individual fields at 5 MB.
  • If the file is going to a contract / legal / banking system, keep the original. Some recipients reject lossy-compressed files because they must accept the bit-exact original.

What if the result is still too big?

If your compressed file is still over the limit, two options usually work. Convert format: many "compressed" files are still in the wrong format. PNG photo to JPG can give 90% size cut, even after a JPG compress. Use a transfer link: Drive, Dropbox, WeTransfer all give you a URL to send instead of an attachment. The recipient downloads the original file at full fidelity. For files larger than 25 MB this is almost always the right answer.

If your file was supposed to be a folder of files, ZIP is the answer (one ZIP, all files inside). See how to compress a folder for email. If you already have a ZIP that is too big, see how to reduce zip file size online.

Privacy

Privacy on How to compress a file online means the file stays in your browser session for client-side paths when available - avoid uploading secrets to any compressor you do not trust.

Depth: why each file type needs its own compression path

The reason a single compress button never fits every file is that each format already stores its own data differently, so the actual shrink has to happen in a tool built for that type. A photo in JPG, PNG, or WebP gets smaller by re-encoding its pixels, which is exactly what Compress Image does; a video, by contrast, needs a full re-encode through the Video Converter because wrapping footage a codec has already packed inside a ZIP barely changes its size. Office documents behave differently again: a DOCX, XLSX, or PPTX is already a ZIP archive under the hood, so zipping it a second time gains almost nothing - the practical move there is to leave the file as-is and pack it in a ZIP only when you want a single bundle for transport. PDFs sit in their own lane, where flattening or splitting through PDF Tools trims size more reliably than generic compression would. Routing by type this way keeps each job down to seconds for a typical file, instead of pushing everything through one path that helps photos but wastes effort on video and documents.

Why trust these tools

  • Ten-plus years of web tooling. The freetoolonline editorial team has shipped browser-based utilities since 2015. The goal has never changed: get you to a working output fast, without an install.
  • No install, no sign-up. Open a tool and get a working output in seconds - nothing to download and no account to create. Tools that need heavy processing run it on our service, so even a low-powered machine gets the job done.
  • Analytics stops at the page view. We measure which pages get visited, not what you type or upload inside a tool. There is nothing to sign in to and no profile is attached to your input.
  • Open-source core components. The processing engines underneath (libheif, libde265, pdf-lib, terser, clean-css, ffmpeg.wasm, and others) are public and audit-able. We link to each one in its tool page's footer.
  • Free, with or without ads. All tools are fully functional without sign-up. The Disable Ads button in the header is always available if you need a distraction-free run.

Related tools:

Tags: #guide, #zip, #compress, #image-editing, #pdf, #video

Related guides:

Related news: