Skip to the tool
ToolOcean

Compress a PDF

Two different operations live on this page. One strips document metadata and leaves the pages alone. The other redraws every page as a JPEG, which is what actually shrinks a scan, and what ruins a text document.

Runs in your browser. Nothing is uploaded.

How to compress a PDF

  1. Step 1: Choose the PDFPick a file. The card shows its size on disk, which is the number the comparison uses.
  2. Step 2: Pick lossless or re-encodeLossless strips metadata and rewrites the file. Re-encode pages as images turns on the quality slider and warns that text will no longer be selectable.
  3. Step 3: Download only if it got smallerPress the button. A smaller file downloads, named -optimised or -compressed. A larger result is shown and then discarded.

What compression will not recover

  • Lossless mode does not recompress images
  • Image mode is not OCR, and it removes text
  • A text PDF can get vastly larger
  • Encrypted files are not opened here

About this tool

Why most PDFs do not shrink the way you hope

A PDF is a container of objects. Text is a stream of drawing instructions and font programs. A scan is a compressed image, usually JPEG, sitting on a page the size of the paper. Those two files can have the same extension and completely different diets. Asking one slider to make both smaller, without saying which one you have, is how a compressor reports 0.0% and calls it a success. This page used to do that. It does not anymore.

Lossless mode rewrites the file and clears the Info fields: title, author, subject, keywords, producer, creator. On the fixtures measured for this page it recovered nothing you would notice. A 12-page scan went from 10,324,119 bytes to 10,324,083 bytes. A 40-page text PDF went from 165,897 bytes to 165,867 bytes. The pages were not recompressed, because pdf-lib cannot reach inside an existing content stream and re-encode the images it references. The mode exists so you can tidy a file without gambling on quality, and so the label matches the effect.

The other mode renders each page with PDF.js at twice the default scale and embeds a JPEG at the quality you set. That is a real reduction when the page was already a picture. The same 12-page scan, at quality 70, came back at 1,644,152 bytes, 84.1% smaller, in 2,376 ms on the measurement machine. The same operation on the 40-page text PDF went the other way: 165,897 bytes in, 14,810,686 bytes out, and the page refused to download it. Vector glyphs that cost a few bytes became full-page photographs. The refusal is the feature. A compressor that hands you an 89-times-larger file and calls it compressed is not compressing.

  • Runs in your browser. All processing happens locally in this tab using JavaScript.
  • No uploads. Your data is never sent to a server. There is no server to send it to.
  • Works offline. Once the page has loaded you can disconnect and keep working.
  • Unlimited & free. No usage caps, no paywall, no file size tiers.

Choose a PDF

What happens to your data

The same questions a security review would ask, answered plainly.

Read via
The browser File API, on your device
Held in
Your browser tab's memory for as long as it is open
Stored
Nothing. No cookies, no database, no server-side copy
Transmitted
Nothing leaves your device
Retained after you close the tab
Nothing
Works offline
Yes, once the page has loaded

The two modes, stated as they behave

One of them barely changes the file. The other changes what the file is.

  • Lossless means the pages are copied

    Metadata is cleared and the file is rewritten with object streams. Text stays selectable. Images keep the encoding they arrived with. Expect bytes, not megabytes, unless the Info dictionary was bizarrely large.

  • A quality slider that only appears when it does something

    The slider is hidden in lossless mode, because that mode never reads it. In image mode it sets the JPEG quality from 20 to 100, step 10, and the default is 70, which is the setting the 84.1% figure was measured at.

  • Image mode throws the text layer away

    Each page becomes one JPEG. You cannot select a sentence, search the document, or have a screen reader read it. A scan had no text layer to lose. A contract did.

  • A bigger result is not downloaded

    If the new file is the same size or larger, you get the before-and-after numbers and no download. The original you picked is never overwritten either way.

  • Your data never leaves the tab

    There is no upload step and no server to receive one. The page loads once, then all work on your PDFs happens in local JavaScript.

  • No caps or paywalls

    No daily limits, no per-file ceilings imposed by a server tier, no watermarks, and no account. The practical limit is your own device's memory.

A scan that shrinks, and a text file that must not

A scan that is mostly JPEG already

Twelve full-page photographs, the case image mode is for.

Before

Input

10,324,119 bytes, 12 raster pages

After

Output

1,644,152 bytes at JPEG quality 70

Settings: Re-encode pages as images, quality 70

Rendering at scale 2 and encoding JPEG 70 replaced twelve heavy images with twelve smaller ones and a thin page wrapper. The text layer was already absent, so making the pages pictures did not remove something a reader could select. This is the number to expect from a similar scan, not from a born-digital report.

A text PDF that should be left alone

Forty pages of real prose, already a small file.

Before

Input

165,897 bytes of text and fonts

After

What image mode produced

14,810,686 bytes, not downloaded

Settings: Re-encode pages as images

The button ran, the size was computed, and the download was blocked because the result was larger. Lossless mode on the same file saved 30 bytes. If you need this document smaller, the pages are not where the weight is. Splitting off pages you do not need removes more than either compressor mode will.

Measured results

Real files, real numbers, and the machine they were run on.

ScenarioInputOutputTimeNotes
12-page scan, re-encode pages as images, quality 7010,324,119 bytes1,644,152 bytes2,376 ms84.1% smaller. Pages are JPEGs afterwards
12-page scan, lossless10,324,119 bytes10,324,083 bytes46 ms36 bytes. Metadata only
40-page text PDF, lossless165,897 bytes165,867 bytes22 ms30 bytes. Text unchanged
40-page text PDF, re-encode pages as images165,897 bytes14,810,686 bytes875 msAbout 89× larger, so the page refuses the download

How this was measured: Measured by driving this page in headless Chrome 152 on an Apple M4 Pro running macOS 15.5, on 2026-09-17. The fixture is handed to the page's own file input, the page's own button is pressed, and the figure recorded is the size of the file the page produces. Timings come from a warm page on a fast machine with no network involved, so treat them as a floor rather than a typical result.

When each mode is the right one

A scan that will not fit in an email

Mailbox limits are still measured in megabytes. A 10 MB scan that becomes roughly 1.6 MB at quality 70 is the difference between an attachment and a bounce. Check a page at 100% zoom before you send it, because the JPEG is the page now.

A phone photo of a paper form

The page was pixels when the camera took it. Re-encoding does not destroy a text layer that was never there. Drop the quality if the upload form on the other end has a hard cap, and stop when the type becomes hard to read.

A report you still need to search

Leave the mode on lossless. You will almost certainly be told the file did not shrink. That answer is more useful than a download you can no longer copy a paragraph out of.

An archive that should stay a document

Image mode is a display copy. It is a poor archival master, because the words are no longer words. Keep the original next to any JPEG version you make for sending.

What compression will not recover

The honest edges, and where to go instead when you hit one.

Lossless mode does not recompress images

The measured saving on a real scan was 36 bytes. If a website once promised this kind of rewrite would halve a scan, it was describing a different program.

Image mode is not OCR, and it removes text

You get pictures of pages. Nothing reads the letters back into a text layer. Search, copy, and screen readers stop working on that download.

A text PDF can get vastly larger

The 40-page prose fixture grew from 166 KB to 14.8 MB. The page blocks that download. It cannot invent a smaller vector file.

Use PDF Split instead →

Encrypted files are not opened here

Both modes need to read the pages or the document catalogue. A password-protected PDF has to be unlocked first, with a password you know.

Use Unlock PDF instead →

Questions about PDF compression

Is the PDF uploaded to be compressed?

No. PDF.js renders in the tab and pdf-lib writes the download in the tab. Disconnect after the page has loaded and both modes still run. The network panel shows the script for this tool, then no request that carries the document.

Which mode should I start with?

If you can drag to select a sentence in the PDF, start with lossless and expect almost no change. If the pages are photographs of paper, choose re-encode and look at the size it reports. The wrong choice on a text file is blocked when the result grows. The wrong choice on a scan is a file that is still huge.

Why was the lossless result the same size?

Because the pages were already stored efficiently and the Info dictionary was tiny. The 12-page scan lost 36 bytes. The 40-page text PDF lost 30. A toast tells you when nothing meaningful was stripped, instead of announcing a 0.0% saving as if it were a result.

What does the quality number mean?

It is the JPEG quality passed to the canvas encoder, from 20 to 100 in steps of 10. The default, 70, is what produced 1,644,152 bytes from the 10,324,119-byte scan. Higher keeps more detail and more bytes. The control is absent in lossless mode so it cannot pretend to affect a path that ignores it.

Will the text still be selectable?

After lossless, yes. After image mode, no. The page says so next to the radio button, because this is the trade that matters more than the percentage. Annotations and a real text layer do not survive being photographed.

Why did nothing download?

The new file was not smaller. Image mode on the 40-page text fixture produced 14,810,686 bytes from 165,897, and the button stopped. You still see both numbers on the card. Lossless mode shows the same refusal when the rewrite does not beat the original, which is the usual case.

Does this resize the page or change the paper size?

No. Image mode renders at scale 2 so the JPEG has enough pixels to look acceptable on a dense screen, then places that JPEG on a page of the original point size. Lossless mode does not render at all. Neither mode crops, rotates, or reflows paragraphs.

Can I compress one page and leave the rest?

Not on this page. Both modes walk the whole document. Cut the pages you care about with the splitter first, then compress that smaller file, if the weight is concentrated in a few sheets.

A password-protected PDF will not open. What now?

This tool does not ask for a password. If you know it, remove it with the unlock tool and compress the clear copy. There is no password search here.

Are fonts and vectors preserved in image mode?

Only as pixels. The font program is not copied, and a vector logo becomes part of the JPEG. Zoom in and you will see compression blocks rather than crisp outlines. Lossless mode keeps the fonts and the vectors exactly, and usually keeps the file size too.

Does compression need a connection?

Only to load this page the first time, including PDF.js when you have not opened it before. The render loop and the file write do not call an API. There is no queue and no account the job is charged against.

Is there a free-tier cap on how many PDFs I can compress?

No cap, and no account to attach one to. The cost is your CPU and your RAM. A twelve-page scan took a bit over two seconds on the measurement laptop and will take longer on a phone, because the work is on the main thread.

Can I open the page already aimed at 100 KB or 200 KB?

Yes. Compress a PDF to 100 KB and compress a PDF to 200 KB load this same tool with that ceiling selected. 1 KB is 1024 bytes. Lossless is attempted before any page is turned into a picture.

What is the largest PDF this will accept?

Nothing in the page checks a maximum. The scan fixture was about 10 MB and finished. A few hundred megabytes has to fit in memory twice, once as the source and once as the rendered bitmaps, and a phone will fail that sooner than a laptop will.