The Complete Compression Guide
Whether you're optimizing images for a website, shrinking photos for email, or compressing documents for sharing, choosing the right format and quality settings makes all the difference. This guide covers everything you need to know about file compression — from format comparisons to quality recommendations for every use case.
Image Format Comparison
Not all image formats are created equal. Each has strengths and tradeoffs that make it suited to different scenarios. Here's a comprehensive comparison:
JPEG / JPG
- Compression type: Lossy
- Transparency: No
- Animation: No
- Color depth: 24-bit (16.7 million colors)
- Browser support: Universal (100%)
- Best for: Photographs, complex images with gradients, social media posts, email attachments
- Avoid for: Text-heavy images, logos, icons, images requiring transparency
- Typical compression: 50-80% size reduction at 70-85% quality
JPEG remains the most widely used image format on the internet. Its lossy compression is specifically designed for photographs and continuous-tone images. The format uses Discrete Cosine Transform (DCT) to separate images into frequency components, then quantizes high-frequency data (fine details) more aggressively than low-frequency data (overall structure). This matches how human vision works — we notice changes in brightness and broad shapes more than fine texture details.
Recommended quality settings: 85-95% for archival/high quality, 70-80% for web and email, 50-65% for thumbnails and previews. Below 50%, block artifacts become visible. Try JPG compression →
PNG
- Compression type: Lossless (with optional lossy quantization)
- Transparency: Yes (full alpha channel)
- Animation: APNG only (limited support)
- Color depth: Up to 48-bit + 16-bit alpha
- Browser support: Universal (100%)
- Best for: Screenshots, logos, icons, graphics with text, images needing transparency
- Avoid for: Photographs (files will be very large), images where file size is critical
- Typical compression: 20-70% with lossy quantization; 5-15% with pure lossless optimization
PNG uses lossless DEFLATE compression, meaning the decompressed image is pixel-perfect identical to the original. This makes PNG ideal for graphics, screenshots, and any image where sharp edges and exact colors matter. PNG also supports full alpha channel transparency, making it the standard for logos, icons, and overlay graphics.
The downside is file size — lossless compression can't compete with lossy formats for photographs. A photo that's 500KB as JPEG might be 5MB as PNG. Lossy PNG quantization (reducing the color palette from millions to 256 carefully chosen colors) bridges this gap for graphics that don't need the full color range. Try PNG compression →
WebP
- Compression type: Both lossy and lossless
- Transparency: Yes (full alpha channel)
- Animation: Yes
- Color depth: 24-bit + 8-bit alpha
- Browser support: All modern browsers (Chrome, Firefox, Safari 14+, Edge)
- Best for: Web images of all types — the best general-purpose web format
- Avoid for: Contexts requiring universal compatibility with old software, print workflows
- Typical compression: 25-35% smaller than JPEG at equivalent quality; 25% smaller than PNG lossless
WebP is Google's modern image format that supports lossy compression, lossless compression, transparency, and animation — all in one format. In lossy mode, it uses VP8-based prediction coding that outperforms JPEG's DCT by 25-35%. In lossless mode, it beats PNG through advanced spatial prediction and cross-color transform.
For web use, WebP is the clear winner in almost every scenario. The only consideration is compatibility: while all modern browsers support WebP, older desktop applications, email clients, and some social media platforms may not. When in doubt, use WebP for web and JPEG for sharing. Try WebP compression →
GIF
- Compression type: Lossless (limited palette)
- Transparency: Binary only (1-bit — fully transparent or fully opaque)
- Animation: Yes (the primary use case today)
- Color depth: 8-bit (256 colors maximum)
- Browser support: Universal (100%)
- Best for: Short animations, reaction images, memes, simple graphics with few colors
- Avoid for: Photographs, anything with many colors, long animations (file sizes become enormous)
- Typical compression: 30-70% reduction through quality adjustment and color reduction
GIF's 256-color limit makes it a poor choice for static images, but its universal animation support keeps it relevant in messaging, social media, and web culture. Each frame of a GIF animation is stored as a separate image, which is why animated GIFs can be enormous — a 3-second clip at 15fps contains 45 individual frames.
Compresso compresses GIFs by reducing quality and optimizing the color palette for each frame. For significantly smaller animated content, consider converting to animated WebP or using short video formats (MP4). Try GIF compression →
HEIC / HEIF
- Compression type: Lossy (HEVC-based)
- Transparency: Yes
- Animation: Yes (image sequences)
- Color depth: Up to 16-bit
- Browser support: Safari only (native); no Chrome/Firefox support
- Best for: Apple device photos (iPhone, iPad), compact storage
- Avoid for: Web publishing, cross-platform sharing, email
- Typical compression: 40-50% smaller than equivalent JPEG; conversion to JPG/WebP required for sharing
HEIC is technically superior to JPEG in every measurable way — better compression, higher color depth, transparency support, and image sequences. But its Apple-centric adoption means it needs to be converted to JPEG or WebP for most use cases. Try HEIC compression → or convert HEIC to JPG →
SVG
- Compression type: Text-based (XML), compressible with gzip/DEFLATE
- Transparency: Yes
- Animation: Yes (CSS/SMIL)
- Scalability: Infinite — resolution independent
- Best for: Logos, icons, illustrations, UI elements, charts
- Avoid for: Photographs, complex raster images
- Typical compression: 20-60% through metadata stripping, path optimization, and minification
SVG is unique among image formats because it's vector-based — it describes shapes mathematically rather than as a grid of pixels. This means SVGs scale to any size without quality loss. SVG compression works by removing unnecessary metadata, comments, editor cruft, and whitespace, then optimizing path data. Try SVG compression →
Quality vs. File Size: Finding the Sweet Spot
The relationship between quality and file size is not linear. Reducing JPEG quality from 100% to 85% might cut file size in half with virtually no visible difference. But reducing from 85% to 70% might only save another 30% with noticeable quality loss. Understanding this curve is key to making good compression decisions.
The Quality Curve
- 100-90% quality: Minimal size reduction but virtually no quality difference from the original. Useful for archival purposes only.
- 90-80% quality: The sweet spot for most uses. Significant file size reduction (40-60%) with quality differences that are imperceptible to the casual viewer. This is where professionals optimize.
- 80-65% quality: Aggressive but still acceptable for web and screen viewing. File sizes are 60-80% smaller. Artifacts may be visible when zoomed in but not at normal viewing distances.
- 65-50% quality: Noticeable quality reduction. Acceptable for thumbnails, previews, and situations where file size is more important than quality.
- Below 50% quality: Significant artifacts visible even at normal viewing distances. Only appropriate when extreme file size reduction is required.
Recommended Settings by Use Case
- Professional photography portfolio: JPEG 85-90% or WebP 85%
- Blog and article images: WebP 75-80% or JPEG 75-80%
- E-commerce product photos: JPEG 80-85% or WebP 80%
- Social media posts: JPEG 75-85% (platform-dependent)
- Email attachments: JPEG 70-80% — aim for 200KB-1MB per image
- Thumbnails and previews: JPEG 60-70% — aim for 20-50KB
- Online form uploads: Use target size mode to hit exact requirements
- Website icons and logos: SVG (vector) or PNG with quantization
- Animated content: GIF at reduced quality, or convert to animated WebP/short MP4
When to Use Lossy vs. Lossless
Choose Lossy When:
- You need the smallest possible file size
- The image will be viewed on screen (not printed at high resolution)
- It's a photograph or complex image with many colors and gradients
- You have a specific file size target to meet
- The image is a final deliverable, not a source file for further editing
- Speed and bandwidth matter more than pixel-perfect accuracy
Choose Lossless When:
- The image contains text, sharp edges, or UI elements (screenshots, diagrams)
- You need to preserve transparency with smooth edges
- It's a source file that will be edited or re-exported later
- Exact color accuracy matters (medical, scientific, or legal images)
- You're archiving original files for long-term preservation
- The image has few colors (logos, icons, flat illustrations) — lossless PNG may actually be smaller than lossy JPEG for these
Document and Archive Compression
PDF Compression
PDF file size is primarily driven by embedded images, fonts, and metadata. Compresso's PDF compressor optimizes all three: re-compressing embedded images at adjustable quality, subsetting fonts to include only used characters, and stripping unnecessary metadata. Text content, links, and form fields are always preserved.
For scanned documents (which are essentially full-page images), compression can be dramatic — 50-80% size reduction. For text-heavy PDFs with few images, savings are more modest (10-30%) since text content is already compact.
PowerPoint (PPTX) and Word (DOCX)
Both PPTX and DOCX are ZIP archives internally. The biggest files contain large embedded images — a 50-slide deck with uncompressed photos can easily be 100MB+. Compresso's PPTX compressor and DOCX compressor re-compress the ZIP structure and optimize embedded images, typically achieving 30-70% size reduction. All text, formatting, animations, and transitions are preserved.
ZIP and 7z Archives
Many ZIP files are created with default compression settings that leave room for improvement. Compresso's ZIP re-compressor extracts all contents and re-compresses with maximum DEFLATE settings. For even better compression ratios, create a 7z archive using LZMA2, which typically achieves 30-70% better compression than ZIP's DEFLATE.
Video and Audio Compression
Video compression uses codec-based encoding (H.264, H.265, VP9) to reduce file sizes while maintaining visual quality. The key parameters are resolution, bitrate, and codec efficiency. Reducing a 4K video to 1080p cuts file size by roughly 75%. Lowering the bitrate trades visual quality for smaller files.
Audio compression leverages psychoacoustic models to remove sounds that the human ear can't perceive. Common audio codecs include MP3, AAC, and Opus. A 128kbps MP3 is about 1MB per minute of audio — sufficient for speech, podcasts, and casual listening. For music production, 256-320kbps preserves audiophile quality while still being much smaller than uncompressed WAV or FLAC.
Performance Impact of Image Compression
Unoptimized images are the single biggest performance bottleneck on most websites. Here's what proper image compression can achieve:
- Page load time: Optimized images can reduce page load time by 30-60%, directly improving user experience and bounce rates
- Largest Contentful Paint (LCP): Google's Core Web Vital measures when the largest visible content element loads. Optimized hero images directly improve LCP scores
- Bandwidth costs: For high-traffic sites, image optimization can reduce CDN bandwidth costs by 50-70%
- Mobile experience: On cellular connections, smaller images mean dramatically faster loading and less data usage for visitors
- SEO rankings: Google has confirmed that page speed (including image loading) is a ranking signal in search results
Common Compression Mistakes
- Re-compressing already-compressed JPEGs: Each round of JPEG compression introduces additional quality loss (generational loss). Compress from the original source file whenever possible.
- Using PNG for photographs: PNG's lossless compression produces enormous files for photos. Use JPEG or WebP instead.
- Over-compressing: Going below 50% quality for visible images creates distracting artifacts. The file size savings between 50% and 30% are minimal compared to the quality loss.
- Ignoring dimensions: A 4000×3000 image displayed at 800×600 wastes 96% of its pixels. Resize first, then compress.
- Not using WebP: If your audience uses modern browsers (they almost certainly do), WebP gives 25-35% smaller files than JPEG at the same quality. There's rarely a reason not to use it for web content.
- Uploading to server-based tools: For sensitive images (personal photos, client work, confidential documents), server-based compression creates unnecessary privacy risk.
Quick Reference: Format Decision Tree
- Is it a photograph or complex image? → Use WebP for web, JPEG for universal compatibility
- Does it need transparency? → WebP or PNG
- Is it animated? → GIF for universal support, animated WebP for smaller files
- Is it a logo, icon, or illustration? → SVG (vector) if possible, otherwise PNG
- Is it a screenshot with text? → PNG for sharpness, or WebP lossless for smaller files
- Is it from an iPhone? → Convert HEIC to JPG or WebP for sharing
- Do you need a specific file size? → Use target size mode
Start Compressing
Ready to put this knowledge into practice? Head to the Compresso homepage to start compressing, or explore our specialized tools:
- Compress JPG — for photographs
- Compress PNG — for graphics and screenshots
- Compress WebP — for modern web images
- Compress GIF — for animated images
- Compress PDF — for documents
- Compress Video — for video files
- Bulk Compress — for processing multiple files at once
Want to understand the technology behind Compresso? Read our technical deep dive. Curious about who uses Compresso? Check out our use cases.