Image to Base64 Converter — Data URI & CSS url()
Turn any image into a Base64 string, a data URI, a CSS url() value, a CSS background rule or an HTML img tag ready to copy and paste. SVGs can be URL-encoded for smaller output. Your files are processed locally and are never uploaded.
Click or drag a file here
PNG, JPG, WebP, AVIF, GIF, SVG, ICO, fonts…
Your files never leave your device, everything runs in your browser.
Frequently Asked Questions
What is a data URI?
A data URI embeds a file directly inside HTML or CSS as text, using the format data:[type];base64,[data]. The browser decodes it without making an extra network request.
When should I inline an image as Base64?
For small icons and images of a few kilobytes. Base64 is about 33% larger than the original file and cannot be cached separately, so bigger images are better served as regular files.
Why is the URL-encoded SVG option smaller?
SVG is text, so percent-encoding only a few special characters keeps it readable and usually smaller than Base64, which always adds about 33% to the size.
Can I convert files that are not images?
Yes. Any file can be encoded, for example fonts for @font-face rules, PDFs or audio files. Image-only outputs like the HTML img tag are hidden for non-image files.