File to Base64
Encode a file up to 2 MB as Base64 or a data URI. Your inputs stay on your device.
LimitsSet up your task
Starting local processing
Ready. Processing stays in this browser.
2 Your result
Downloads are created from local browser memory. Check the result before replacing any original.
How to use File to Base64
Turn a small file into Base64 text for a form or system that accepts text instead of a file. Include the data prefix only if the destination asks for it.
- Choose a file up to 2 MB.
- Select the data URI option if the receiving system expects a media-type prefix.
- Use the displayed text or download the complete encoded value.
Supported inputs and limits
Encode a file up to 2 MB as Base64 or a data URI. Base64 is encoding, not encryption.
How it works
Base64 represents binary bytes using printable characters. It can help when an API, configuration file or document format requires data to be supplied as text. The optional data-URI prefix records a media type before the encoded content. Use a plain Base64 string when the receiving system expects only the encoded bytes, because a data-URI prefix would then be additional unwanted input.
Encoding is not encryption. Anyone with the text can decode the original bytes. Base64 also increases size, commonly by about one third before any surrounding formatting, so it is not a way to make an attachment smaller. This tool limits the original file to 2 MB to avoid a very large text result. For long output, use the generated text file rather than expecting the entire encoded string to remain displayed on screen.
Example
A text file containing exactly abc encodes to YWJj, without a data-URL prefix.
Questions about File to Base64
Why is the Base64 limit lower than other file tools?
Base64 adds about one third to the byte count and creates additional text copies. This tool keeps a 2 MB cap and exports plain Base64 rather than a data URL.
Is Base64 a way to make a file smaller?
It usually makes the representation larger. Use compression first if your actual goal is a smaller file.
What should I send if the receiving form rejects the data prefix?
Try the plain Base64 option. Some systems expect the encoded bytes without a media type in front.
Related tools
Last updated