Binary file to Base64
Read any small binary file in the browser (up to 8 MiB) and encode it as Base64, optionally with a data: URI prefix and optional line wrapping at 4–200 characters. Nothing is uploaded and byte counts are shown.
Runs in your browserEvery computation happens in your browser — your data never leaves this device.
Read locally, never uploaded. Up to 8 MiB per file (roughly 10.7 MB of Base64 text), any extension.
Base64 output
Copy it into HTML, CSS, JSON or an API client.
Choose a file to see its Base64
Bytes: 0 · Base64 length: 0 · Lines: 0
What this tool does
- Inline small PNG, ICO, font or PDF files as Base64 inside HTML, CSS or a JSON config
- Convert a binary request body to Base64 while debugging an API in cURL, Postman or a log
- Turn on the data URL prefix and set the MIME type to get a string that works directly in an <img src> or background-image
Example
Input
file hello.bin, 5 bytes: 104 101 108 108 111
Output
aGVsbG8=
That is the standard Base64 of the 5 bytes "hello" (with one = pad). With the data URL prefix on, the output is data:application/octet-stream;base64,aGVsbG8=.
Frequently asked questions
Is there a file size limit?
Yes, 8 MiB (8 × 1024 × 1024 bytes) per file. Base64 inflates data by about 4/3, so 8 MiB becomes roughly 10.7 MB of text, which is about as much as a browser textarea and clipboard handle comfortably. For bigger files use a command-line base64 or backend storage.
What is the wrapping option for?
Some targets — email attachments, legacy config files, line-based scripts — require Base64 to stay within 76 or 64 characters per line. You can choose no wrapping, 64, 76 or 128 columns, plus CRLF line endings. Wrapping only changes presentation and copying, not the decoded bytes.
What MIME type goes into the data URL prefix?
A standard MIME type such as image/png, image/svg+xml or application/pdf; empty means application/octet-stream. The tool only validates the format and never guesses the real type, so a wrong MIME will not raise an error but the browser may fail to render it.
Is my file uploaded?
No. The file is read locally through input[type=file] and FileReader.readAsArrayBuffer, and encoding happens entirely in the page with no network requests and no storage. Closing the page discards it.
Is Base64 encryption?
No. Base64 just maps arbitrary bytes onto 64 printable characters so binary can travel through text-only channels; anyone can decode it straight back to the original bytes, so it offers no confidentiality. Use a dedicated encryption tool when you need secrecy — this tool only does encoding conversion.
Keywords:data urlbinary to base64file to base64