Image Size Calculator - Dimensions & File Size
Calculate image file size from dimensions and bit depth. Estimate storage requirements for JPEG, PNG, and RAW images based on width, height, and color
Formula
Raw Size = Width × Height × Bits Per Pixel ÷ 8 × Compression Ratio
Calculate raw uncompressed size from pixel dimensions and color depth, then apply format-specific compression ratio. Lossy formats (JPEG, WebP) also factor in quality setting - lower quality = more compression.
Worked Examples
Example 1: 4K Photo for Web
Problem:Calculate file size for a 3840×2160 photo saved as JPEG at 80% quality.
Solution:Dimensions: 3840 × 2160 = 8.29 megapixels Raw calculation: 8,294,400 pixels × 24 bits ÷ 8 = 24.88 MB uncompressed JPEG compression at 80% quality: Typical compression ratio: ~10:1 to 15:1 Estimated size: 24.88 ÷ 12 ≈ 2.07 MB Actual result varies based on image content (detailed photos compress less than simple images).
Result:~1.5-2.5 MB for 4K JPEG at 80% quality
Example 2: Social Media Image
Problem:Optimize an Instagram post image (1080×1080) across formats.
Solution:Square 1080×1080 = 1.17 megapixels Raw: 3.5 MB at 24-bit color Format comparison: BMP: 3.5 MB (uncompressed) PNG: ~1.5-2 MB (lossless) JPEG 85%: ~150-300 KB WebP 85%: ~100-200 KB AVIF 80%: ~80-150 KB Instagram recommendation: JPEG, 1080px, <1MB
Result:150-300 KB as JPEG, 100 KB as WebP
Example 3: Print vs Web Resolution
Problem:Same 4000×3000 photo for 8×10 print vs website thumbnail.
Solution:Original: 4000×3000 = 12 megapixels For 8×10 print at 300 DPI: Needed: 2400×3000 pixels Current: 4000×3000 ✓ (plenty of resolution) File size: ~3-5 MB JPEG at high quality For 200×150 thumbnail: Resize to 200×150 = 30,000 pixels JPEG size: ~5-15 KB WebP size: ~3-10 KB Same source image, 1000x size difference!
Result:5 MB for print, 10 KB for thumbnail
Frequently Asked Questions
How is image file size calculated?
Raw (uncompressed) size = Width × Height × Bits per pixel ÷ 8 bytes. A 1920×1080 image at 24-bit color = 1920 × 1080 × 24 ÷ 8 = 6.22 MB raw. Compression dramatically reduces this: JPEG typically achieves 10:1 compression, PNG about 2:1, and WebP 15:1 or better. Actual size depends on image content - detailed photos compress less than simple graphics.
What color depth should I use for my images?
24-bit (8 bits per channel × 3 RGB channels = 16.7 million colors) is standard for photographs and web images. 32-bit adds an 8-bit alpha channel for transparency. 8-bit (256 colors) works for simple graphics, icons, and GIFs. HDR content uses 30-48 bit depth. Higher bit depth means larger files but smoother gradients and color accuracy.
What's the difference between JPEG, PNG, and WebP?
JPEG: Lossy compression, best for photographs, smallest files, no transparency. PNG: Lossless compression, best for graphics/screenshots, supports transparency, larger files. WebP: Modern format combining benefits of both, 25-35% smaller than JPEG at same quality, supports transparency and animation, now widely supported. Choose format based on content type and needs.
How does JPEG quality setting affect file size?
JPEG quality (1-100) controls compression aggressiveness. Quality 90-100: Minimal compression, largest files, nearly lossless. Quality 80-90: Excellent quality, good compression, recommended for most photos. Quality 60-80: Noticeable artifacts on close inspection, significant size reduction. Below 60: Visible degradation, only for thumbnails. Each 10% quality drop typically reduces size 40-50%.
What is the best image format for web optimization?
For photos: WebP or JPEG (80-85% quality). For graphics/logos: SVG (vector) or PNG-8 (limited colors). For transparency: WebP or PNG-24. For animation: WebP or optimized GIF. Modern best practice: Serve WebP with JPEG/PNG fallback. Use srcset for responsive images. Lazy load below-fold images. Target <200KB for hero images, <50KB for thumbnails.
How do I calculate megapixels?
Megapixels = (Width × Height) ÷ 1,000,000. A 4000×3000 image = 12 megapixels. Megapixels determine print size and crop flexibility, not file size directly. Camera megapixels relate to sensor resolution. For most digital uses, 2-4 megapixels is sufficient. 12+ megapixels is for large prints or heavy cropping.
What are common image aspect ratios?
16:9 (HD video, widescreen), 4:3 (traditional photo/monitor), 3:2 (35mm film, most DSLRs), 1:1 (square, Instagram), 21:9 (ultrawide monitors), 9:16 (vertical video, Stories). Aspect ratio = width ÷ height. Matching content to display aspect ratio avoids cropping or letterboxing.
How do I resize images without losing quality?
Downscaling (reducing size) is generally safe - information is discarded but quality is maintained. Upscaling (enlarging) always reduces quality - you can't create detail that wasn't captured. For upscaling: AI tools (Topaz, ESRGAN) work better than basic interpolation. For best results, capture at intended size or larger and only reduce.
What is AVIF and should I use it?
AVIF is a next-generation image format based on AV1 video codec. It offers 20-50% smaller files than WebP with equal or better quality. Excellent for HDR and wide color gamut. Browser support is growing (Chrome, Firefox, Safari 16+). Use AVIF for cutting-edge optimization, but provide WebP/JPEG fallbacks for older browsers. Encoding is slower than other formats.