A PDF page can hold a few lines of text or one full-page image, and the two are stored in very different ways. The page count therefore tells you little about the file size. A PDF is a container, and its size is the sum of what it stores: page instructions, images, fonts and bookkeeping.
This guide separates those parts, gives the formula for image data with a labeled example, and explains the filters that compress streams. You can then judge any change with the compression ratio calculator instead of guessing.
Where the bytes go inside a PDF
The PDF specification (ISO 32000-1) says objects with large amounts of data, "such as images and page descriptions, shall be represented as streams" (section 7.3.8.1). A stream can be passed through a filter that compresses it, but a writer only "may" do so (section 7.4.1). A stream with no filter is stored as is.
| Part | What sets its size | What the specification offers to reduce it |
|---|---|---|
| Page content | How much text and drawing is described | A compression filter on the stream |
| Images | Width × height × components × bits per component | Image filters; fewer pixels |
| Embedded fonts | Which font programs are included | Font subsets (section 9.6.4) |
| Object structure | The number of objects | Object streams, which store objects "more compactly" (section 7.5.7) |
| Saved edits | Changes appended to the end of the file | Writing the file out whole instead of appending |
Image data: size follows pixels
Section 8.9.3 says an image is described by four values: width, height, color components per sample and bits per component. Each row begins on a byte boundary, so the uncompressed size is:
bytes = height × ceil(width × components × bits per component ÷ 8)
Worked example. Example: a US Letter page (8.5 × 11 inches) scanned at 300 pixels per inch is 2,550 × 3,300 pixels, or 8,415,000 pixels.
| Mode | Bits per pixel | Uncompressed bytes |
|---|---|---|
| Color | 24 (3 components × 8 bits) | 25,245,000 |
| Grayscale | 8 | 8,415,000 |
| Black and white | 1 | 1,052,700 |
For black and white, one row is 2,550 bits, which rounds up to 319 bytes, and 319 × 3,300 = 1,052,700. The image file size calculator uses width × height × bits ÷ 8 without row padding, so it shows 1,051,875 bytes, 825 bytes lower.
Halving both dimensions (1,275 × 1,650) leaves a quarter of the pixels: 25,245,000 ÷ 4 = 6,311,250 bytes for the color case.
Resolution matters more than it seems because pixels grow with the square of it. Doubling pixels per inch from 300 to 600 multiplies the pixel count by 4. Components and bits per component scale the size linearly. Three color components cost three times what one gray component costs at the same bits, and a 16-bit component doubles an 8-bit one.
What the compression filters do
The specification lists its standard filters in Table 6. Three of them show the range of choices.
| Filter | How the specification describes it |
|---|---|
| FlateDecode | The zlib/deflate method; lossless, and usable for any kind of stream |
| DCTDecode | A technique based on JPEG, "reproducing image sample data that approximates the original data" |
| CCITTFaxDecode | Typically for monochrome image data at 1 bit per pixel |
Flate is "based on the public-domain zlib/deflate compression method" (section 7.4.4.1), which RFC 1951 defines as LZ77 plus Huffman coding. It can "discover and exploit many patterns in the input data, whether the data is text or images," and an optional predictor "improves the compression of sampled image data."
Flate has a worst case too. When no pair of adjacent bytes appears twice, it expands its input by no more than 11 bytes or a factor of 1.003, whichever is larger (note 2 of section 7.4.4.1). The DCT filter is lossy, and section 7.4.8 calls JPEG "designed specifically for compression of sampled continuous-tone images and not for general data compression."
Worked example. Example: the 25,245,000-byte color scan above is stored in 6,000,000 bytes. These are sample inputs, not a prediction, because the result depends on page content.
ratio = 25,245,000 ÷ 6,000,000 = 4.21 : 1
percent saved = (1 − 6,000,000 ÷ 25,245,000) × 100 = 76.2%
space saved = 25,245,000 − 6,000,000 = 19,245,000 bytes
Fonts, structure and saved edits
A font program "may be embedded in a PDF file as data contained in a PDF stream object" (section 9.9), so each embedded font adds its own bytes. A PDF may include subsets of Type 1 and TrueType fonts, which carry only part of a font. The Library of Congress describes PDF/A-1 as a constrained form of PDF 1.4 in which all fonts must be embedded, so a file of that kind carries its fonts with it.
Saved edits can also add size. Section 7.5.6 says an incremental update appends changes to the end of the file, "leaving its original contents intact," and deleted objects "shall be left unchanged in the file." A file saved many times this way may hold several copies of an object.
A way to find the heavy part
You can estimate where a file's size comes from with arithmetic before changing anything.
| Step | What to do |
|---|---|
| 1 | List the images and their widths and heights. The image dictionary states them explicitly (section 8.9.3). |
| 2 | Apply the formula above to each image. The result is the size before any filter. |
| 3 | Divide each result by a ratio you measured on a sample or assumed as an example. Label it as an assumption. |
| 4 | Subtract the image total from the file size. What remains belongs to page content, fonts, structure and appended updates. |
If the remainder is small, the images decide the size, and fewer pixels or a different filter are the levers. If it is large, look at fonts and saved edits first. The estimate is only as good as the ratio in step 3.
Common mistakes
- Using the page count to predict size. One image page can outweigh dozens of text pages. Work out the pixel arithmetic for each image instead.
- Scanning at a higher resolution "to be safe." Pixels grow with the square of the resolution, so 600 pixels per inch holds four times the pixels of 300. Choose the resolution the use needs.
- Zipping a PDF to shrink it. Its streams may already use the same DEFLATE method a ZIP file uses by default, which leaves little to find. See how ZIP files work and why some files barely shrink.
- Using the lossy image filter on text pages. The specification describes JPEG as made for continuous-tone images, and its output only approximates the original. For black-and-white pages, a 1-bit mode is the smaller starting point.
- Ignoring where the file came from. A file saved through repeated updates can carry old copies of objects. Check the structure before blaming the images.
FAQ
Is PDF compression lossless?
It depends on the filter used for each stream. Flate is lossless. The DCT filter is lossy and only approximates the original image data.
Why is a scanned PDF larger than a typed one?
A scan stores every page as an image, whose size follows the pixel formula above. A typed page stores text and drawing instructions plus the fonts it uses.
Can a PDF grow after a small edit?
Yes. If the edit is saved as an incremental update, the changes are appended and the original contents stay in the file.
Do embedded fonts make a PDF larger?
Yes. Each embedded font program is stored as a stream, so it adds its own bytes. Using a subset embeds only part of the font.
Sources
- ISO, ISO 32000-1:2008, Document management - Portable document format - Part 1: PDF 1.7 (authorized copy). Accessed November 6, 2026.
- IETF, RFC 1951: DEFLATE Compressed Data Format Specification version 1.3. Accessed November 6, 2026.
- Library of Congress (archived copy), PDF/A-1, PDF for Long-term Preservation, Use of PDF 1.4. Accessed November 6, 2026.



