~/TechPurAI
~/tools/image-compressor
Converters & Formatters

Image Compressor & Resizer

Every image loaded on a webpage costs bandwidth and time — for the person loading the page, and increasingly, for how search engines rank that page's overall performance. This tool compresses and resizes an image entirely inside your browser: pick a file, choose an output format and quality, and get back a smaller file with no upload involved anywhere in the process.

Why image size is a bigger deal than it might seem

Images are consistently the single largest category of bytes transferred on most webpages — often accounting for more than half of a typical page's total weight, well ahead of the HTML, CSS, and JavaScript combined. That matters for two very concrete reasons. First, and most directly, page load speed: a visitor on a slower connection, or simply farther from the server, feels the difference between a page that finishes loading in one second and one that takes five, and a meaningful share of that gap is usually unoptimized images rather than anything else on the page. Second, and less obviously, search ranking: Google has explicitly incorporated page-loading performance metrics (Core Web Vitals, including Largest Contentful Paint, which is very frequently the largest image on the page) into its ranking algorithm, meaning an unnecessarily large hero image isn't just a user-experience problem, it's a measurable SEO cost. Compressing and correctly sizing images isn't a nice-to-have polish step — it's one of the highest-leverage, lowest-effort improvements available for both.

Lossy versus lossless compression, and why the distinction matters

Every image compression approach falls into one of two fundamentally different categories, and picking the wrong one for a given image is the most common mistake people make. Lossy compression — used by JPEG and, in its typical mode, WebP — works by identifying and discarding image information that's least noticeable to human perception: subtle color gradations, fine texture detail, information in areas the eye tends to skip over. This can shrink a file dramatically, often by 80-90% compared to an uncompressed original, with a quality loss that's genuinely difficult to spot at reasonable compression levels — but every pass of lossy compression is a one-way trip; information discarded can't be recovered, which is why repeatedly re-saving a JPEG at each editing step gradually and cumulatively degrades it. Lossless compression — PNG's approach — works differently: it finds and eliminates statistical redundancy in the data itself (like a more sophisticated version of noticing "this row of pixels is identical to the row above it, so store that once instead of twice") without ever discarding actual image information. The output is smaller than an uncompressed file, but it decompresses back to pixel-for-pixel exactly what went in. The tradeoff is that lossless compression simply can't shrink a complex photographic image nearly as much as a lossy approach can, because photographs are full of the kind of fine, non-repeating detail lossless compression has no redundancy to exploit.

Picking the right format for the actual content of the image

This is where the lossy/lossless distinction becomes a genuinely practical decision rather than a technical footnote. A photograph — full of gradual color transitions, fine texture, and no perfectly flat regions or hard geometric edges — is exactly the kind of content lossy compression handles well: the losses it introduces tend to land in places the eye doesn't scrutinize closely, and the size savings versus a lossless format are dramatic. A screenshot, a logo, a diagram, or anything with text baked directly into the image pixels is the opposite case: these images are full of hard edges (the boundary of a letter, the border of a UI element) and large flat color regions, both of which lossy compression handles poorly — hard edges tend to pick up visible blur or ringing artifacts, and flat regions that should be one uniform color can show subtle blotchiness. PNG's lossless approach, on the other hand, compresses flat regions and repeated patterns extremely efficiently, which is exactly the kind of content a screenshot or logo is made of — so PNG often produces a smaller and higher-fidelity file for this category of image than a lossy format would, which is the reverse of the usual size relationship for photographs.

WebP as the increasingly obvious modern default

WebP was developed by Google specifically to beat JPEG at its own job — smaller files at equivalent visual quality for photographic content — and by most independent measurements, it succeeds, typically landing 25 to 35 percent smaller than a JPEG of comparable perceived quality. It also supports lossless compression and transparency in a single format, something JPEG has never offered (JPEG has no transparency channel at all, which is why transparent images have historically had to be PNGs regardless of their content). Browser support, which used to be WebP's real weakness, is no longer a practical concern — every major browser in current use supports it. The remaining reasons to still reach for JPEG are compatibility with older software outside the browser (some image editors, some email clients, some older CMS platforms) and simple familiarity; for images destined purely for the web, WebP is very often the better default with no meaningful downside.

Resizing before compressing: the step people skip

It's easy to focus entirely on the quality slider and forget that raw pixel count is usually the bigger lever. A photo taken on a modern phone camera commonly comes out at 3000-4000 pixels wide — far larger than almost any web layout will ever display it at. Compressing that image at a high quality setting while leaving its dimensions untouched still leaves an enormous number of pixels' worth of data in the file, nearly all of which gets thrown away by the browser's own downscaling the moment it's actually displayed at, say, 800 pixels wide on the page. Resizing first, down to roughly the dimensions the image will actually be shown at (accounting for high-density "retina" displays, which is usually 1.5-2x the visual display size), then applying quality compression on top of that already-smaller image, produces a dramatically smaller final file than adjusting quality alone ever could — because the two levers multiply rather than add: half the width and half the height is a quarter of the total pixels before quality compression even enters the picture.

A sensible default workflow

For most images headed to a website: resize to somewhere near the actual display width the image will be used at (checking your page's layout, or erring generously if unsure), pick WebP unless there's a specific compatibility reason not to, and start the quality slider around 75-85%, checking the visual result at that point rather than trusting a single number blindly — some images tolerate aggressive compression invisibly, others show artifacts much sooner, and the only reliable way to know is to look.

Always compare the actual result, not just the file-size number

A smaller file size is only a win if the image still looks acceptable at the size and context it'll actually be viewed in. Zoom in on the compressed result, especially around edges and areas of fine detail, before committing to a quality setting — the "right" quality level genuinely varies image to image, and trusting one fixed number for everything is how visible compression artifacts end up shipped to production.

Frequently asked questions

Is my image actually uploaded anywhere to be compressed?

No. This tool reads the file you select directly into your browser and does the entire resize-and-recompress operation using the HTML Canvas API, which is built into every modern browser specifically for this kind of image manipulation. The file never leaves your device — there's no upload step, no server processing it, and nothing retained afterward. This is meaningfully different from most 'compress an image online' tools, which upload your file to a server, process it there, and send back a download link.

Why would I choose WebP over JPEG, or vice versa?

WebP generally produces a smaller file than JPEG at a visually equivalent quality level for photographic images — often 25-35% smaller for the same perceived quality, based on Google's own published comparisons when the format was introduced. JPEG's advantage is universal compatibility: it's been supported everywhere for decades, including older software and some image-editing tools that still don't fully support WebP. For a modern website, WebP is usually the better default; for an image headed somewhere you don't control or can't verify WebP support, JPEG remains the safer choice.

When should I choose PNG instead of a compressed format?

PNG uses lossless compression, meaning it doesn't discard any image data — every pixel comes back out exactly as it went in. That makes it the right choice for anything with sharp edges, flat color regions, or text baked into the image (screenshots, logos, diagrams, icons), where JPEG's lossy compression tends to introduce visible blur or blocky artifacts right around those hard edges. For photographs, PNG's lossless guarantee comes at a real cost — file sizes are typically far larger than a well-compressed JPEG or WebP of the same image, for a quality difference most people can't actually see.

What does the quality slider actually control?

For JPEG and WebP, it controls how aggressively the compression algorithm is allowed to discard visual information that's less noticeable to human perception — lower quality values discard more, producing a smaller file at the cost of visible artifacts, especially around sharp edges and in areas of fine detail. There's no universal 'correct' value; it depends entirely on the image and how closely it will be viewed. This tool defaults to 80%, a commonly used starting point that tends to look visually close to the original while still meaningfully reducing file size, but it's worth adjusting per image and checking the result rather than trusting one number for everything.

Why does resizing the image also matter for file size, not just the quality setting?

File size scales roughly with the total number of pixels, so cutting an image's dimensions in half in each direction — which quarters the total pixel count — often reduces file size far more dramatically than any amount of quality-slider adjustment alone. If an image is going to be displayed at, say, 800 pixels wide on a page, there's no benefit to keeping it at its original 4000-pixel width; the browser will just scale it down anyway, and every one of those unused pixels was pure wasted bandwidth. Resizing to the dimensions the image will actually be displayed at, before adjusting quality, is usually the single biggest lever for reducing file size without a visible quality loss.