File to Base64
Drop any file and get its Base64 representation. Useful for embedding assets in CSS, HTML, or JSON config files.
Drop a file here
or click to browse
BASE64
Reads any file and outputs its raw Base64 representation, without the data URI prefix.
How it works
FileReader.readAsDataURL reads your file into memory and asks the browser to base64-encode its raw bytes, using the same algorithm as btoa(). The tool then strips the leading data: URI prefix to leave the bare Base64 string. Because the raw bytes are encoded directly (rather than text), the output works for any file type, including binary assets like fonts, audio, and images that you want to inline into HTML, CSS, or JSON config. The bytes are encoded unchanged, so any metadata in an image stays in the output.
Processing runs in your browser
All encoding and decoding happens inside your browser tab. Our servers are not involved at any point. You can confirm this yourself in your browser's DevTools Network tab.
Technical specification
Base64 is specified in RFC 4648 (IETF, 2006). The encoding groups every three input bytes (24 bits) into four 6-bit values, each mapped to a printable ASCII character from a 64-character alphabet (A–Z a–z 0–9 + /). If the input length is not divisible by 3, one or two = padding characters are appended. The URL-safe variant (RFC 4648 §5) replaces + with - and / with _, making it safe for use in URLs and HTTP headers without further percent-encoding. This tool decodes URL-safe input but always encodes with the standard alphabet, as data URIs do.
- Standard
- RFC 4648. The Base16, Base32, and Base64 Data Encodings
- Size overhead
- ~33% overhead (every 3 bytes becomes 4 characters)
- Alphabet (standard)
A–Z a–z 0–9 + /with=padding- Alphabet (URL-safe)
A–Z a–z 0–9 - _(used in JWTs; accepted when decoding)
Related operations
To compute SHA hashes of text or files, or MD5 of text, use the hash generator. For percent-encoding query strings or URL paths, try URL encode. To decode signed tokens that wrap Base64 payloads, see the JWT decoder.
Frequently asked questions
- What files can I convert?
- Any file your browser can read, images, PDFs, fonts, audio, and more.
- Is there a file size limit?
- Files up to 10 MB are accepted. A larger file is rejected with a message before it is read.
- Does it remove photo metadata?
- File to Base64 encodes the file's exact bytes, so a photo's metadata, such as EXIF (including GPS location and camera details), XMP and comments, stays in the output, and the tool notes it for images. Image to Data URI removes it by default from JPEG, PNG, WebP, and GIF files.
- Is the file uploaded?
- All processing runs in your browser. The conversion uses the FileReader API which reads the file into memory locally.
- How much larger is a Base64 string than the original file?
- Base64 expands data by roughly 33% because every three bytes are encoded as four ASCII characters. A 1 MB file becomes about 1.33 MB once encoded.
Last reviewed September 30, 2026
Other pages for this tool
Related tools
- Background reading: Complete guide to data tools