ToolsVortex
Explore tools

Category: Images & Photos

Image and photo guides on resizing, compressing and converting pictures, with free, private image tools that run in your browser.

  • How to Compress an Image: Quality, Format and Size Tested

    How to Compress an Image: Quality, Format and Size Tested

    Images & PhotosUpdated November 6, 20269 min readBy ToolsVortex Editorial Team

    To compress an image, first resize it to the pixel size you need, then save photos as JPEG or WebP at a quality of about 75 to 85, and save logos and screenshots as PNG. In our test, a 512 x 512 photo fell from 786 KB raw to 46 KB as a JPEG at quality 80.

    94%smaller: raw photo vs JPEG at quality 80 in our test
    75 to 85quality range that keeps photos looking sharp
    31%smaller again with WebP at the same quality setting
    How to Compress an Image: Quality, Format and Size Tested

    Knowing how to compress an image saves you from failed uploads, slow web pages and full phone storage. The good news is that most photos can shrink by 90% or more before anyone can see a difference.

    We ran our own test on a real photo to show how quality settings and formats change file size. Below you will find the results, the formula for raw image size, and a step by step fix for a phone photo that is too big for an upload form. To shrink a file right now, use our free image compressor.

    How Do You Compress an Image?

    You compress an image by reducing its pixel dimensions, choosing an efficient format, and lowering the quality setting until the file is small enough.

    1. Resize first. A 4032 x 3024 phone photo has more than 12 million pixels. A website or email rarely needs more than 1,200 to 2,000 pixels across. Cutting the width in half cuts the pixel count to a quarter. Our image resizer does this step.
    2. Pick the right format. Use JPEG or WebP for photos. Use PNG, or lossless WebP, for logos, text and screenshots.
    3. Set the quality. For JPEG and lossy WebP, start at 80. Go down to 70 if you need a smaller file, or up to 90 if you see blocky edges.
    4. Crop the extras. Cutting away empty sky or background removes pixels you never needed.
    5. Check the result at 100% zoom. Look at faces, text and smooth gradients, where flaws show first.

    Order matters. Resizing gives the biggest savings with the least visible harm. Lowering quality on a huge image just makes a huge image that looks worse.

    Image CompressorShrink JPG, PNG and WebP photos to a smaller file size for email, upload forms and websites.
    Open tool →

    What Is the Difference Between Lossy and Lossless Compression?

    Lossy compression throws away detail your eye is unlikely to notice, while lossless compression keeps every pixel exactly and only packs the data more tightly.

    The W3C PNG specification defines lossless as compression that rebuilds the original data exactly, bit for bit. PNG uses deflate, the same family of methods behind ZIP files. JPEG is lossy: each save discards some fine detail to make the file far smaller. WebP can do both. Google describes it as a format with lossy and lossless modes.

    FormatCompressionTransparencyBest for
    JPEGLossyNoPhotos
    PNGLosslessYesLogos, screenshots, text, line art
    WebP (lossy)LossyYesPhotos on the web
    WebP (lossless)LosslessYesGraphics on the web

    Google reports lossless WebP files are 26% smaller than PNGs, and lossy WebP files are 25 to 34% smaller than JPEGs at the same SSIM quality score.

    Need to change formats? The WebP converter and the PNG to JPG converter handle the switch.

    How Much Does the Quality Setting Change File Size?

    Dropping JPEG quality from 95 to 80 cut our test photo by more than half, and going lower gave smaller and smaller gains.

    We used the 512 x 512 color astronaut portrait from NASA that ships with the scikit-image library as a test photo. Raw, it holds 512 x 512 x 3 = 786,432 bytes. We saved it with the Pillow library in Python at different quality settings.

    QualityJPEG sizeSmaller than rawWebP sizeWebP vs JPEG
    9599.3 KB87.4%80.1 KB19.4% smaller
    9068.1 KB91.3%52.9 KB22.2% smaller
    8554.0 KB93.1%39.2 KB27.3% smaller
    8046.0 KB94.2%31.7 KB31.0% smaller
    7540.2 KB94.9%25.8 KB35.9% smaller
    6031.3 KB96.0%21.6 KB30.9% smaller
    5027.7 KB96.5%19.3 KB30.5% smaller

    1 KB = 1,000 bytes. Pillow 12.3, default settings. Quality numbers are not identical between JPEG and WebP encoders, so treat the last column as a rough guide. The same photo as an optimized PNG was 422.4 KB, and as lossless WebP it was 341.0 KB.

    Look at the curve. Going from 95 to 80 saved 53.3 KB. Going from 80 to 50 saved only 18.2 KB more, while visible blocking starts to creep in. That is why 75 to 85 is the sweet spot for most photos.

    Should You Use JPEG or PNG for Logos and Screenshots?

    Use PNG or lossless WebP for logos and screenshots, because JPEG blurs sharp edges and often makes flat graphics bigger, not smaller.

    We drew a simple 512 x 512 graphic with a white background, two solid shapes and a line of text. Here is how the formats compared.

    FormatFile sizeEdges
    Lossless WebP0.9 KBPerfect
    PNG (optimized)3.1 KBPerfect
    JPEG quality 8011.0 KBSoft, with faint halos around text

    Flat areas of one color compress extremely well with lossless methods. JPEG is built for smooth photo detail, so it wastes bytes on hard edges.

    The rule of thumb: if the image came from a camera, use JPEG or lossy WebP. If it came from a screen, a design app or has text, use PNG or lossless WebP. Screenshots that contain a photo are the gray area. Try both and keep the smaller one that still looks clean.

    How Big Is an Image Before Compression?

    An uncompressed color image takes 3 bytes per pixel, so its raw size is width x height x 3.

    Raw size (bytes) = width x height x 3
    Bits per pixel = file size in bytes x 8 / (width x height)
    Max bits per pixel for a target = target bytes x 8 / (width x height)
    ImagePixelsMegapixelsRaw sizeBits per pixel for a 100 KB file
    Blog image1200 x 8000.962.88 MB0.83
    Full HD1920 x 10802.076.22 MB0.39
    4K UHD3840 x 21608.2924.88 MB0.10
    12 MP phone photo4032 x 302412.1936.58 MB0.07

    1 MB = 1,000,000 bytes. Raw size assumes 8 bits for each of red, green and blue, with no transparency.

    Our JPEG at quality 80 used about 1.4 bits per pixel. A 12 MP photo cannot hit 100 KB at 0.07 bits per pixel without looking terrible. It has to be resized first. For fixed targets, tools like resize image to 100 KB do both steps for you.

    How Do You Get a Phone Photo Under 200 KB?

    Resize a 12 MP phone photo to about 1200 x 900 pixels, then save it as a JPEG at quality 75 to 80.

    Worked example

    Priya needs to upload a 4032 x 3024 phone photo to a job portal that rejects files over 200 KB.

    1. Pixels now: 4032 x 3024 = 12,192,768.
    2. Bits per pixel allowed at full size: 200,000 x 8 / 12,192,768 = about 0.13. That is far below the 1.4 bits per pixel a quality 80 JPEG used in our test.
    3. Resize to 1200 x 900, which keeps the 4:3 shape: 1,080,000 pixels, about 11.3 times fewer.
    4. Estimate the size at quality 80: 1,080,000 x 1.4 / 8 = about 189,000 bytes, or 189 KB.
    5. For a safety margin, quality 75 at 1.23 bits per pixel gives about 166 KB.

    The estimate uses our test photo’s bits per pixel. A busy photo with leaves or gravel needs more bits, and a plain wall needs fewer, so always check the final size and adjust the quality by 5 at a time.

    If the portal also asks for a set shape, such as a square profile photo, use crop image first, then compress. Cropping removes pixels too, which helps you hit the limit.

    What Mistakes Make Compressed Images Look Worse?

    The most common mistakes are compressing a huge image instead of resizing it, using JPEG for text, and pushing quality too high when converting.

    • Saving a JPEG again and again. Each lossy save throws away a little more detail. In our test, saving the photo 10 times in a row at quality 75 lowered its PSNR, a standard measure of how close pixels are to the original, from 34.0 to 33.7 dB. That is small, but it adds up when you edit and save many times. Keep an original and export once.
    • Converting to a higher quality. Google’s WebP FAQ warns that turning a quality 80 JPEG into a quality 95 WebP will likely make the file bigger. Lost detail does not come back, so match or lower the quality.
    • Upscaling. Making a small image larger adds pixels and bytes but no detail.
    • Ignoring size limits. WebP images can be at most 16383 x 16383 pixels, so giant panoramas need resizing first.
    • Judging on a phone screen. Small screens hide flaws. Check at full size before you publish.

    Follow the order: crop, resize, choose the format, then set quality. The image compressor handles the last two steps for you.

    Quick Recap

    • Resize first, then choose a format, then set quality.
    • Use JPEG or lossy WebP for photos and PNG or lossless WebP for graphics.
    • Quality 75 to 85 keeps photos sharp at a fraction of the size.
    • Raw size is width x height x 3 bytes; a 12 MP photo is about 36.6 MB raw.
    • Keep an original and export once to avoid repeated lossy saves.
    How to Compress an Image: use the free image compressor on ToolsVortex

    Frequently Asked Questions

    What is the best quality setting for compressing a JPEG?

    Start at 80. In our test, quality 80 made a photo 94% smaller than its raw size with no obvious flaws. Drop to 70 or 75 if the file is still too big, and raise it if you see blocky edges or banding.

    Does compressing an image reduce its quality?

    Lossy compression, used by JPEG and lossy WebP, removes some detail, though at quality 75 to 85 most people cannot see it. Lossless compression, used by PNG and lossless WebP, keeps every pixel exactly the same.

    Is WebP smaller than JPEG?

    Usually. Google reports lossy WebP files are 25 to 34% smaller than JPEGs at the same SSIM quality. In our own test, WebP was 19 to 36% smaller than JPEG at matching quality numbers, though the two scales are not identical.

    Why is my PNG bigger than my JPEG?

    PNG is lossless, so it keeps every detail of a photo. Our 512 x 512 test photo was 422.4 KB as PNG and 46.0 KB as a quality 80 JPEG. Use PNG for graphics and text, not photos.

    How do I compress an image to a specific size like 100 KB?

    Work out the bits per pixel your target allows: target bytes x 8 / pixels. If it is under about 1, resize the image first. Then lower the quality step by step until the file fits.

    Can I compress an image without losing quality?

    Yes, with lossless methods. Optimizing a PNG or saving as lossless WebP keeps the image identical. Google reports lossless WebP files are 26% smaller than PNGs. The savings are smaller than lossy compression gives.

    Does resizing an image reduce its file size?

    Yes, and usually more than any other step. Halving both the width and height leaves a quarter of the pixels. In our test, the photo at 256 x 256 was 16.3 KB at quality 80, about 35% of the full size file.

    Sources

    1. Google for Developers: An image format for the Web (WebP), WebP size savings vs PNG and JPEG and transparency costs
    2. Google for Developers: WebP Frequently Asked Questions, maximum WebP size and converting JPEG to higher quality WebP
    3. W3C: Portable Network Graphics (PNG) Specification, Third Edition, PNG lossless compression and deflate
    TV
    Written by the ToolsVortex Editorial Team

    We check every number in our guides against the original source and test each example in our calculators before publishing. This guide is general information, not professional advice. Spotted an error? Tell us and we will fix it.

    Keep reading