Base64 File Encoder and Data URI Generator
Drop in any file to convert its bytes to standard Base64 and a ready-to-paste data URI. Useful for embedding small images, fonts, or assets straight into HTML, CSS, or JSON without a separate request. The file is read entirely in your browser and never uploaded.
How to encode a file to Base64
- Drag a file onto the box, or click browse to pick one.
- Copy the raw Base64 string, or the full data: URI, with one click.
- Paste it into your HTML, CSS, JSON, or wherever you need an inline asset.
Examples
A small PNG icon
icon.png (a 2 KB image)
data:image/png;base64,iVBORw0KGgo... (about 2.7 KB of text)
Frequently asked questions
Is my file uploaded anywhere?
No. The file is read and encoded entirely in your browser using JavaScript. Nothing is sent to a server, so even private files stay on your device.
How does Base64 encoding work?
Base64 maps every 3 bytes of binary data to 4 printable characters drawn from a 64-character alphabet. A final partial group is padded with '=' so the length is always a multiple of 4. That lets binary data travel safely through text-only channels.
What is a data URI and when should I use it?
A data URI embeds a file's bytes directly in a string like data:image/png;base64,.... You can drop it into an img src, a CSS background, or JSON to avoid a separate network request. It works best for small assets, since Base64 adds about a third to the size.
Why is the Base64 output larger than my file?
Base64 uses 4 characters for every 3 bytes, so encoded output is roughly 33 percent larger than the original. The tool shows the size before and after so you can decide whether inlining is worth it.
Does it work on images, fonts, and binary files?
Yes. It reads the raw bytes of any file type, so images, fonts, PDFs, and arbitrary binaries all encode correctly. The data URI uses the file's own MIME type when the browser reports one.
Related tools
Base64 Encode
Encode text to Base64 online. UTF-8 safe, handles emoji and accents, with an optional URL-safe (base64url) mode. Runs in your browser, nothing uploaded.
Data URI Generator
Turn text, SVG or HTML into a data: URI. Pick base64 or compact URL encoding and copy ready-made CSS background and HTML img snippets. Runs in your browser.
File Hash Generator
Drop in a file to get its SHA-1, SHA-256, SHA-384 and SHA-512 checksums. Compare against an expected hash. Runs in your browser, the file never uploads.
CBOR Decoder
Decode a CBOR file (RFC 8949) to readable JSON in your browser. Handles integers, byte strings, arrays, maps, tags, and floats. Nothing is uploaded.
CSV File Inspector
Inspect a CSV file in your browser: detect the delimiter, encoding and BOM, count rows and columns, guess the header, and preview sample rows. Private.
ELF Header Inspector
Drop a Linux or Unix binary to read its ELF header: 32 or 64-bit, endianness, file type, CPU architecture, OS ABI and entry point. Runs in your browser.