If you've ever tried uploading a photo to a government job portal and got the error "file size must be under 20KB" — you're not alone. This specific file size limit shows up everywhere, from NADRA Pakistan passport applications to Indian railway exam portals, and most people have absolutely no idea how to hit it without completely destroying their image quality.
In this guide, we'll walk you through exactly how image compression works, which formats make it easier, and how different types of users — from government job applicants to web developers — can get their images under 20KB quickly and without the headache.
The 20KB limit isn't random. It appears in very specific situations and understanding who needs it helps you understand why the limit exists at all. There are basically two kinds of users searching for this:
This is by far the biggest group. If you're applying for a government job in India, Pakistan, Bangladesh or several other countries, the online application portal almost certainly has a strict file size requirement for your photo and your signature scan. These portals were often built years ago when bandwidth was expensive, and the 20KB limit stuck around even as internet speeds improved.
Common portals with 20KB limits include NADRA Pakistan for CNIC and passport applications, SSC and railway exam portals in India, various state government job boards, and visa application portals for certain countries. Missing this requirement doesn't just cause an error — it can get your entire application rejected without any explanation.
If you're applying for a passport, you might also want to check out our India passport photo guide which covers the 300KB limit for Passport Seva, or the Pakistan passport photo guide which goes into detail about NADRA's specific requirements.
The second group is web developers who are trying to optimise their Core Web Vitals scores, particularly the Largest Contentful Paint (LCP) metric. Small icons, avatars, thumbnails and signature images on a website should ideally be under 20KB to avoid slowing down page loads.
For developers, the approach is slightly different — you have more flexibility with formats like WebP, and you're less concerned about specific pixel dimensions and more focused on visual sharpness at small sizes.
Government portals have 20KB limits for a few practical reasons. First, they were designed when average internet connections in the country were much slower. A smaller file uploads reliably even on a 2G or 3G connection without timing out. Second, when you're storing millions of application records with photos and signatures, keeping each image small adds up to massive savings in database storage. Third, smaller files process faster through automated systems that check image validity.
One of the most important factors in reaching 20KB is choosing the right image format. Not all formats compress equally, and understanding the differences can save you a lot of frustration.
| Format | Best For | Compression Ability | Reaching 20KB | Accepted by Portals? |
|---|---|---|---|---|
| JPEG | Photos, portraits, passport photos | High — adjustable quality | ✅ Easy | ✅ Universal |
| PNG | Logos, text, graphics with transparency | Low — lossless only | ⚠️ Difficult | ✅ Usually accepted |
| WebP | Web images, modern browsers | Superior — 25-30% smaller than JPEG | ✅ Easier than JPEG | ⚠️ Not all portals |
| BMP | Uncompressed raw images | None — no compression | ❌ Impossible for most images | ❌ Rarely |
For government portals, JPEG is almost always the right choice. It's universally accepted, compresses well, and handles portrait photos without visible loss at small sizes. If you have a PNG file, the first thing you should do is convert it to JPG before compressing. This alone can cut your file size dramatically before any quality reduction is applied.
WebP is excellent for web developers who are targeting LCP improvements. If you're working on website performance, consider converting your images to WebP using our convert to WebP tool — it can achieve the same visual quality as JPEG at 25-30% smaller file sizes, making 20KB targets much easier to hit.
This is the part that confuses most people, so let me keep it simple.
Lossless compression reduces file size without removing any image data. When you decompress a losslessly compressed image, you get back exactly the original. PNG uses lossless compression. The problem is there's a limit to how much you can reduce file size this way — and for photos, that limit is usually nowhere near 20KB.
Lossy compression achieves smaller file sizes by permanently removing some image data — specifically data that the human eye is least likely to notice. JPEG uses lossy compression. At moderate levels, the quality loss is invisible. At aggressive levels, you start to see blurring and artefacts, particularly around sharp edges and text.
Think of it like this — if you have a 4000x3000 pixel photo from your smartphone, compressing it to 20KB will cause noticeable quality loss because you're removing enormous amounts of data. But if you start with the correctly sized image — say 600x600 pixels for an Indian passport photo — reaching 20KB is achievable with minimal visible difference.
Here is the exact process to get any image under 20KB using our free tool:
No signup, no watermark. Upload and download in seconds.
Open 20KB Compressor →Most government exam portals in South Asia require two images — your passport-sized photo and your signature. Both usually need to be under 20KB. Here's the typical requirements:
| Document | Typical Dimensions | Format | Size Limit |
|---|---|---|---|
| Passport Photo | 200x200 px or 35x45mm | JPEG | 20KB |
| Signature Scan | 140x60 px | JPEG | 20KB |
| Thumbprint | 100x100 px | JPEG | 20KB |
The key insight here is that you should resize your image to the correct dimensions first, then compress. If you resize a passport photo to 200x200 pixels and then compress to 20KB, the quality will be much better than if you try to compress a 1000x1000 pixel photo to 20KB. Use our resize by pixels tool to get dimensions right first.
For NADRA Pakistan specifically, both the photo and signature must be under 20KB. This is one of the strictest file size requirements among all government portals worldwide. The signature image dimension is typically 140x60 pixels at 96 DPI.
If you're a developer trying to improve your LCP score, 20KB images are a common target for small UI elements. Icons, avatars, badges and decorative images should ideally be this size or smaller. A few principles to keep in mind:
Two concepts that trip a lot of people up are image dimensions (measured in pixels) and DPI (Dots Per Inch). They're related but different.
Image file size is directly related to the number of pixels. A 600x600 pixel image has 360,000 pixels. A 200x200 pixel image has 40,000 pixels — which is nine times fewer. Fewer pixels means the compressor has less data to work with, making it much easier to hit a small target like 20KB without quality loss.
DPI refers to how many dots (pixels) are packed into one inch when printed. 72 DPI is standard for screens. 300 DPI is standard for printing. But here's the thing — DPI doesn't affect digital file size directly. A 200x200 pixel image at 300 DPI is the exact same file size as a 200x200 pixel image at 72 DPI. DPI only matters when you print. For online portal submissions, you can ignore DPI and focus entirely on pixel dimensions.
If you need to resize your image in physical measurements for printing — say a 35x45mm passport photo at 300 DPI — use our resize in millimeters tool which handles the DPI conversion automatically.