Start a project

Tool 15 of 29 · 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

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 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