inyourbrowser.com

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

File → Base64

Reads any file and outputs its raw Base64 representation, without the data URI prefix.

Runs entirely in your browser

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.

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 yourselfin 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.

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, data URIs)

Related operations

To compute MD5 or SHA hashes from text or files, 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?
There's no hard limit, but very large files (100 MB+) may slow down the browser.
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.

Related tools

URL encode / decode
Percent-encode and decode URLs, or parse query strings into key-value pairs.
Hash generator
Generate SHA-256, SHA-512, SHA-1, and MD5 hashes. Verify file checksums locally.
Image to Base64
Convert any image to a Base64 data URI. Copy directly into HTML, CSS, or JSON.
JWT decoder
Decode JWT header and payload instantly. All inspection runs in your browser.
Password generator
Generate random, strong, or memorable passwords using your browser's crypto API.