Compress to KB topic guide
Compress image to KB: hit a hard file-size limit
Direct answer
When a form, marketplace or passport service publishes a hard byte budget, the job is not “make it as small as possible.” The job is to land at or under the published maximum while staying above any published minimum, in a format the destination accepts. Read the official limit first, enter that KB target in Compress to KB, let a quality sweep try to keep the original dimensions, and only downscale if the quality floor still exceeds the budget.
What this workflow handles
Hard limits are destination-specific and sometimes two-sided. GOV.UK digital passport photos must be at least 50KB and no more than 10MB (and at least 600×750 pixels). LinkedIn profile photos must be PNG or JPG, at most 8MB, with profile pixels between 400×400 and 7680×4320. Shopify product and collection images must be smaller than 20MB and at most 5000×5000 or 25 megapixels. web.dev’s compress-images guide is explicit that there is no universal quality setting — you experiment. Compress to KB follows that order: quality sweep at the current pixel size first (Pillow JPEG quality/optimize, WebP quality, PNG optimize), then stepped downscale only if needed. Shrinking “as small as possible” can fail a minimum like the UK passport 50KB floor.
Use Compress to KB to set a published KB/MB budget, quality-sweep at the original dimensions first, and downscale only if needed. For a balanced re-encode with no KB target, open Image Compressor instead.
How to use it
- Open the destination’s official Help or service page and note the published max file size, any published minimum, accepted formats, and any min/max pixel rules.
- Convert MB limits to KB if needed (for example LinkedIn 8MB → 8192 KB, Shopify under 20MB → stay under 20480 KB) and enter a target at or under the max — never below a published minimum such as GOV.UK’s 50KB floor.
- Upload the image to Compress to KB and run a quality sweep at the original dimensions first; keep “Keep original format” on when the destination names JPEG/PNG specifically.
- If the result still exceeds the budget after the quality floor, allow stepped downscale (or resize to the destination’s max dimension first if you already exceed it), then re-check byte size and pixels.
- Confirm the output format is in the accepted set, the file is at or under the max and above any min, then upload — re-read the official page if validation still fails.
Frequently asked questions
How do I compress an image to a specific KB size?
Look up the destination’s published max (and any min) in KB or MB, convert MB to KB if needed, and enter that target in Compress to KB. The tool sweeps encoder quality at the original dimensions first, then downscales in steps only if the quality floor still exceeds the budget. web.dev’s compress-images article recommends experimenting with quality rather than assuming one universal number; Pillow’s JPEG, WebP and PNG save options are the levers this tool uses.
Why do some uploads reject a file that is “too small”?
Some destinations publish a minimum as well as a maximum. GOV.UK digital passport photos must be at least 50KB and no more than 10MB. Compressing aggressively below that floor can fail validation even though the photo looks fine. Prefer at-or-under the published max while staying above any published min — do not chase the smallest possible file when a minimum exists.
What file-size limits do LinkedIn and Shopify publish?
LinkedIn Help states profile photos must be PNG or JPG, maximum file size 8MB, with profile pixel size between 400×400 and 7680×4320 (background photos have separate recommended dimensions). Shopify Help states product and collection images need a file size smaller than 20MB and can be any size up to 5000×5000 px or 25 megapixels. Always re-read the current Help page before you upload — platforms can update limits.
Should I lower quality first or resize the image first?
Quality first when the destination cares about bytes and your pixel dimensions already meet its rules. Compress to KB keeps dimensions when possible and only scales down if the quality floor still misses the budget — the result panel then notes the scale. Resize first only when the destination also publishes a max dimension you already exceed (for example Shopify’s 5000×5000 / 25 MP cap, or LinkedIn’s upper pixel bound). web.dev treats quality experimentation and serving scaled images as separate checklist items.
Which format should I pick for a KB budget?
Use a format the destination lists. LinkedIn requires PNG or JPG (no GIF). GOV.UK passport guidance describes a digital photo for online applications with the 50KB–10MB and 600×750 rules — stay in the format that service accepts. Shopify accepts PNG and JPEG among others for product images. On the open web, web.dev recommends experimenting with modern formats, but a marketplace or form that names JPEG/PNG wins over a smaller WebP the form will reject.
How is Compress to KB different from Image Compressor?
Image Compressor uses one balanced default per format (no KB target). Compress to KB sweeps quality toward the size you set and may downscale only when needed. Use Image Compressor for a single balanced re-encode; use Compress to KB when a destination publishes a hard byte budget. Pillow’s JPEG quality/optimize, WebP save options and PNG optimize docs describe the encoder parameters behind both tools.
Can I hit exactly 100 KB every time?
Usually at or under, not exactly on the number. Encoders land on discrete quality steps; a few bytes under the target is normal. If the budget is impossible under the current constraints, Compress to KB says so and offers the smallest best-effort file. For two-sided limits (GOV.UK 50KB–10MB), aim under the max and confirm you are still above the min before uploading.
Sources
- GOV.UK — Photos for passports (digital photos): https://www.gov.uk/photos-for-passports — Digital passport photo must be at least 50KB and no more than 10MB; at least 600 pixels wide and 750 pixels tall.
- LinkedIn Help — Photo won't upload to your profile: https://www.linkedin.com/help/linkedin/answer/a549049 — Profile photo max 8MB; PNG or JPG; profile pixels between 400×400 and 7680×4320.
- Shopify Help — Product media types: https://help.shopify.com/en/manual/products/product-media/product-media-types — Product and collection images smaller than 20MB; up to 5000×5000 px or 25 megapixels.
- web.dev — Compress images: https://web.dev/articles/compress-images — Experiment with quality settings; there is no one universal compression setting.
- Pillow — Image.save (JPEG quality, optimize): https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html#jpeg — JPEG quality and optimize parameters used in the quality sweep.
- Pillow — WebP saving options: https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html#webp — Lossy quality and lossless WebP encoding for opaque and alpha sources.
- Pillow — PNG optimize: https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html#png — Lossless PNG optimize pass before any format fallback.
Explore the compress to kb topic cluster
This guide covers hitting a hard byte budget. Related guides cover post-compress diagnosis, file size vs dimensions, and resize vs compress.
Related guides
-
Why is my image still large?
Diagnosis after compress when bytes barely moved.
-
File size vs dimensions
Why pixel count and byte count are different levers.
-
Resize vs compress
When the problem is too many pixels vs too many bytes.
-
Image Compressor
Balanced default re-encode with no KB target.