Base64 Encoder & Decoder
Convert text and files to Base64 and back. Handles emoji and every language correctly with UTF-8, supports URL-safe Base64URL, and turns files into data URIs.
Converter
Drop a file or click to browse
Images, fonts, PDFs, anything up to 25 MB
How to encode or decode Base64
Choose Encode or Decode
Encoding turns text into Base64; decoding turns Base64 back into readable text. Results update as you type.
Pick the variant
Turn on Base64URL for JWTs, URLs and filenames. Turn on 76-character wrapping for email (MIME) and PEM-style output.
Work with files
Use File → Base64 to embed images or fonts as data URIs, and Base64 → File to turn a pasted string back into a downloadable file.
What is Base64?
Base64 represents binary data using 64 printable ASCII characters (A–Z, a–z, 0–9, + and /). Every 3 bytes become 4 characters, so encoded data is about 33% larger than the original. It exists so binary data can travel safely through systems built for text: email, JSON, HTML attributes, HTTP headers and URLs.
Base64 vs Base64URL
| Base64 (RFC 4648 §4) | Base64URL (RFC 4648 §5) | |
|---|---|---|
| Characters 62 and 63 | + and / | - and _ |
| Padding | = to a multiple of 4 | Usually omitted |
| Used in | Email, data URIs, PEM, Basic auth | JWTs, URLs, filenames, WebAuthn |
Base64 is encoding, not encryption
Anyone can decode Base64 — it provides no secrecy. Never use it to “hide” passwords or API keys. If you need confidentiality, use real encryption; if you need integrity, use a hash or signature.
Command-line equivalents
echo -n 'hello' | base64 # aGVsbG8=
echo 'aGVsbG8=' | base64 --decode # hello
base64 -i image.png -o image.b64 # macOS file encode
certutil -encode in.bin out.b64 # WindowsFrequently asked questions
Is my data uploaded when I encode or decode?
No. Encoding and decoding run entirely in your browser with JavaScript. Text and files never leave your device.
Why does btoa() fail with emoji or accented characters?
The browser’s btoa() only accepts Latin-1 characters. This tool first encodes text as UTF-8 bytes with TextEncoder, then Base64-encodes the bytes, so every language and emoji round-trips correctly.
How do I convert an image to Base64?
Open the File → Base64 tab and drop your image. Copy the data URI (for an <img src>), the raw Base64, or a ready-to-paste CSS url() value.
Why is my decoded output garbled?
The Base64 probably encodes binary data (an image, PDF or compressed file) rather than text. Use the Base64 → File tab to download it — the file type is detected automatically from its signature.
Do I need the = padding at the end?
Padding makes the length a multiple of 4. Many decoders, including this one, accept Base64 with or without it. Base64URL usually omits it.