About Image to Base64 Converter
This image to Base64 converter reads an image from your device and writes its bytes as Base64. Tick Data URL to get a complete string such as data:image/png;base64,... that you can use as an image source. It is free, needs no sign-up and runs in your browser, so nothing you enter is uploaded.
Choose File or image, then pick the picture. The media type comes from the file, so a PNG gets data:image/png;base64, and a JPEG gets data:image/jpeg;base64,. Paste the string into the src of an img tag or into a CSS background: url(...). The whole file is encoded as it is, with no resizing or recompression, so the output is exactly your original bytes written as text.
Inline images save a network request, which suits tiny icons, placeholder blurs and email templates. They also make the page about a third bigger than the image file, and the browser cannot cache the image on its own. For anything over a few kilobytes a normal image file is usually better.
An image file starts with a recognisable signature, so its Base64 does too: PNG starts with iVBORw0KGgo and JPEG with /9j/. The image never leaves your browser.
How to use Image to Base64 Converter
- Choose Encode to turn data into Base64, or Decode to turn Base64 back into the original.
- To encode, type or paste text, or choose File or image and pick a file from your device.
- Set the options you need: URL-safe (- and _) for tokens and URLs, Keep = padding to include or drop the trailing equals signs, and Data URL to add the data: prefix with the right media type.
- To decode, paste Base64 or a full data URL. Padding is optional and spaces or line breaks are ignored.
- Read the result in the Output box. For an image, check the Image preview. For other data, use Download as file to save the decoded bytes.
- Use Copy to put the result on your clipboard.
Features
- Encodes and decodes text as UTF-8, so every language and emoji works.
- Encodes any file or image from your device. It is read in your browser and never uploaded.
- URL-safe option that uses - and _ in place of + and /, as used by JWT and URL parameters.
- Padding switch: keep the trailing = signs or drop them.
- Data URL option that writes data:text/plain;charset=utf-8;base64, or data: with the file media type in front of the result.
- Decoder that accepts both alphabets, missing padding, whitespace and a data: prefix.
- Image preview when the decoded bytes are a PNG, JPEG, GIF, WebP or BMP picture.
- Download of the decoded bytes as a file, for PDFs, images and other binary data.
- Clear errors: Input is not valid Base64, or Valid Base64 but the bytes are not UTF-8 text.
Worked examples
First bytes of any PNG file gives iVBORw0KGgo=
The 8-byte PNG signature written in Base64. Every PNG file starts with iVBORw0KGgo.
First bytes of a JPEG file gives /9j/4AAQ
JPEG files start with FF D8 FF, which gives /9j/.
A PNG with the Data URL option on gives data:image/png;base64,iVBORw0KGgo...
The dots stand for the rest of the image data.
Privacy: how it works
- Your text, files and images are processed by code in your browser tab. Nothing is sent to Ulkaa or to any other server, which you can confirm in the Network tab of your browser developer tools.
- That matters for Base64 in particular, because people often paste API keys, tokens and private images into these tools. Because there is no upload, there is nothing to leak, but remember that anything you paste into any web page is visible on your screen.
Tips
- If a decoded result looks like random symbols, the original was probably binary, such as an image or a PDF. Use Download as file instead.
- A string that starts with eyJ is very likely Base64 for a JSON object that begins with {". JWT parts do.
- Pasting a JWT part? The segments are URL-safe Base64 without padding. Decode each of the dot-separated parts on its own.
- To embed a small image in CSS or HTML, choose File or image, tick Data URL, and paste the result into src or url().
Frequently asked questions
Is it really free?
Yes. There is no price, no trial and no credit card. Ulkaa Tool does the work with your own device, so there is no server bill to pass on to you.
Do I need an account?
No. There is no sign-up and no login. Open the page and use it. An Ulkaa account is not needed for anything on this tool.
Does it run in my browser?
Yes. Your text and files are processed by code running in your browser tab, on your own device.
Is my data uploaded?
No. Your text and files are never sent to Ulkaa or to anyone else. You can check this yourself by watching the Network tab in your browser developer tools while you use the tool.
How do I convert an image to a Base64 data URL?
Choose Encode, then File or image, pick the image and tick Data URL. Copy the result, which begins with data: and the image type.
Is my image uploaded?
No. The file is read by your browser and encoded on your device.
Does Base64 make the image smaller?
No. It makes the data about 33 percent bigger. It only changes the image into a text form.
Which image types work?
Any file can be encoded, so PNG, JPEG, GIF, WebP, SVG and BMP all work. The media type in the data URL comes from the file type your browser reports.
More Base64 Encoder and Decoder pages
- Base64 Encoder and DecoderEncode text, files or images to Base64, or decode a Base64 string or data URL back to text, an image or a file.
- Text to Base64 EncoderType or paste text and get its Base64 encoding straight away.
- Base64 to Text DecoderPaste a Base64 string and read the text it holds.
- Base64 to Image DecoderPaste Base64 or a data URL and see the picture it contains.
- Base64URL EncoderEncode text as URL-safe Base64 using - and _, with or without padding.
- File to Base64 ConverterPick any file and get its contents as a Base64 string.