Encode or decode Base64
Encode text to Base64 or decode Base64 back to text, UTF-8 safe, with a URL-safe option.
0 / 2,000,000 characters · Updates as you type.
How it works
Base64 turns any bytes into 64 printable ASCII characters so they survive systems that only handle text: email bodies, JSON fields, HTTP headers, data URLs. Every three bytes become four characters, so the encoded form is about 33% larger than the original.
The classic browser functions btoa and atob only work on Latin-1 characters and throw on anything else. This tool encodes the text as UTF-8 first, so Arabic, Chinese, emoji and accented letters round-trip correctly. The URL-safe variant (RFC 4648 section 5) swaps + and / for - and _ and drops the trailing = padding; it is what JWTs, OAuth state parameters and many APIs use. Decoding accepts either alphabet, with or without padding, and ignores whitespace.
How much bigger Base64 makes data
Every 3 bytes become 4 characters, plus padding; MIME email wraps the result with a line break every 76 characters.
- Data URLs: a 100 KB image embedded as data:image/png;base64,... adds about 133 KB to the HTML or CSS, and it cannot be cached separately.
- Email: attachments travel as MIME Base64, which is why a 25 MB attachment limit fits only about 18 MB of files.
- JSON and APIs: binary fields (images, PDFs, keys) are often Base64 strings; use the URL-safe alphabet if the value goes into a URL.
| Original | Base64 (one line) | With MIME line breaks |
|---|---|---|
| 100 bytes | 136 bytes | 138 bytes |
| 1.0 KB | 1.3 KB | 1.4 KB |
| 10.0 KB | 13.3 KB | 13.7 KB |
| 100.0 KB | 133.3 KB | 136.8 KB |
| 1.00 MB | 1.33 MB | 1.37 MB |
| 5.00 MB | 6.67 MB | 6.84 MB |
How to use it
- Choose the direction: encode text to Base64, or decode Base64 back to text.
- Paste your input. The result updates as you type.
- For encoding, turn on URL-safe if the value goes into a URL or a JWT.
- Copy the output or download it as a text file.
Frequently asked questions
Is Base64 encryption?
No. Anyone can decode it instantly; it hides nothing. Use it only for transport, never to protect secrets.
Why does decoding show strange characters?
The Base64 probably encodes binary data (an image, a compressed file) rather than text, or text in an encoding other than UTF-8. Bytes that are not valid UTF-8 are shown as replacement characters.
Can I decode a data URL?
Paste only the part after the comma (after "base64,"). The prefix "data:image/png;base64," is not Base64 and will be rejected.
What about line breaks every 76 characters?
MIME-style Base64 wraps lines at 76 characters. The decoder ignores all whitespace, so wrapped input works. The encoder produces a single line.
Related tools
- URL Encode / DecodePercent-encode text for URLs (encodeURIComponent or encodeURI) or decode an encoded string.
- JWT DecoderDecode a JSON Web Token's header and payload and see whether it has expired. Signature is not verified; the token stays in your browser.
- JSON FormatterPretty-print or minify JSON with 2-space, 4-space or tab indentation and optional key sorting.
- UUID GeneratorGenerate 1 to 100 random UUID v4 or time-ordered UUID v7 identifiers with crypto-grade randomness.
- QR Code GeneratorTurn a URL or text into a QR code and download it as PNG or SVG. Generated locally; nothing is uploaded.