What is Base64?
Base64 is an encoding scheme that represents binary or text data using 64 printable ASCII characters: uppercase letters A–Z, lowercase letters a–z, digits 0–9, +, and /. A padding character = is added to ensure the output length is a multiple of four.
Every three bytes of input produce four Base64 characters, which means Base64 output is always roughly 33% larger than the original.
Common Uses of Base64
Base64 is used wherever binary data needs to be stored or transmitted in a text-only format:
- HTML data URIs:
<img src="data:image/png;base64,..."> - HTTP Basic Authentication headers:
Authorization: Basic dXNlcjpwYXNz - Email attachments (MIME encoding)
- Embedding fonts in CSS with
@font-face - JSON payloads that include binary files or images
- Cryptographic keys and certificates (PEM format uses Base64)
- JWT tokens — the header and payload sections are Base64url-encoded
Base64 and Unicode
The browser’s native btoa() function only handles ASCII and Latin-1 characters and throws a DOMException for any character outside that range. This tool handles the full Unicode range by:
- Converting your text to UTF-8 bytes using
TextEncoder - Feeding those bytes into
btoa()as a binary string - On decode: running
atob(), then interpreting the binary as UTF-8 withTextDecoder
This means emoji, Chinese, Arabic, Greek, and any other Unicode text can be safely encoded and decoded.
Standard vs. URL-safe Base64
Standard Base64 uses + and /, which have special meaning in URLs and query strings. URL-safe Base64 (also called Base64url, defined in RFC 4648 §5) replaces these characters and removes padding:
| Standard Base64 | URL-safe Base64 |
|---|---|
+ | - |
/ | _ |
= (padding) | omitted |
Use URL-safe Base64 when embedding Base64 in URLs, query parameters, filenames, or JWT tokens.
Base64 Encoding Examples
| Original text | Base64 output |
|---|---|
Hello | SGVsbG8= |
Hello World | SGVsbG8gV29ybGQ= |
1234567890 | MTIzNDU2Nzg5MA== |
café | Y2Fmw6k= |
How to Use This Tool
- Paste your text or Base64 string into the input box.
- Click Encode to convert plain text to Base64.
- Click Decode to convert a Base64 string back to plain text.
- Enable URL-safe Base64 to use
-and_instead of+and/. - Click Copy to copy the result to your clipboard.
The tool encodes live as you type, so you see the result instantly.
Privacy and Security
All encoding and decoding happens entirely in your browser using built-in JavaScript APIs (btoa, atob, TextEncoder, TextDecoder). Your data is never sent to any server, stored, logged, or shared. You can use this tool offline once the page has loaded.
Important: Base64 is not encryption. Anyone who receives a Base64-encoded string can decode it instantly. Never use Base64 to protect sensitive data.