About File to Base64 Converter
This file to Base64 converter reads any file from your device, such as a PDF, an image, a font or a ZIP archive, and writes its bytes as Base64. It is free, needs no sign-up and runs in your browser, so nothing you enter is uploaded.
Choose Encode, then File or image, and select the file. The result appears in the Output box. Tick URL-safe if the string is going into a URL or a token, untick Keep = padding if the receiving system wants no padding, and tick Data URL to get data:application/pdf;base64,... (or the type your browser reports for the file).
Typical uses are embedding a small font or icon in CSS, sending a file as a field in a JSON API that does not accept uploads, and putting a certificate or key file into an environment variable or a config secret. Base64 adds about a third to the size, so a 1 MB file becomes about 1.33 MB of text. When the type is unknown the data URL uses application/octet-stream.
The file is read into your browser memory, so very large files can be slow, and the output box can become heavy. For multi-megabyte files, a command-line tool is a better fit. To go the other way, use Decode with the string and then Download as file.
How to use File 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 a PDF file gives JVBERi0xLjc=
Here the 8 bytes are the text %PDF-1.7. Every PDF starts with JVBERi0.
First bytes of a ZIP file gives UEsDBA==
The PK header. DOCX, XLSX and APK files start the same way.
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 a file to Base64?
Choose Encode, switch to File or image, and pick the file. The Base64 appears in the Output box. Copy it from there.
How big a file can I convert?
There is no upload, so there is no upload limit. Your browser has to load the file and build a long string, so limits depend on your device. A few megabytes is fine on most machines.
How do I turn the Base64 back into the file?
Choose Decode, paste the string and press Download as file. The result is saved as decoded.bin, which you should rename with the original extension.
Is the file uploaded anywhere?
No. It is read and encoded by your browser, on your own device.
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.
- Image to Base64 ConverterPick an image and get its Base64 string or a data URL ready to paste into HTML or CSS.
- 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.