Uttir
By Uttir 5 min read

How to Compress an Image to a Specific File Size (Without Losing Quality)

Need an image under 100 KB, 500 KB, or 2 MB for a form, a CMS, or an email attachment? This guide covers the practical techniques that work: quality-based compression, dimension resizing, and format conversion. Includes a free in-browser tool that does all three with a target size.

To hit a specific file size target, the right approach combines three moves: lower the quality, reduce the dimensions, and pick the right format (WebP or JPEG, not PNG for photos). The "compress to size" tool in your browser does this automatically — set the target (e.g. 500 KB), pick the format, and the tool walks the quality / dimension trade-off until the file fits. The whole process runs locally, so the image never leaves your device.

Most forms and platforms have an image upload size limit. Government portals cap passport photos at 200 KB. CMS platforms often want hero images under 1 MB. Email signatures need to be under 100 KB. The catch: you cannot just "compress to 500 KB" with a single magic dial, because the right compression depends on what is in the image. A 500 KB target is easy for a 1920×1080 photo but hard for a 4K screenshot. Here is the practical version — what actually works, in what order, and when to give up on quality and reach for resizing or format conversion.

The three moves that work

There are exactly three knobs you can turn to shrink an image file size, and they each have a different cost:

  1. Quality (re-encoding at lower quality). Re-encoding the same image at quality 70 instead of 95 cuts the file size by 50-70% with very little visible difference. Free lunch, up to a point — below quality 50, the artifacts become obvious.
  2. Dimensions (resize the pixel canvas). A 4K image (3840×2160) is 4× the pixels of a 1920×1080 image and 4× the file size at the same quality. If the form only displays at 1200px wide, resizing to 1200×675 cuts the file to 1/10th of the original. The cost is real: when the user zooms in, the image gets blurry. For most use cases, this is fine — nobody zooms in on a passport photo.
  3. Format (re-encode as WebP or JPEG). PNG is lossless, which is why it makes large files for photographs. Converting a photo from PNG to JPEG at quality 80 cuts the file by 5-10×. Converting to WebP cuts another 25-35% on top of JPEG. The cost: transparency (PNG) is preserved in WebP but lost in JPEG, and JPEG is lossy.

Most "compress to size" tools walk these three knobs in order: lower quality first, then reduce dimensions, then switch format. The best tools do it automatically. The image compressor to size tool picks the right combination to hit a target — set "500 KB", pick "WebP", and the tool finds the quality and dimensions that hit the target without overshooting.

Why "compress to 100 KB" is not one slider

The naive approach is to lower quality until the file fits. This works for some images and fails for others:

  • Photographs compress well at low quality. A photo at quality 30 may look rough on a 4K display but acceptable at 1200px wide. The file size drops fast.
  • Text and line art compress poorly at low quality. A screenshot of a spreadsheet at quality 30 has visible blocks around the letters. Quality has to stay at 70+ for text to be readable, which means the file size stays large.
  • PNG screenshots of UI have a lot of solid color. These compress well with PNG-specific tools (pngquant, oxipng) but only modestly with JPEG. WebP at quality 80 is usually the best balance.

The right tool tries multiple formats and qualities and picks the smallest file that meets the size target. The wrong tool applies one quality level to every image, which either overshoots (file is too small, wasted quality) or undershoots (file is too big, you give up and resize).

What size should I target?

It depends on where the image is going. Some common targets:

  • Email signature: 50-100 KB. Most email clients refuse inline images larger than 100 KB.
  • Social media avatar: 200-500 KB. Twitter, LinkedIn, Facebook all cap avatars at 2-8 MB; smaller is fine and loads faster.
  • Government / passport photo: 100-500 KB. Many portals cap at 200 KB. The image is also constrained to specific dimensions (e.g. 600×600 for US passports) — see the image resizer for that.
  • Web hero image: 100-500 KB. Anything larger than 500 KB on a hero image is usually a sign the image was not optimized. Most landing pages should load the hero in under 200 KB.
  • CMS upload (WordPress, Ghost, Notion): 200 KB - 2 MB depending on the platform. The exact cap is in the platform's settings.
  • Print: 1-10 MB. Print needs more pixels, not more quality. Aim for 300 DPI at the print size; below that and the print looks fuzzy.

Format choice: WebP vs JPEG vs PNG

Three formats cover 95% of use cases. The right pick depends on what is in the image:

  • WebP. The default pick for almost everything. 25-35% smaller than JPEG at the same quality, supports transparency (like PNG), supported by every modern browser since 2020. Use unless the platform specifically rejects WebP (some government portals do).
  • JPEG. The fallback. Slightly larger than WebP but universally supported, including in software that does not understand WebP. Use for email signatures, social media, and platforms that reject WebP uploads.
  • PNG. Lossless. Use only when the image is line art, a logo with transparency, or a UI screenshot where the text must be pixel-perfect. For photos, PNG is 3-5× larger than WebP for no visible benefit.

The WebP converter and the JPG to PNG / PNG to JPG tools handle format conversion separately. For a single "compress to size" workflow, the compress to size tool tries all three formats and picks the one that hits the target with the best visual quality.

The privacy angle

Most "free" image compressors upload your image to a server to do the conversion. The server sees the photo — and many retain it to "improve the service" or to train future models. For a passport photo, a government ID, a screenshot of a private document, or a family photo, this is a real concern.

An in-browser compressor runs the encoding locally. The image never leaves the page. For most uses this does not matter, but for sensitive images it is the only acceptable approach. The same tool, the same output, no third-party data exposure.

Quick checklist for hitting a target size

  1. Open the image and check the current size. If it is already under the target, you are done.
  2. Try WebP first at quality 80. For most images, this hits the target with no visible loss.
  3. If still too big, lower the quality. Quality 60 is usually the floor for photos before artifacts become visible.
  4. If still too big, reduce the dimensions. Match the dimensions to where the image will be displayed. A 4000×3000 photo for a 600×600 avatar is wasting 90% of the pixels.
  5. Use the tool that does all three automatically. The image compressor to size walks this checklist for you — set the target, and it picks the smallest file that fits without dropping dimensions further than necessary.
#images#compression#web-performance#webp#jpeg#optimization

New tools and guides, once a week

One short email when something new ships. No tracking, no images, unsubscribe with one click.