Skip to content
universalImage Compressor

Blog

What Is Image Compression?

Image compression stores a picture with less data so that it loads faster and takes less space. How much you lose depends on the method.

By the Universal Image Compressor Team

A definition in plain words

Image compression is the process of storing a picture in a smaller file. A digital photo is a grid of tiny colored dots called pixels, and each pixel needs numbers to describe its color. A photo from a modern phone can contain more than ten million pixels, so without compression a single picture would take dozens of megabytes. Compression reduces that size by finding a more compact way to write down the same information, or by deciding that some of the information is not worth keeping.

Every common image format uses compression. JPEG, PNG, WebP, GIF and AVIF all compress the pixels they store. When people say they want to compress an image, they usually mean something more specific: they want to take a file that already exists and make it smaller still, for example by saving it with a lower quality setting, in a different format or at a smaller size.

Where the savings come from

Pictures contain a lot of redundancy. A blue sky is made of thousands of pixels with almost the same color, and a screenshot has large areas of flat white. Instead of writing every pixel separately, an encoder can describe a whole area at once, in the same way that you might say two hundred blue pixels instead of writing blue two hundred times. This kind of saving loses nothing and is the basis of lossless compression.

The second source of savings is that the human eye is not equally sensitive to all details. We notice changes in brightness more than small changes in color, and we notice errors in smooth areas more than in busy, textured areas. Lossy encoders use this fact to throw away detail that most people will not miss. This is how a JPEG can be many times smaller than the raw pixels while still looking like the original.

Lossless and lossy compression

There are two families of methods. Lossless compression, used by PNG, can be reversed exactly: when the image is opened again, every pixel has exactly the value it had before. Lossy compression, used by JPEG and by most WebP and AVIF files, discards information permanently. The restored picture is only an approximation of the original, and a lower quality setting means a rougher approximation and a smaller file.

Neither family is better in every case. Lossless files are safe for screenshots, logos, line art and anything you will edit again, but they are larger. Lossy files are far smaller for photographs, but they should be treated as a final delivery format. The next article in this series explains the difference in more detail and shows when each one is the right choice.

What you can change

When you compress an image with a tool, there are three main levers. The first is quality: for JPEG and WebP, a slider decides how much detail is discarded. The second is the format: converting a photo from PNG to JPEG or WebP often cuts the file size by a large factor, because those formats are designed for photographs. The third is the size in pixels: an image that is half as wide and half as high has only a quarter of the pixels, and the file shrinks in a similar way.

These levers combine. A 4000-pixel-wide photo saved as a PNG might be several megabytes. Scaled to 1600 pixels and saved as a JPEG at a moderate quality, the same picture can be a few hundred kilobytes. The tool on this page lets you set all three at once and shows the size of every result.

What compression does not change

Compression changes the file, not the scene. It does not make a blurry photo sharp, and it cannot bring back detail that was removed earlier. If you compress a file twice with lossy settings, the errors add up. For this reason you should keep the original and always compress from it, instead of compressing a compressed copy again.

Compression is also different from changing a format only to rename it. Saving a JPEG with a .png extension does not make it a PNG. A proper conversion decodes the picture and writes it again in the new format, which is what happens inside the compressor when you pick a different output format.

Where metadata fits in

An image file contains more than pixels. It can hold metadata such as the camera model, the date and time, the exposure settings and sometimes the GPS location where the picture was taken. This data, called EXIF, is usually small, often a few tens of kilobytes at most, so removing it rarely changes the file size by much. It still matters for privacy, which is why many compressors, including this one, do not copy it into the new file.

Color profiles are another kind of embedded data. They tell software how to interpret the numbers in the pixels. Most pictures on the web use the sRGB color space, and when a profile is missing, browsers assume sRGB. If your image used a wider profile, removing it can change the colors slightly, so check important images after compressing them.

Why it matters in practice

Smaller images load faster, which makes web pages feel quicker and uses less mobile data. They fit through the attachment limits of email providers, they meet the size limits of upload forms, and they save space on phones and in cloud storage. For a website, images are often among the heaviest files on a page, so they are one of the first places to look when you want to speed it up.

The goal is not the smallest possible file. It is the smallest file that still looks good enough for its purpose. A thumbnail can be compressed much harder than a hero image, and a picture for printing needs more detail than one for a chat. Choose a quality, look at the result, and keep the setting that you can no longer tell apart from the original at the size it will be shown.

Make your images smaller in seconds with the free image compressor.

Open the image compressor