To shrink an HTML app's APK, fix the images first: resize them to the size a phone actually shows and convert them to WebP. Then move or shrink any video, switch fonts to WOFF2, and ship minified JavaScript. We measured each step in real builds of the same app. Images alone took the APK from 17.48 MB to 10.83 MB. All five steps together brought it to 7.35 MB, and the web files' own share fell from 10.79 MB to 0.67 MB.
The order matters because Android doesn't treat all files the same. Text files are compressed inside the APK, while photos and video go in exactly as they are. That's why minifying JavaScript, the step most guides start with, saved the least.
How we tested
We started from our free Recipe Box sample app, which adds just 47 KB to an APK, and loaded it with what real projects tend to ship:
- six 2400 px JPEG photos and a full-screen PNG hero image (photo-like test images we generated, with the fine detail of real photographs);
- four font weights as TTF files;
- the development (unminified) builds of React and React DOM, plus a leftover source map;
- a 12-second 1080p intro video.
That made a 12.9 MB project. We then fixed one thing at a time, keeping each change, and built a real APK after every step with the same HTML-to-APK runtime this site uses. Every build started from clean (see the warning further down for why that matters). The runtime itself, with no web content, is 6.68 MB, shown in grey below.
Why images matter most: what Android compresses
An APK is a ZIP file. When it's built, text files are compressed, but media files are stored as they are, because they're already compressed. We opened the "as built" APK and checked every file:
| File type | In the project | In the APK | Stored as |
|---|---|---|---|
| JPEG photos (6) | 3.82 MB | 3.82 MB | As is (100%) |
| PNG images (2) | 3.19 MB | 3.19 MB | As is (100%) |
| MP4 video | 2.28 MB | 2.28 MB | As is (100%) |
| TTF fonts (4) | 1.49 MB | 0.71 MB | Compressed (47%) |
| JavaScript (4) | 1.10 MB | 0.32 MB | Compressed (29%) |
| Source map | 0.73 MB | 0.21 MB | Compressed (29%) |
| HTML + CSS | 10 KB | 5 KB | Compressed |
So 1 MB of JavaScript costs about 0.3 MB in the APK, but 1 MB of photos costs a full 1 MB. Start with the files that go in untouched.
Step 1 — Resize and convert images to WebP
A phone screen is about 1080 pixels wide, and an image in a card or a column is usually far less. A 2400 px photo carries detail nobody will ever see. Resize every photo to at most 1280 px on its longer side and save it as WebP at quality 80:
cwebp -q 80 -resize 1280 0 photo.jpg -o photo.webp
On our test photo that went from 599 KB to 69 KB. The 3.2 MB PNG hero became 63 KB. Across all seven images, this one step removed 6.65 MB from the APK, more than every other step put together. Then update the file names in your HTML or data files.
Keep PNG only for images that need sharp edges and transparency, such as logos, icons and screenshots of text. Photos should never be PNG.
Step 2 — Fonts: WOFF2, only the weights you use
Font files are compressed in the APK, but TTF still compresses poorly. Two changes help. First, include only the weights your CSS actually uses. Most sites declare four and use two. Second, convert them to WOFF2 with only the characters you need:
pyftsubset Georgia.ttf --unicodes="U+0020-007E,U+00A0-00FF" --flavor=woff2 --output-file=georgia.woff2
That turned a 380 KB TTF into a 33 KB WOFF2 covering English and Western European text. Going from four TTF weights to two subset WOFF2 files saved 0.66 MB. The cheapest font of all is none: a system font stack (system-ui, sans-serif) costs 0 KB and looks native on every phone.
Step 3 — Ship production JavaScript, delete source maps
Swap development builds of libraries for their production (minified) versions, and delete every .map file before you zip the project. Source maps help you debug on a desktop, and they do nothing inside an app. This step saved 0.49 MB: real, but small, because the APK was already compressing that text to 29% of its size. Delete anything else the app never loads at the same time, such as design files, READMEs, test folders and stray node_modules.
Step 4 — Shrink the video, or don't bundle it
Video goes into the APK untouched, so every megabyte counts. A 1080p intro is overkill on a phone screen. Re-encoding it to 720p cut it from 2.28 MB to about 0.5 MB and the APK by 1.78 MB:
ffmpeg -i intro.mp4 -vf scale=1280:-2 -c:v libx264 -crf 30 -preset slow -c:a aac -b:a 64k -movflags +faststart intro-720p.mp4
If the video isn't essential offline, load it from the web instead. Removing it from the bundle saved another 0.56 MB. Our bundled vs live URL guide explains what a bundled page can and can't load from the internet.
Step 5 — Measure the right way
Check what's actually in your APK before and after each change. An APK is a ZIP, so you can list it:
unzip -l app.apk | sort -k1 -n -r | head -20
One trap caught us during this test. If you build the APK yourself in Android Studio, debug builds are packaged incrementally: deleted files leave unused space behind, so the APK can stay the same size after you remove megabytes. Our first round of builds showed almost no change from steps 2 to 4 for exactly this reason. Always do a clean build (Build → Clean Project, or delete app/build) before comparing sizes. Converter services build from scratch every time, so they don't have this problem.
Common mistakes
- Starting with minification. It's the smallest win, because the APK already compresses text.
- Converting PNG icons to lossy WebP. Logos and icons with sharp edges should stay PNG, or use lossless WebP.
- Shipping images at camera size. Nothing in an app needs a 4000 px photo.
- Bundling every font weight "just in case". Check your CSS for the weights you actually use.
- Comparing incremental debug builds. Clean first, or the numbers lie.