The darkroom · Compress

Compress a JPEG in the browser, and see the size first

Here the slider is live. Move it, and the picked photo is encoded at that quality on your device; the line under it gives the result in bytes and as a share of the original, and the picture under that is the encoded result itself, not a simulation.

Open the tray How it works

The size in bytes before any download · quality 1–100 · JPEG, WebP, AVIF where supported · 0 bytes uploaded

The tray

Drop them in. Read them. Clean them.

Each photograph gets a card: what the file really is (by its bytes, not its name), its size, and a flag for every thing in it that points at a place or a person. What it says opens the lot, tag by tag. Strip takes the metadata out and leaves the picture exactly as it was; Develop writes a new file in the format and size the developer is set to. Beside the tray, the bench holds the other tools — the Exif viewer, Convert, Resize, Compress and Crop. Several photos at once is the point: the buttons under the drop zone do the whole tray.

The tray

Empty — nothing read yet

Drop photographs hereYour photographs, read here

JPEG, PNG and WebP; HEIC and AVIF where this browser can decode them. Or paste an image. Nothing is uploaded.

Change it

    The tray is empty. Choose some photographs, drop them anywhere on this page, paste one, or try the sample — a picture drawn by this site whose metadata was written by hand the way a phone writes it.

    A batch lives in this tab’s memory until you clear it or close the tab. Nothing is written to the browser’s storage except the developer’s settings.

    Compress

    The size first, then the file

    Reading the numbers

    “JPEG at quality 75: 412,300 bytes — 31.2% of the original” means the new file is a little under a third of the old one. Quality is the number given to the encoder, from 1 to 100. Lower means a smaller file and a rougher picture. There is no right number — look at the picture under the slider. When the number is what you want, press Compress this photo: the file you download is the one whose size you were shown.

    If the result is not smaller than the original, the page says so. That happens when the original was already compressed harder than the setting you chose.

    The number is measured, not estimated: it is the length of the file the encoder handed back, counted in bytes, for the photo you picked at the quality on the slider. Move the slider again and the old encode is thrown away before the new one is shown, so the line never mixes one setting’s size with another’s picture.

    JPEG or WebP

    The encoder buttons offer JPEG and, where your browser can write them, WebP and AVIF. PNG is not among them: it is lossless and has no quality setting. To make a PNG smaller, convert it to WebP, or resize it.

    What compression costs

    This is a re-encode: the picture is decoded, drawn on a canvas and compressed again. A lossy encoder discards detail to save bytes, so keep your original. The new file carries no metadata, its colours are converted to sRGB, and the original’s ICC profile is not carried over. Transparent areas become white in a JPEG.

    If what you want is a smaller file without any change to the picture, look at what the file carries first: a photo can hold an embedded thumbnail, a maker note, a colour profile and sometimes a second picture after the first. The lossless strip removes those and leaves the picture’s bytes alone; the card’s layout table shows how many bytes are picture and how many are everything else.

    A batch, and the limits

    The slider previews the picked photo — press another picture in the tray to preview that one. Compress all then encodes every photo in the tray at the same quality and offers them one by one or as a ZIP. The encoders are your browser’s, and what an encoder does with a quality number is its own business: the same number can give different sizes in different browsers. Pictures past the browser’s canvas limit, or over 100 megapixels, are refused with a message.

    How to check that nothing is uploaded. The page’s own scripts make one request of their own — the sample card, from this site, when you press for it — and none that carries a file. The folder is served with a Content-Security-Policy header that lets the page connect only to this site and to Google’s analytics hosts, so even a mistake here could not send a photo anywhere else: the browser would refuse it. Open the developer tools, choose the Network tab, clear it, then add a photo and run the tool, and watch. Google’s analytics counts the visit and that a tool was used; nothing in this page hands it a file name, a pixel or a tag.

    Method

    What is read, what is written, and what is sent: nothing.

    Fetched, computed, sent

    There is no upstream and no server doing the work. The page loads its own files from this site, and the sample card from this site when you ask for it; your photographs are read from disk into this tab’s memory, worked on there by the page’s own readers and the browser’s own decoders and encoders, and handed back as downloads made in that memory.

    The folder is served with a Content-Security-Policy header whose connect-src allows this site and Google’s analytics and ad-measurement hosts — *.google-analytics.com, analytics.google.com and *.analytics.google.com, *.googletagmanager.com, www.google.com and its country domains, and stats.g.doubleclick.net — and nothing else. The full method — every format read by hand, every limit, every source — is on the darkroom’s front page.

    Sources for this tool