File to Base64 Converter
Drop a file and get its Base64 string or a data: URL you can paste into HTML, CSS, JSON or an API request.
Processed locally in your browser· Your data stays in your browser.
What is File to Base64 Converter?
Base64 turns raw bytes into printable text, which lets you embed a file inside a text-only format: an <img src="data:…"> tag, a CSS url(), a JSON field or an e-mail body. A data URL adds the MIME type in front: data:image/png;base64,iVBORw0…
This tool reads your file in chunks and encodes it locally, so nothing is uploaded. You can choose plain Base64 or a data URL (the MIME type comes from the file or from its magic bytes), wrap lines every 76 (MIME) or 64 (PEM) characters, or switch to the URL-safe alphabet. The result can be copied or downloaded as a text file.
How does it work?
- Drop a file (up to 50 MB) on the drop zone.
- Pick "Base64 text" or "data: URL" and, if needed, line breaks or the URL-safe alphabet.
- Copy the result or download it as a .txt file.
- To go back to a file, paste the text into the Base64 to File tool.
Common use cases
- Inlining a small icon or logo in HTML or CSS to save an HTTP request.
- Sending a PDF or image inside a JSON API payload that only accepts text.
- Embedding a font or image in an e-mail template or a single-file HTML page.
- Preparing test fixtures where a binary file must live in a source-code string.
Examples
Drop a file and get its Base64 string or a data: URL you can paste into HTML, CSS, JSON or an API request.
Privacy
File to Base64 Converter runs entirely in your browser. The text or files you provide are processed on your device and are not uploaded, logged or stored on our servers.
Limitations
Base64 makes data about 33% larger, so it suits small files; large data URLs slow down pages. Base64 is an encoding, not encryption. Files are limited to 50 MB in this tool.
Frequently asked questions
How much bigger does a file get in Base64?
About one third: every 3 bytes become 4 characters, so a 3 MB file becomes roughly 4 MB of text.
What is a data URL?
A URL that contains the file itself, written as data:<mime>;base64,<data>. Browsers can display it directly without a separate download.
When should I use the URL-safe option?
When the Base64 goes into a URL or file name: it replaces + and / by - and _ and drops the "=" padding. Regular data URLs need the standard alphabet.
Related tools
Base64 Decoder
Paste a Base64 string and read the original text instantly, even when the padding is missing.
Encoding & Decoding
Base64 to File Converter
Paste Base64 or a data URL, click decode, and download the original image, PDF, archive or any other file.
File Tools
Base64 Encoder
Convert any text, including emoji and accented characters, into a Base64 string in one click.
Encoding & Decoding
File Inspector
Drop a file to see what it really is: detected type, size, checksums, header bytes and warnings when the extension lies.
File Tools
Hex Viewer
Drop a file to see its raw bytes in the familiar offset | hex | ASCII layout, plus its detected type and size.
File Tools
Base64URL Encoder
Turn any text into a Base64URL string that can be pasted straight into a URL, a filename or a JWT segment.
Encoding & Decoding