A data URI is an image with no request attached. It works in an email, in a sandboxed iframe, in a test that must not touch the network — and the 1×1 transparent pixel remains the smallest useful image on the web at 43 bytes encoded.
What you can control
- Five content types, including the classic 1×1 transparent pixel for spacers and tracking stubs.
- Four wrappers: bare data URI, raw base64, an
<img>tag, or a CSSbackground-imagerule. - The encoded size is reported so you can see when the base64 overhead stops being worth it.
- Labelled placeholders print their own dimensions, which makes a broken layout obvious at a glance.
Testing ideas
- Size limits. Generate large images and check the encoded size against limits in your email templates, JSON payloads or database columns.
- One-pixel images. The 1×1 transparent pixel is useful for tracking-pixel and spacer edge cases.
- Embedding. Wrap as an
<img>tag or CSS background to test sanitisers that stripdata:URIs. - Uploads. Use raw base64 to test APIs that accept images as encoded strings.
What this is not
Base64 inflates a file by roughly 33% and the result cannot be cached separately from the document that contains it. Above about 10 KB, a real image file is the better choice.