The smallest real image header
- Input
- An 8-byte PNG signature (the first 8 bytes of every PNG file)
- Working
- 8 bytes = two full 3-byte groups plus 2 leftover bytes, padded with one =: 4 × ceil(8 ÷ 3) = 12 characters — the well-known string iVBORw0KGgo=. Overhead = 12 ÷ 8 − 1 = 50.0%, the worst case small files always pay.
- Result
- 8 bytes → data:image/png;base64,iVBORw0KGgo= (12 chars, +50.0%)