Start a project

Tool 83 of 244 · Performance

Image Compressor

Shrink images for the web without uploading them anywhere: convert to WebP or AVIF, make every width you need for srcset, and copy the code.

Image Compressor at a glanceIllustration: 1, Your photos; 2, processed in your browser; 3, Smaller files.Image Compressor1Your photos3Smaller files2In yourbrowser
1 Your photos 2 processed on your device 3 Smaller files

Image Compressor

Your images

0 keeps the original width
Also make these widths for srcset
Blank keeps each image's own name

    Responsive image code

    <picture> with srcset

    Paths assume the files sit in /img/. Width and height stop the page jumping while images load.

    01

    What it does

    Convert to WebP, AVIF or JPEG, resize, make every srcset width at once, and get the <picture> code. Nothing is uploaded.

    • Convert to WebP, AVIF, JPEG or PNG (as your browser allows)
    • Quality and maximum width controls
    • Several srcset widths in one go
    • Before and after sizes

    02

    Private by design

    Everything happens in your browser. Nothing you type, paste or upload is sent anywhere, and it keeps working offline once the page has loaded.

    03

    What you get

    Image files, zip and HTML, with a Copy and a Download button on every result.

    • WebP
    • AVIF
    • srcset
    • Core Web Vitals

    Why it matters

    Images are usually the heaviest part of a web page, and the main reason pages are slow on phones. A photo straight from a camera can be 5 MB; the same photo as a 1200px WebP is often under 150 KB and looks the same on screen.

    Serving the right size to each screen with srcset helps your Largest Contentful Paint, one of Google's Core Web Vitals. Most online compressors upload your files to their servers. This one does the work on your device with the browser's own image encoders, so client photos and unreleased designs stay private.

    How it works

    1. InputJPEG, PNG or WebP images
    2. In your browserResized and re-encoded by your browser
    3. OutputAVIF, WebP, JPEG or PNG files with the savings shown

    Where it fits in a designer's workflow

    1. Plan
    2. Design
    3. Build
    4. Test
    5. Launch
    Before images go on the site, and when a speed test flags them.

    By the numbers

    File size of the sample photo in each formatPNG: 374.6 KB; JPEG: 37.1 KB (90% smaller); WebP: 20.1 KB (95% smaller); AVIF: 32.7 KB (91% smaller)PNG374.6 KBJPEG37.1 KB (90% smaller)WebP20.1 KB (95% smaller)AVIF32.7 KB (91% smaller)
    Computed by re-encoding the tool's 800 × 533px sample photo with Pillow at quality 80 (PNG is lossless). Your browser's encoders, which the tool uses, give slightly different sizes, and the best format depends on the image.
    Show the numbers as a table
    FormatBytesvs PNG
    PNG383,638-
    JPEG37,95090% smaller
    WebP20,58495% smaller
    AVIF33,46591% smaller

    How to use it

    1. Choose or drop one or more images.
    2. Pick the format and quality. 75 to 85% is a good balance for photos.
    3. Tick the widths you want for srcset, then press Convert again if you change settings.
    4. Download files one by one or as a zip, and copy the <picture> code.

    FAQ

    Which format should I use?

    WebP is shown by every current browser and is usually 25 to 35% smaller than JPEG at the same quality. AVIF is smaller still, but few browsers can create it from a web page yet.

    Why isn't AVIF (or WebP) in the list?

    This tool uses your browser's own image encoders, and only lists the formats your browser can create. If WebP is missing (some versions of Safari), open the page in Chrome, Edge or Firefox, or use JPEG.

    Are my images uploaded?

    No. They're decoded and converted on this device, so it works offline and nothing is stored or sent.

    Does it keep the photo's location data?

    No. Converting through a canvas drops EXIF data such as GPS location, which is usually what you want for the web.

    Work with me

    Want a site that gets these right?

    I build fast, accessible websites and web apps that pass these checks from day one. Tell me about your project and I'll reply personally with honest next steps.

    All developer tools · Back to leej.uk