You have a finished EPUB, but the file is 40 MB, 80 MB, or even larger. Large files can be slow to open, expensive to deliver, and may hit upload limits on some retailers. The good news is that most EPUB bloat comes from images that can be optimized without any visible loss to the reader. This guide walks you through a safe, repeatable process to reduce EPUB file size while preserving image quality and the reading experience. We will cover how EPUB images work, how to measure what is actually heavy, how to compress intelligently, and how to verify that nothing broke. Along the way, we will point out where a toolkit like EpubBit can fit naturally into your workflow.
1. Understand where the weight comes from
An EPUB is a ZIP archive with a specific structure. The largest files are almost always images: cover art, chapter openers, illustrations, and decorative elements. Text, CSS, fonts, and metadata are usually small by comparison. Before you change anything, unzip a copy of your EPUB and inspect the file sizes. On macOS or Linux, open Terminal and run:
unzip -l yourbook.epub | sort -k1 -n -r | head -20
On Windows, you can rename the EPUB to .zip, extract it, and sort files by size in File Explorer. Look for the OEBPS/Images or OEBPS/images folder. A typical novel with a single cover image might be 1–3 MB total. A heavily illustrated book can easily reach 50 MB or more. Note the largest files and their dimensions. You can check image dimensions with tools like identify from ImageMagick:
identify -format "%f %wx%h %b\n" OEBPS/Images/*
Write down the top five offenders. This baseline tells you where to focus. If your cover is 4000×6000 pixels and 8 MB, that is a prime candidate. If you have 100 inline images at 1 MB each, you need a different strategy.
2. Set realistic targets for image dimensions and file size
There is no universal rule, but you can use reader devices and common sense to set targets. Most e-readers have screens around 1072×1448 pixels (e.g., Kindle Paperwhite) or 1264×1680 (e.g., Kobo Libra). Tablets and phones have higher pixel densities but smaller physical screens. For full-page images, a maximum of 1600 pixels on the long edge is usually plenty. For inline illustrations that appear at half-page width, 1200 pixels on the long edge is often sufficient. For decorative elements, 800 pixels is generous.
File size targets: a full-page illustration can be 150–300 KB as JPEG or WebP without visible artifacts. A cover image can be 300–500 KB. Inline images can be 50–150 KB. These are starting points, not strict rules. Your genre and art style matter. A watercolor illustration may compress differently than a line drawing. Use these numbers to calculate a budget. For example, if you have 50 full-page images at 250 KB each, that is 12.5 MB. Add 1 MB for text and fonts, and your EPUB should be around 13.5 MB. If your current file is 60 MB, you have room to improve.
Always verify current retailer guidelines for cover dimensions and file size limits, as these can change. Do not assume a specific requirement without checking the official documentation for each retailer you use.
3. Choose the right format: JPEG, PNG, or WebP
EPUB 3 supports JPEG, PNG, GIF, SVG, and WebP. EPUB 2 supports JPEG, PNG, GIF, and SVG. WebP is not supported in EPUB 2. For photographs and complex illustrations, JPEG is usually the best choice for size. PNG is lossless but can be much larger; use it only for images with transparency or sharp text that must remain crisp. WebP can offer better compression than JPEG at similar quality, but support is not universal across all reading systems. If you target older devices, stick to JPEG and PNG.
For line art, diagrams, and text-heavy images, PNG-8 (palette-based) can be very small. For simple graphics, SVG is ideal and scales without loss. However, complex SVGs can be larger than a compressed raster image. Test both when in doubt.
4. Compress images without visible damage: step-by-step
You can use command-line tools or a GUI. The principles are the same. Always work on copies and keep the originals.
- Resize first. Reducing dimensions has a bigger impact than aggressive compression. Use a tool like ImageMagick to resize to your target long edge. For example, to resize all images to a maximum of 1600 pixels on the long edge while preserving aspect ratio:
- Choose compression settings. For JPEG, quality 80–85 is usually visually indistinguishable from the original for photographs. Quality 70–75 may be acceptable for backgrounds. For PNG, use
pngquantto reduce colors to 256 or fewer, oroptipngfor lossless optimization. For WebP, quality 75–80 is a good starting point. - Convert to the target format. For example, to convert a PNG photograph to JPEG at quality 85:
- Compare file sizes. Check the before and after sizes. A well-optimized JPEG should be 30–70% smaller than the original PNG. If the savings are minimal, you may have already optimized the image or the content is not suitable for JPEG.
- Inspect visually. Open the optimized image at 100% zoom and compare with the original. Look for banding in gradients, blockiness around edges, and loss of fine detail. If you see artifacts, increase quality or use a different format.
mkdir -p optimized for f in OEBPS/Images/*; do convert "$f" -resize '1600x1600>' -strip "optimized/$(basename "$f")" done
The -strip flag removes metadata like EXIF, which can save space and avoid privacy issues.
convert input.png -quality 85 output.jpg
For WebP:
cwebp -q 80 input.jpg -o output.webp
If you prefer a GUI, tools like GIMP, Photoshop, or specialized batch processors can do the same. The key is to resize before compressing and to verify visually.
5. Optimize the cover separately
The cover is often the largest single image. It is also the first thing readers see, so quality matters. Resize the cover to the dimensions recommended by your retailer, but do not exceed 1600–2000 pixels on the long edge unless a specific retailer requires more. Use JPEG quality 85–90 for the cover to preserve detail. Remove embedded color profiles if they are not needed, but be aware that some retailers may expect sRGB. Test how the cover looks on a tablet and a phone. If you use EpubBit, its cover preparation features can help you resize and compress the cover while keeping an eye on the final file size.
6. Handle fonts and other assets
Fonts can add several megabytes if you embed full families with multiple weights and styles. Subset fonts to the characters used in your book. Tools like fonttools can subset fonts:
pyftsubset MyFont.ttf --text-file=book.txt --output-file=MyFont-subset.ttf
Only embed fonts you actually use. If you use a font for headings only, subset it to the heading text. Also, check for duplicate images, unused CSS, and unnecessary metadata files. Some EPUBs include multiple copies of the same image due to conversion errors. Remove duplicates and update references.
7. Rebuild the EPUB and validate
After optimizing images and other assets, replace the originals in your EPUB source folder. Then rebuild the EPUB using your authoring tool or a command-line tool like zip. It is critical to preserve the mimetype file as the first entry and uncompressed. A safe command is:
zip -X0 ../new.epub mimetype zip -rX9 ../new.epub META-INF OEBPS
Alternatively, use EpubBit to repackage and validate. Once rebuilt, run EPUBCheck to ensure no errors were introduced. Check that all image references still resolve and that the reading order is intact. Open the EPUB in at least two reading systems (e.g., Calibre viewer and a mobile app) and flip through every page. Look for missing images, distorted aspect ratios, or blurry text. Pay special attention to images with transparency; if you converted a PNG with transparency to JPEG, the transparent areas may become black or white. In that case, keep PNG or use WebP with alpha.
8. Measure the results and iterate
Compare the new file size to your baseline. Calculate the reduction percentage:
reduction = (original_size - new_size) / original_size * 100
If you started at 60 MB and ended at 15 MB, that is a 75% reduction. Check that you met your budget. If not, revisit the largest remaining files. Sometimes a single image is still oversized because it was not resized. Use the same inspection commands to find it. Iterate until you are satisfied. Keep a log of your settings so you can reproduce the process for future books.
9. Avoid common pitfalls
- Over-compressing: Quality below 70 for photographs can introduce visible artifacts, especially on large screens. Test on a retina display.
- Ignoring aspect ratios: Always resize proportionally. Distorted images look unprofessional.
- Forgetting the cover: The cover may be cached separately by retailers, but a bloated cover still affects your EPUB size.
- Using lossy compression on line art: JPEG artifacts around text and lines are very noticeable. Use PNG or WebP lossless for these.
- Not testing on devices: An image that looks fine on your laptop may look poor on an e-ink screen with 16 grayscale levels. Convert a few images to grayscale to simulate.
10. Conclusion
Reducing EPUB file size is a balance between compression and quality. By resizing images to sensible dimensions, choosing the right format, and verifying visually, you can often cut file size by half or more without any perceptible loss. Start with a baseline, set a budget, optimize the largest files first, and always validate the final EPUB. With practice, this becomes a quick preflight step in your publishing workflow. Tools like EpubBit can streamline the process by combining image optimization, repackaging, and validation in one place, but the principles remain the same: measure, compress intelligently, and verify.