Image Compressor
Compress JPG and PNG images in your browser with a quality slider from 10 to 100. The image stays on your device and is not uploaded to a server. You see the original size, the compressed size, and the percentage saved before you download, and the file keeps its original format.
Key features
- Quality slider from 10 to 100 that recompresses the image on each change
- Compression runs in a Web Worker in your browser
- Shows original size, compressed size, and percentage saved
- Keeps the format: JPEG stays JPEG, PNG stays PNG with fewer colors
Guide
Image compression reduces the file size of a photograph or graphic without removing enough visual detail for the average viewer to notice. This tool runs in your browser. It passes your file to the browser-image-compression library, which redraws the image on a canvas inside a Web Worker and encodes it again at the quality level you choose. For PNG files the library also reduces the number of colors. No image data leaves your device. The compressed file is handed back to you as a downloadable blob URL.
Understanding why file size matters is the first step. A single uncompressed photograph from a modern phone camera can weigh 5 to 12 MB. A product page with eight such images forces a visitor on a typical 15 Mbps connection to wait several seconds before the layout stabilizes. Google uses Largest Contentful Paint (LCP) as a Core Web Vital, and oversized hero images are the most common reason a page fails the 2.5 second threshold. Compressing those images to 100-300 KB each can cut total page weight by 90 percent and move your LCP into the green zone without any server-side infrastructure change.
The relationship between file size and user behavior is well documented. Research from Google and Akamai shows that a one-second delay in page load reduces conversions by 7 percent. On mobile networks, where effective bandwidth can drop to 3-5 Mbps during congestion, image weight dominates total load time. A page with 4 MB of images takes over 6 seconds to fully render on a congested mobile connection. That same page with images compressed to 400 KB total renders in under 2 seconds. The difference translates directly into bounce rate, engagement time, and revenue for commercial sites.
The tool accepts two input formats: JPEG and PNG. Other files, including WebP, are rejected with an error message. The output keeps the input format, so a JPEG stays a JPEG and a PNG stays a PNG. Each format uses a different compression model, and knowing the differences helps you pick the right quality setting. JPEG is a lossy format built on the Discrete Cosine Transform. It splits the image into 8x8 pixel blocks, converts them from RGB to YCbCr color space, applies DCT to each block, then quantizes the frequency coefficients. Lower quality values increase quantization, which discards more high-frequency detail. At quality 80 out of 100 most photographs lose no perceptible detail. At quality 60 you may start to see banding in smooth gradients and ringing around sharp edges. Below 40 the blocking artifacts become obvious on most screens.
The YCbCr color space deserves a brief explanation. Y is the luminance (brightness) channel, and Cb and Cr are the blue-difference and red-difference chrominance channels. Human vision is far more sensitive to changes in brightness than changes in color. JPEG exploits this by subsampling the chrominance channels, typically at 4:2:0, which means the color information is stored at half the resolution of the brightness information in both dimensions. This single step reduces color data by 75 percent with minimal perceptible impact. When you set a higher quality level, the quantization tables preserve more frequency detail, but the chroma subsampling ratio usually stays the same.
PNG uses lossless DEFLATE compression. The raw pixel data is first filtered row by row (sub, up, average, or Paeth prediction), then the filtered stream is compressed with zlib. Because no data is discarded, PNG files of photographs tend to be very large. This tool makes PNG files smaller by reducing the number of colors. The color limit is 4,096 multiplied by the quality value, so quality 100 allows up to 4,096 colors, quality 80 allows about 3,277 colors, and quality 10 allows about 410 colors. Fewer colors give a smaller file. For graphics with flat color regions, such as logos or screenshots, the reduction is often hard to see. Photographs with smooth gradients can show banding at low settings.
The color reduction comes from the UPNG encoder that ships with the compression library. It groups similar colors with a k-d tree and maps each pixel to the nearest color in the reduced set. The tool does not apply dithering, so smooth gradients in a PNG photo can show visible steps at low quality values. If you see banding in a PNG, raise the quality or save the photo as JPEG instead.
WebP was developed by Google and supports both lossy and lossless modes. In lossy mode it uses VP8 video codec prediction, which is more efficient than JPEG DCT at the same perceptual quality. A JPEG at quality 80 typically matches a WebP at quality 75 in visual fidelity, but the WebP file is 25-35 percent smaller. The efficiency gain comes from VP8 using variable block sizes (4x4 to 16x16) instead of JPEG's fixed 8x8 blocks, and from using intra-frame prediction where each block is predicted from its neighbors before encoding the residual. In lossless mode WebP outperforms PNG by 10-25 percent through predictive coding of neighboring pixels and arithmetic entropy coding. Browser support for WebP is now above 97 percent globally, so it is safe to serve WebP to nearly all visitors. This tool does not accept or produce WebP files.
To use the tool, drag one image onto the drop zone or click Select File to open the file picker. The tool handles one file at a time. It sends the file to browser-image-compression with your quality value, a limit of 4,096 pixels on the longest side, and a 10 MB size target. Images longer than 4,096 pixels are scaled down to that limit. When the result is ready, you see the original size, the new size, and the percentage saved under the file name. Each time you move the quality slider, the tool compresses the original file again at the new value.
The tool processes one image at a time. To compress several photos, repeat the steps for each file. Click the X button to clear the current image before you load the next one. Clearing the image also resets the quality slider to 80.
Step-by-step workflow for a typical use case. Start with a product photo exported from your editor at full quality JPEG. Open the compressor tool and drop the file onto the drop zone. The slider starts at 80 unless you changed it earlier. Compare the original and compressed sizes shown under the file name. If you need a smaller file, lower the slider to 70. If the downloaded image shows artifacts, raise it to 85 or 90. Click Download Compressed Image to save the file. The saved file name starts with compressed_ followed by the original name. Repeat for the next photo and upload the results to your CMS or CDN.
Common mistakes. The most frequent error is compressing an image that was already compressed. If you take a JPEG at quality 75, open it in an editor, export it at quality 80, and then run it through this tool at quality 80 again, you have three generations of lossy encoding. Each generation introduces its own quantization error. The artifacts compound, particularly around edges and in smooth gradient areas. Always start from the highest quality source you have. If you only have a pre-compressed JPEG, set the quality slider higher than you normally would (85-90) to avoid adding a thick layer of new artifacts on top of the existing ones.
Another mistake is using JPEG for images with text or sharp line art. JPEG block-based encoding smears the edges of letterforms and creates visible halos around high-contrast boundaries. The effect is called Gibbs phenomenon or ringing, and it occurs because the DCT approximation of a sharp edge requires many high-frequency coefficients that get quantized away. For screenshots, diagrams, or logos, PNG or WebP lossless will produce a smaller file with perfect edges. The tool does not currently auto-detect content type, so you need to make this judgment yourself.
A third mistake is ignoring image dimensions. Compression reduces encoding overhead. Apart from scaling images longer than 4,096 pixels down to that limit, this tool keeps the pixel count. A 4000x3000 photograph compressed to quality 60 may still be 800 KB. If that image displays at 400x300 on the page, you are sending 100 times more pixels than needed. Resize the image to its display dimensions first, then compress. The combination of resizing and compression often turns a 5 MB source into a 40 KB deliverable.
A fourth common error is applying the same quality setting to every image regardless of content. A flat-color illustration compresses far more efficiently than a detailed texture photograph. The illustration might look perfect at quality 60, while the texture photograph needs quality 85 to avoid visible artifacts. Evaluate each image individually, or at least sort your images into categories (photographs, graphics, screenshots) and use different quality settings for each.
Advanced tips. When targeting WebP for a website, generate both a WebP version and a JPEG fallback. Use the HTML picture element with a source for WebP and an img fallback for JPEG. This way the 3 percent of browsers that lack WebP support still see an image. This tool outputs JPEG and PNG only, so create the WebP version with a separate converter.
For e-commerce, compress product images at quality 82-85 JPEG. This range consistently scores above 0.95 on the SSIM perceptual quality index while keeping file sizes under 150 KB for a 1200x1200 product shot. Below quality 80 you risk visible banding on white or pastel product backgrounds, which can make a product look cheaper than it is. Test compression on your actual product backgrounds. Pure white backgrounds are particularly unforgiving because any banding or color shift is immediately visible.
For social media, platforms re-compress every image you upload. Uploading a pre-compressed JPEG at quality 70 means the platform applies its own quality 85 pass on top of your already lossy file, producing a double-compressed result. Upload at quality 95 or higher to give the platform a clean source. The recompression will bring the size down, and the result will look better than if you had pre-compressed aggressively. This applies to Facebook, Instagram, Twitter/X, LinkedIn, and virtually every social platform. Each platform uses its own compression pipeline with proprietary settings.
Performance characteristics of the tool itself. Compression time depends mostly on image dimensions. The library encodes the image in a Web Worker, so the page stays responsive while the spinner shows. The quality slider is disabled until the current pass finishes.
Memory usage is proportional to the uncompressed bitmap size. A 4000x3000 image at 4 bytes per pixel (RGBA) needs 48 MB as a canvas bitmap. The tool holds one image at a time, so memory use stays near that figure. Very large files can still fail on phones with little memory. If compression fails, the spinner stops and no download button appears.
Format comparison summary. JPEG: best for photographs, lossy only, no transparency, near-universal support, the default choice for photographic web content. PNG: best for graphics with sharp edges and flat colors, supports transparency, lossless (or lossy via palette reduction), larger than JPEG for photos, ideal for screenshots and UI elements. WebP: best general-purpose format, supports both lossy and lossless modes, supports transparency, 25-35 percent smaller than JPEG at equivalent quality, 97 percent browser support, the recommended format for new web projects. AVIF is a newer format with even better compression ratios (30-50 percent smaller than JPEG) but browser support is around 92 percent, and encoding is significantly slower, often 10-20 times slower than JPEG or WebP encoding. This tool does not yet support AVIF output.
The privacy advantage of browser-based compression deserves emphasis. Cloud-based compression services upload your images to a remote server. For personal photos this means a third party stores your images, even temporarily. For business documents, product photos under NDA, or medical images, uploading to an external server may violate privacy policies or regulations like GDPR, HIPAA, or SOC 2 requirements. Because this tool processes the image in your browser, the image file is not sent in any network request. You can check this by opening the browser Network tab during compression. This makes the tool suitable for handling sensitive images that cannot leave the local device.
Integrating compression into a development workflow. Front-end build tools like Webpack and Vite have image optimization plugins (imagemin, vite-imagemin) that compress assets at build time. These are appropriate for static assets like logos, icons, and background patterns that ship with the application. For user-uploaded content, though, you need runtime compression. This tool uses the same Canvas API approach you would use in your own application code. You can replicate the compression logic in a React component by creating an OffscreenCanvas, drawing the user file to it, calling toBlob with the desired quality, and returning the result. Web Workers can move the encoding off the main thread if you need the UI to stay responsive during large batch operations.
Testing compression quality objectively. The Structural Similarity Index (SSIM) compares two images and produces a score from 0 to 1, where 1 means identical. An SSIM above 0.95 is generally considered visually lossless for web content. At JPEG quality 80 most photographs score between 0.96 and 0.99 on SSIM against the original. Online SSIM comparison tools and the Python scikit-image library both provide this metric. Another useful metric is the Butteraugli score developed by Google, which measures perceptual difference and is used internally by WebP and AVIF encoders. If you are setting compression standards for a team, define a minimum SSIM threshold rather than a fixed quality number, because the ideal quality setting varies by image content.
Responsive image strategy. Compression is one part of a broader image optimization pipeline. Serve different image sizes for different screen widths using the srcset attribute. Generate 3-4 size variants (e.g., 400w, 800w, 1200w, 2000w) and compress each at quality 80 JPEG or quality 75 WebP. The browser selects the smallest variant that fills the display area. Combined with compression, this approach routinely cuts image payload by 95 percent compared to serving a single full-resolution uncompressed file. The sizes attribute tells the browser how wide the image will display, and the browser uses this information plus the device pixel ratio to choose the appropriate srcset candidate.
Lazy loading. Add loading="lazy" to images below the fold. This tells the browser not to fetch those images until the user scrolls near them. Lazy loading does not reduce file size, but it reduces initial page load time by deferring unnecessary network requests. Combine it with compression for maximum effect. The hero image should not be lazy loaded because it is usually the LCP element and needs to load as fast as possible. Compress the hero image aggressively (quality 75-80) and consider using a smaller intrinsic size for mobile viewports. Use fetchpriority="high" on the hero image to tell the browser to prioritize it over other resources.
CDN and caching. After compressing your images, serve them through a Content Delivery Network (CDN) with long cache headers. Set Cache-Control to max-age=31536000 (one year) for images with content-based filenames (e.g., product-photo-a1b2c3.webp). This ensures repeat visitors load images from local cache instead of re-downloading. Some CDNs (Cloudflare, Cloudfront, Fastly) offer automatic image compression and format conversion at the edge. If you already use such a CDN, you may not need to pre-compress, but testing both approaches and comparing file sizes and visual quality is worthwhile. CDN auto-compression sometimes uses conservative settings that produce larger files than manual compression at a chosen quality. Running your own compression gives you full control over the quality-size trade-off.
Accessibility. Compression does not affect alt text, ARIA labels, or other accessibility metadata. However, over-compression can reduce the effectiveness of images for users who zoom in on fine details. Product photos with small text (size labels, care instructions) should be compressed more gently (quality 85-90) to preserve readability at high zoom levels. Decorative images that convey no information can be compressed more aggressively. Images used as the sole carrier of information (infographics, charts, maps with labels) should be compressed conservatively and tested at 200 percent zoom to verify text remains legible.
Measuring the impact. After deploying compressed images, re-run Lighthouse or PageSpeed Insights. Look at the "Serve images in next-gen formats" and "Efficiently encode images" audit items. Both should pass or show reduced savings. Monitor LCP in the Chrome User Experience Report (CrUX) for your domain to verify that the compression has improved real user loading times, not just lab scores. Track the p75 LCP value over time to see the trend. A successful compression effort typically moves LCP by 500-2000 ms on image-heavy pages.
Image compression and SEO. Google has confirmed that page speed is a ranking factor, and Core Web Vitals (LCP, CLS, INP) are part of the page experience signals used in search ranking. Images are the largest contributor to LCP on most pages. Compressing images to meet the 2.5 second LCP threshold directly supports search ranking. Beyond speed, properly compressed images with descriptive filenames, alt text, and appropriate dimensions appear in Google Image Search results, which can drive significant traffic for visual products and content.
Frequently asked questions
Will the quality of my photos drop?
Lower quality values remove more detail and give smaller files. You set the level with a slider from 10 to 100 and can compare the file sizes after each change. If you see artifacts in the downloaded file, raise the value and download again.
Is my privacy safe?
Yes. Your images are processed only in your browser and are never uploaded to any server.
Is WebRecast a free TinyPNG or Squoosh alternative?
WebRecast compresses JPG and PNG images in your browser with no upload and no account. It handles one image at a time, scales images longer than 4,096 pixels down to that size, and aims for an output under 10 MB.
Related guides
- Free vs. Paid Online Tools: The Real Cost of No Accounts
- Image Compressor Quality vs Size, What the Slider Does
- PNG vs WebP vs AVIF: Modern Image Formats Compared
- Image Optimization for Web: Complete Performance Guide
