Photo

How to compress an image to 20KB, and when it will not fit

Twenty kilobytes is tiny: about 1/250 of a phone photo. Here are the steps, how the tool squeezes a photo that far, and the results for a signature, a photo and a document picture.

Updated ยท 11 min read

Featured image: How to compress an image to 20KB, and when it will not fit, with a real screenshot of the Compress Image tool tool on Dokurapi
Inside the frame: a real screenshot of the Dokurapi tool. All processing runs in the browser, nothing is uploaded.

To compress an image to 20KB, open Dokurapi's free Compress Image tool, choose a JPG, PNG or WebP file, type 20 in the Custom target (KB) box, leave Pixel size on Shrink if needed, press Compress photo, and read the Output and Quality and dimensions lines before you download. The tool aims 6% below your number, so the result must be 18,800 bytes or less. The image never leaves your browser. In our test, a 5.00 MB phone photo came out at 18.7 KB and 1065 x 799 pixels in under a second, and a 278 KB signature scan came out at 18.3 KB without losing a single pixel.

Not every image can get that small, though. A photo of a full page of text did not fit even at the smallest size the tool allows. This guide shows the steps, how the tool works its way down to 20 KB, the results for five test images, and what to do when the target is out of reach. For less extreme limits, see our guides to compressing an image to 50 KB and 100 KB.

Steps to compress an image to 20KB

There is no account, no watermark and no upload. Keep your original file; the tool always creates a new copy.

  1. Check what the form really wants. Many forms state a size range and a pixel size together, for example a minimum and a maximum in KB plus a width and height. Note all of them before you start.
  2. Open the Compress Image tool and choose one image. JPG, PNG and WebP are accepted. The result is always a JPG.
  3. Type 20 in the Custom target (KB) box. The custom number overrides the Target size menu, which only offers 100 KB and up.
  4. Leave Pixel size on Shrink if needed. With Keep original size (no resize), the tool may only lower quality, which is rarely enough for 20 KB.
  5. Press Compress photo. The result box shows the original size, the output size and the final quality and pixel size.
  6. Look at the result at 100% zoom. Faces, signatures and text must still be clear. If the status line says the target was not reached, do not upload that file; jump to the fixes below.

If you also need a fixed pixel size such as a passport photo, crop first with our guide to cropping a photo, then compress.

Dokurapi Compress Image tool with a custom target of 20 KB, showing a 5.00 MB photo reduced to 18.7 KB at quality 32% and 1065 by 799 pixels
Our phone photo test in the live tool: 20 typed in Custom target (KB), Pixel size on Shrink if needed. The 5.00 MB original came out at 18.7 KB, quality 32%, 1065 x 799 px, and the status line confirms the safe target was reached.

Ready to try it? The tool is free and runs in your browser.

Open the Compress Image tool

How the tool gets an image down to 20KB

A JPEG file gets smaller in two ways: lower quality, which throws away fine detail, and fewer pixels, which throws away resolution. The tool uses both, in a fixed order that you can see in the diagram below. These steps come straight from the tool's code.

  1. It first caps the longest side at 2,400 pixels and saves at the starting quality from the slider, 84% by default.
  2. If the file is too big, it lowers quality by 10 points at a time, down to a floor of 18%.
  3. If it is still too big, it shrinks the pixel size and tries again at qualities 72%, 58%, 45% and 32%, keeping the smallest file each round.
  4. It never shrinks the longest side below 640 pixels. If the file still does not fit at that point, it gives you the smallest result and says the target was not reached.

The quality figure is passed to the browser's JPEG encoder through the canvas API described in MDN's toBlob reference. The 18,800 byte safe line comes from counting 1 KB as 1,000 bytes, as NIST defines the decimal kilobyte, minus 6% to cover portals that use 1,024 or round differently. The 640 pixel floor is deliberate: below it, faces and signatures stop being recognizable, which is worse than a file that is a little too big.

Flow diagram: start at quality 84 percent with a 2,400 pixel cap, lower quality to 18 percent, shrink the pixel size and retry, stop at a 640 pixel longest side
The order the tool follows for a 20 KB target. Each step stops as soon as the file fits under 18,800 bytes; the last box is the floor of 640 px on the longest side.

What happened with five test images

We made five synthetic test images with no personal data: a pen signature scanned on off white paper, a small 480 x 640 photo, a 4000 x 3000 phone photo full of colour and grain, a 3000 x 4000 photo of a printed page, and a cropped 1500 x 1000 piece of that same page. Each one went through the live tool with a 20 KB custom target and the default settings.

Compress image to 20KB: results from the live tool (November 2026)
Test imageOriginalResultQuality and pixelsTarget met?
Signature scan278 KB, 1600 x 60018,325 B18%, 1600 x 600Yes
Small photo140 KB, 480 x 64016,261 B24%, 480 x 640Yes
Phone photo5.00 MB, 4000 x 300018,726 B32%, 1065 x 799Yes
Cropped document photo682 KB, 1500 x 100020,656 B32%, 640 x 428No
Full document photo5.27 MB, 3000 x 400024,351 B32%, 479 x 640No

The pattern is clear. Images with large plain areas, like a signature on paper, reach 20 KB by quality alone and keep every pixel. Photos with a lot of colour reach it after the width drops to roughly a quarter of the original. Pictures of printed text are the hardest: every letter edge is detail that JPEG must keep, so even at 640 pixels and quality 32% our document photo stayed at 24,351 bytes.

Bar chart of five results against an 18,800 byte safe line: three green bars under the line and two red bars above it
The five results against the 18,800 byte safe line. The signature, the small photo and the phone photo fit; both document photos stay above the line even at the 640 px floor.

How a 20KB image looks

At 20 KB you should expect visible compromises, so it helps to know what they look like before a reviewer sees them. The crop below shows the same corner of the phone photo at full size and after compression, plus the document photo result.

The 18.7 KB photo keeps the shapes and colours, but fine grain turns into soft patches and colour edges show faint blocks. For a profile picture or a small thumbnail on a form, that is usually fine. The document photo is a different story: at 479 x 640 pixels the text is readable only because the letters were large to begin with, and small print would not survive.

Two rules follow. First, 20 KB suits a face, a signature or a logo, not a page of text; if a form asks you to upload a document, it almost always allows a PDF with a bigger limit, and our photo to PDF guide covers that route. Second, if a form asks for a minimum size as well, check that the result is not below it. Our article on increasing an image size in KB handles the opposite problem.

Three crops side by side: the original phone photo, the same area after compression to 18.7 KB, and the compressed document photo with blurred text
Left: a corner of the 5.00 MB phone photo. Middle: the same area in the 18.7 KB result (1065 x 799 px, quality 32%), softer but recognizable. Right: the document photo result at 24.4 KB and 479 x 640 px, where the text is near its limit.

What to do when 20KB is not reached

If the status line says the image was reduced but the target was not reached, the tool has hit its 640 pixel floor. These fixes work, roughly in order of how often they help:

  1. Crop to the part that matters. A signature should fill the frame, not sit in the middle of a whole sheet. A face photo should be cropped to the head and shoulders. Every pixel you remove is detail the encoder no longer has to keep.
  2. Use a plain background. Grain, shadows and patterned backgrounds cost bytes. Retake the photo against a plain wall in even light, or follow our guide to a blue background ID photo.
  3. Start from a smaller source. If the form wants a small pixel size, such as 200 x 230, resize to that size first with our resize guide; a small image reaches 20 KB at a higher quality.
  4. Convert the format first if needed. PNG and WebP files are saved as JPG by the tool, but Dokurapi does not convert iPhone HEIC photos yet, so convert them first; see our HEIC to JPG and PNG to JPG guides.
  5. Ask for a PDF field instead. If the image is really a document, upload it as a PDF where the form allows that.

For the general reasons a compressed file stays too big, see why a compressed file is still too big.

Dokurapi Compress Image tool result for a 5.27 MB document photo with a 20 KB target: output 24.4 KB at quality 32% and 479 by 640 pixels, target not reached
The honest failure: our 5.27 MB photo of a printed page reached 24.4 KB at quality 32% and 479 x 640 px, the smallest the tool allows, and the status line says the target was not reached.

Check the image before you upload it

Small files fail in small ways, so check the downloaded file, not the original, before you submit anything:

  • The size shown by your file manager is under 20 KB. Some systems show 1 KB as 1,024 bytes, so 18,800 bytes may appear as 18.4 KB; both are under the limit.
  • The pixel size matches what the form asks for, if it states one. Our guide to image DPI explains why DPI rarely matters for uploads while pixels do.
  • The face, signature or logo is still sharp enough to recognize at 100% zoom.
  • The file is a JPG with the extension .jpg or .jpeg, if the form only accepts JPEG.
  • The file name has no special symbols.

Keep the original photo too. If the portal later asks for a larger version, you can compress again from the original instead of enlarging a 20 KB copy, which would only add blur. For a full upload checklist, read how to check file size before upload.

Frequently asked questions

How do I compress an image to 20KB for free?
Open the Dokurapi Compress Image tool, choose the image, type 20 in the Custom target (KB) box, keep Pixel size on Shrink if needed, press Compress photo and download the result. It is free and the image stays in your browser.
Why did my 20KB image become smaller in pixels?
Lowering JPEG quality alone was not enough, so the tool reduced the pixel size and tried again. In our test a 4000 x 3000 phone photo ended at 1065 x 799 pixels to reach 18.7 KB.
Can every image be compressed to 20KB?
No. The tool stops at 640 pixels on the longest side to keep the image recognizable. Busy images, especially photos of printed text, can still be above 20 KB at that point; our document photo stayed at 24,351 bytes.
Is 20KB the same as 20,000 bytes?
In decimal units, yes. Some systems use 1 KB = 1,024 bytes, which makes 20 KB 20,480 bytes. The tool aims for 18,800 bytes so the file passes under either rule.
Will a 20KB photo look blurry?
It looks softer than the original. Plain areas and large shapes survive well, while fine grain and small text suffer. Check the result at 100% zoom before uploading.
Can I compress a signature image to 20KB?
Usually yes, and easily. Our 1600 x 600 signature scan reached 18,325 bytes at quality 18% without any reduction in pixel size, because white paper costs very few bytes.
Does the tool upload my photo?
No. The image is decoded and re-encoded by your own browser, and the file is never sent to a Dokurapi server.
What if the form also needs exact pixel dimensions?
Crop or resize to the required pixel size first, then compress to 20 KB. Starting from the final pixel size usually lets the tool keep a higher quality.

Sources

  1. Prefixes for binary multiples, NIST
  2. HTMLCanvasElement: toBlob() method, MDN Web Docs

Need help?Result not quite right, or unsure about a form rule? Ask Dokurapi support on WhatsApp. Please do not send personal documents in chat.

Chat on WhatsApp

Related articles

Try Dokurapi for Free

No account needed. Pick a tool, drop in a file, and download the result, free.