How to Encode Data URIs
Data URI Encoding
When to Use Data URIs
Embed small assets inline in HTML, CSS, or JSON using data: URLs — common for tiny icons, test fixtures, and email snippets. Base64 encoding keeps binary-safe text in a single string without a separate file fetch.
MIME Types
Set the MIME type in tool settings (default text/plain). Use image/png or image/svg+xml when embedding images. Incorrect MIME types may cause browsers to mis-handle decoded content.
Developer Tips
- Large data URIs inflate HTML/CSS size — prefer external assets for big files
- Review CSP rules — some policies restrict inline data URLs
- This encodes content for debugging — not for hiding secrets
Frequently asked questions
Is a data URI encrypted?
No. Base64 encoding is reversible by anyone who sees the string.
Can I embed images?
Yes. Paste raw text content and set an appropriate image MIME type, or encode binary elsewhere first.