Image to Base64 (Data URL) Converter
Select an image file to convert it directly to a Base64 string or Data URL, with no re-compression or quality loss. Switch to "Base64 to Image" to turn a Base64 string or Data URL back into a downloadable image. For plain text conversion, try the Base64 Encoder/Decoder; for format conversion and compression, see the Image Format Converter.
🔒 Runs in your browser · Your data is never sent to a server
You can also drag and drop an image file here
Notes
- "Image to Base64" does not re-encode via canvas, so the original bytes (including SVG and ICO files) are converted to Base64 as-is, with no quality loss and no dropped GIF animation.
- Base64 encoding increases the size by roughly 1.33x (4/3) over the original file. Keep this in mind when embedding images in HTML, CSS, or JSON.
- "Base64 to Image" auto-detects PNG, JPEG, GIF, WebP, BMP, SVG, and ICO from the leading bytes (magic number), even without a data:image/xxx;base64, prefix. If the type cannot be determined, an error is shown.
- All processing happens in your browser — the image or Base64 string you provide is never sent to a server.
Glossary
Base64
An encoding scheme that converts binary data, such as an image, into a string using only letters, digits, and a few symbols (A-Z, a-z, 0-9, +, /, =). Commonly used to embed binary data in text-only formats like CSS, JSON, or email.
Data URL
A URL such as `data:image/png;base64,...` that bundles a MIME type and Base64-encoded content into a single string. It can be used directly as an `<img src="...">` or a CSS `background-image`, displaying the image without a separate file request.
MIME type
An identifier describing a file's type, such as `image/png` or `image/jpeg` for images. It appears at the start of a Data URL and tells the browser how to interpret the data that follows.
FAQ
How much larger does the file get when Base64-encoded?
About 1.33 times (4/3) the original size. When embedding in HTML or CSS, limit it to small assets like icons.
What is the difference between a Data URL and a Base64 string?
A Base64 string is only the data; a Data URL adds a prefix like "data:image/png;base64,". Data URLs can be used directly in img tags and CSS url().
Can I turn Base64 back into an image?
Yes. Choose "Base64 to Image". Even without the prefix, the format (PNG, JPEG, GIF, WebP, BMP, SVG, ICO) is detected from the first bytes; if it cannot be detected, an error is shown.
Share this page
