Compress Large EPUB Files

Most "compress EPUB" guides assume a 5MB file you want to drop to 3MB. This isn't that. If your EPUB is 200MB, 500MB, or 1GB, the standard advice (run it through a compressor, done) won't even start — most online compressors cap input at 10–25MB, including ours on the free tier. Big EPUBs need a different workflow: find what's actually causing the size, fix that specifically, then re-pack.

Why your EPUB is enormous (it's not the text)

Even a 1,000-page novel is roughly 2MB of XHTML. If your EPUB is 200MB, the other 198MB is one of these four things:

  • Uncompressed images — A single high-res photo straight from a phone camera is 8–15MB. A picture book or photography portfolio with 30 of them is instantly 300MB. This is the #1 cause.
  • Fixed-layout pages as scanned images — Common for manga, magazines, and "rich" children's books. Every page is a JPEG or PNG. 200 pages × 1MB = 200MB.
  • Embedded fonts (especially CJK) — A full Chinese, Japanese, or Korean font is 5–15MB per weight. Four weights = 60MB just in fonts.
  • Forgotten audio/video — EPUB 3 supports embedded media. A 90-second narration MP3 per chapter across a 30-chapter book adds 200MB+ that most readers will never play.

Knowing which one applies to your file determines the fix. Don't guess — open the EPUB and look.

Step 1: Find the size hog

EPUBs are ZIP archives. Rename your file to .zip, extract it, and look at what's inside:

cp book.epub book-inspect.zip
unzip book-inspect.zip -d book-inspect/
du -h book-inspect/* book-inspect/OEBPS/* 2>/dev/null | sort -h

You'll see something like:

4.0K  book-inspect/META-INF
1.2M  book-inspect/OEBPS/text
12M   book-inspect/OEBPS/fonts
187M  book-inspect/OEBPS/images

That tells you to attack the images/ folder first. Sort the images themselves by size: du -h book-inspect/OEBPS/images/* | sort -h | tail -20 shows the 20 worst offenders. Often two or three files account for most of the bloat.

Step 2: Fix the heavy images

Three knobs, in order of impact:

Resize first

If an image is 6000px wide, you're storing detail no e-reader will display. Most reading devices are 1500–2500px wide max. Anything bigger is wasted bytes.

find book-inspect/OEBPS/images -name "*.jpg" -exec mogrify -resize 1500x1500\> {} +
find book-inspect/OEBPS/images -name "*.png" -exec mogrify -resize 1500x1500\> {} +

The \> means "only resize if larger than" — ImageMagick won't upscale smaller images.

Re-encode photos as JPEG

Photos shouldn't be PNG. PNG is lossless and huge for photographic content. Convert and re-compress:

# Recompress JPEGs at quality 80 (visually identical, ~50% smaller):
find book-inspect/OEBPS/images -name "*.jpg" -exec mogrify -quality 80 {} +

# Convert PNG photos to JPEG (saves 70-90% per file):
for f in book-inspect/OEBPS/images/*.png; do
  magick "$f" -quality 80 "${f%.png}.jpg"
done

If you convert PNGs to JPEGs, you'll need to update the img src references inside the XHTML files (search/replace .png.jpg in OEBPS/text/*.xhtml). Skip this step for diagrams, logos, and anything with hard edges or transparency — JPEG butchers those.

Quantize palette PNGs

For diagrams, screenshots, line art — PNGs that should stay PNG — use pngquant to reduce the color palette:

find book-inspect/OEBPS/images -name "*.png" -exec pngquant --quality=65-85 --ext=.png --force {} \;

Visually indistinguishable, 60–80% smaller per file.

Step 3: Strip fonts you don't need

Open book-inspect/OEBPS/fonts/. If you see eight font files (Regular, Italic, Bold, BoldItalic × multiple families), most are probably unused — the book just bundled the entire family.

Look at the CSS in OEBPS/styles/*.css to see which fonts are actually referenced via @font-face. Delete the unreferenced ones. Then in the OPF manifest (content.opf), remove the corresponding <item> entries so the EPUB stays valid.

For CJK content, consider using a subset font containing only the characters that actually appear in your book — full CJK fonts are 5–15MB each. Tools like pyftsubset (from fonttools) build subsets in seconds.

Step 4: Re-pack the EPUB correctly

EPUB has a strict packing requirement: mimetype must be the first file and stored uncompressed. Do it in two steps:

cd book-inspect/
zip -X0 ../book-compressed.epub mimetype
zip -rX9 ../book-compressed.epub META-INF/ OEBPS/ -x "*.DS_Store" -x "Thumbs.db"
cd ..

-0 stores mimetype uncompressed, -9 compresses everything else at max. The -x flags exclude OS junk that often hitchhikes.

Step 5: Validate

You just rewrote the binary. Validate before you ship:

java -jar epubcheck.jar book-compressed.epub

Or upload to the EPUB validator (works for files up to 10MB free / 100MB Pro). Common post-compression breakage: missing image references in the manifest after you renamed PNG → JPG, or broken font references after you stripped a font that was actually used somewhere.

Realistic before/after numbers

Real examples from compressing oversized EPUBs:

  • Photography book, 412MB → 47MB — Resized images to 2000px max, JPEG quality 82. No visible quality loss on a Kindle Oasis or iPad.
  • Manga volume, 380MB → 95MB — Pages were 2400×3600 PNG. Resized to 1600×2400 and converted to JPEG at quality 88. Acceptable for reading; archival quality lost.
  • Children's picture book, 215MB → 38MB — Mix of resize + JPEG re-encoding + dropping two unused font weights.
  • Academic textbook, 156MB → 22MB — Most of the bloat was pre-print 600dpi figure scans. Resized to display resolution (150dpi at print page size).

If you can't run command-line tools

Calibre's "Convert books → EPUB → EPUB Output" with image-resize options handles most of this in a GUI. Set Maximum image size to 1500px and JPEG quality to 80 under the EPUB Output tab. Slower than the manual workflow but no terminal needed.

For files under 100MB after a first-pass cleanup, our EPUB compressor on Pro handles the final pass — image re-encoding, palette quantization, max-compression re-zip, in one upload.

What not to bother with

  • Compressing the XHTML/CSS — text is already a tiny fraction of the file. Minifying it saves kilobytes when you need megabytes.
  • Removing the cover — the cover is one image. Resize it like any other; deleting it just makes the book look broken in stores.
  • "EPUB optimizers" that don't tell you what they do — half of them just re-zip at the same compression level and report a fake savings number.

Related

Try it now — free

Compress EPUB files to reduce size for Kindle, Kobo, and KDP upload limits. Free online EPUB compressor — image optimization, font subsetting, ZIP repacking. No watermark, no signup.

Compress EPUB Files →

Found this helpful? Share it