Convert any file to a Base64 string. Works with documents, images, audio, archives, and any binary format. 100% client-side, no file upload to servers.
Drag & drop files here
or click to browse. Select multiple files at once. (max 50 MB each)
Base64 encoding converts arbitrary binary data into a text string using 64 printable ASCII characters. This tool reads any file from your device and produces the Base64 encoded output, which you can use in API payloads, database storage, configuration files, or any context that requires text safe data.
Many protocols and formats only support text: JSON, XML, YAML, email (SMTP), URL parameters, HTML attributes. Base64 encoding makes any binary file safe to include in these contexts without corruption.
Instead of multipart form data (which requires boundary handling and content-disposition headers), Base64 lets you include file data in a regular JSON field:
{
"file": "UEsDBBQAAAAIAM1Y...",
"filename": "archive.zip",
"contentType": "application/zip"
}
Base64 data URIs create documents that carry their resources inline. A single HTML file can contain all its images, fonts, and even embedded PDFs without external dependencies.
Tools like Kubernetes secrets, CI/CD pipelines, and cloud configuration often store binary data (certificates, keys, license files) as Base64 encoded strings in YAML or JSON config files.
This tool automatically detects the file’s MIME type from its content signature (magic bytes), not just the file extension. For example:
| File signature | MIME type | Example |
|---|---|---|
%PDF |
application/pdf | PDF documents |
PK (ZIP header) |
application/zip | ZIP archives, DOCX, XLSX |
\x89PNG |
image/png | PNG images |
\xFF\xD8\xFF |
image/jpeg | JPEG images |
ID3 |
audio/mpeg | MP3 audio |
If the signature is not recognized, the tool uses the MIME type reported by the browser’s file picker, falling back to application/octet-stream.
const reader = new FileReader();
reader.onload = () => {
const base64 = reader.result.split(',')[1];
};
reader.readAsDataURL(file);
import base64
with open('file.bin', 'rb') as f:
encoded = base64.b64encode(f.read()).decode('ascii')
base64 < file.bin # macOS
base64 -w 0 < file.bin # Linux (no line wrapping)
data, _ := os.ReadFile("file.bin")
encoded := base64.StdEncoding.EncodeToString(data)
byte[] bytes = Files.readAllBytes(Path.of("file.bin"));
String encoded = Base64.getEncoder().encodeToString(bytes);
Base64 increases data size by exactly 4/3 (33.3%). This is because every 3 input bytes produce 4 output characters. With padding, the formula is:
output_length = 4 * ceil(input_length / 3)
| File size | Base64 size | Overhead |
|---|---|---|
| 1 KB | 1.33 KB | +0.33 KB |
| 100 KB | 133 KB | +33 KB |
| 1 MB | 1.33 MB | +0.33 MB |
| 10 MB | 13.3 MB | +3.3 MB |
When transmitted over HTTP with gzip/brotli compression, Base64 text compresses poorly (it has high entropy). The effective overhead compared to sending the raw binary is closer to 37-40% after compression.
If you’re sending Base64 encoded files in API requests, watch out for request size limits:
| Platform | Limit | Max raw file |
|---|---|---|
| Vercel (serverless) | 4.5 MB body | ~3.4 MB |
| AWS Lambda | 6 MB sync | ~4.5 MB |
| AWS API Gateway | 10 MB | ~7.5 MB |
| Cloudflare Workers | 100 MB | ~75 MB |
| Express.js (default) | No limit* | — |
*Express has no default body size limit, but reverse proxies (nginx: 1 MB default) and load balancers often impose their own. Always check the full request path.
When the Base64 payload exceeds the limit, use multipart form data, upload to object storage (S3, R2, GCS), or pass a reference URL instead.
For image specific conversion, see Image to Base64. For PDF files, see PDF to Base64. To reverse the process, use Base64 to File. For text only encoding, the main Base64 Encoder is simpler.
Nothing you paste leaves this tab. Every tool runs entirely in your browser — no upload, no server, no account.