# Compress PDF

> Shrink a PDF in the browser. Pick a preset or a target size and compare the file before and after.

Free PDF compressor. Shrink a PDF for an upload limit without sending it anywhere. Light, medium, and strong presets recompress embedded images and clear document info. Text stays selectable. A target of 100 KB, 200 KB, or 500 KB tries harder until the file fits or the smallest result is reached.

- Page: https://benchline.fabwaseem.com/t/pdf-compress
- Runs: in the browser. Input stays on the device.
- Price: free, no account
- Input: One PDF, a light, medium, or strong preset, and an optional target size.
- Output: A PDF, plus the size before, the size after, and how many images were recompressed.
- Keywords: pdf compressor, compress pdf, online pdf compressor
- Updated: 2026-10-18
- Built by: Waseem Anjum (https://fabwaseem.com)

## How to use it

1. **Add a PDF.** Drop one PDF. It stays in this browser.
2. **Pick a preset and an optional target.** Light, medium, or strong. Add a 100 KB, 200 KB, or 500 KB target when you need to fit a limit.
3. **Compare and download.** The result shows the size before and after. Download the smaller file.

## Use it from an AI agent

MCP tool name: `compress_pdf`
MCP endpoint: https://benchline.fabwaseem.com/mcp (Streamable HTTP, no key)
HTTP: POST https://benchline.fabwaseem.com/api/v1/tools/pdf-compress with the input as the JSON body
This call fetches a public URL on the server. Private addresses are refused.

Recompress embedded images in a PDF. Presets are light, medium, and strong. Send base64 or a public URL. Private addresses are refused. An optional target size tries harder. Returns the PDF and the sizes before and after.

### Input schema

```json
{
  "type": "object",
  "properties": {
    "data": {
      "description": "PDF bytes as base64 or a data URI. Decoded size is capped at 10 MB. Provide data or url.",
      "type": "string"
    },
    "url": {
      "description": "Public URL of a PDF. Private and local addresses are refused. Provide data or url.",
      "type": "string"
    },
    "filename": {
      "type": "string"
    },
    "mimeType": {
      "type": "string"
    },
    "preset": {
      "default": "medium",
      "type": "string",
      "enum": [
        "light",
        "medium",
        "strong"
      ]
    },
    "targetBytes": {
      "default": null,
      "description": "Optional size ceiling in bytes, such as 102400.",
      "anyOf": [
        {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 20000000
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "preset",
    "targetBytes"
  ],
  "additionalProperties": false
}
```

### Example tools/call

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "compress_pdf",
    "arguments": {
      "url": "https://example.com/file",
      "preset": "medium",
      "targetBytes": null
    }
  }
}
```

Setup for Claude, Cursor, and VS Code: https://benchline.fabwaseem.com/mcp/guide

## Questions

### Is the PDF uploaded?

No. Compression runs in this browser. The file does not leave the device.

### Will the text still be selectable?

Yes. The tool recompresses embedded images and leaves the text drawing commands in place. It does not redraw the pages as pictures.

### Why did the file barely change?

A PDF that is already small, or that has no embedded images, has little to recompress. If a pass would make the file larger, the original is kept.

### What do the presets change?

Light uses high JPEG quality. Medium uses lower quality. Strong also downsamples images. A target size keeps trying stronger settings until the file is under that size or the ladder ends.

### What about passwords and scanned pages?

Encrypted PDFs are refused. Scanned pages stored as images shrink the most. Images inside other formats, such as JPEG 2000, are left as they are.

## Related tools

- [Merge PDF](https://benchline.fabwaseem.com/t/pdf-merge): Combine PDFs in the browser. Reorder them, keep a page range from each file, and download one document.
- [Split PDF](https://benchline.fabwaseem.com/t/pdf-split): Extract a page range, or split a PDF into single pages or chunks, then download a PDF or a ZIP.
- [Image to PDF](https://benchline.fabwaseem.com/t/image-to-pdf): Turn JPG, PNG, and WebP images into one PDF. Set the page size, orientation, margin, and order.
- [QR code generator](https://benchline.fabwaseem.com/t/qr-code-generator): Make a static QR code for text, a URL, Wi-Fi, or a vCard. Set the colors and error correction, then download SVG or PNG.
