Base64 Encode / Decode
Encode plain text to Base64 or decode Base64 back to plain text. Auto-detects which direction. Browser-only — your text never leaves the page.
Hello World → SGVsbG8gV29ybGQ=
Encode plain text to Base64 or decode Base64 back to plain text. Auto-detects which direction. Browser-only — your text never leaves the page.
Hello World → SGVsbG8gV29ybGQ=
Base64 encodes binary data as ASCII text using a 64-character alphabet (A–Z, a–z, 0–9, +, /). It expands the input by ~33% but produces output that survives email, URLs, JSON, and any text-only transport.
This tool auto-detects direction: if the input looks like a valid Base64 string, it decodes; otherwise it encodes.
Base64 encoding maps binary data to a 64-character alphabet (A–Z, a–z, 0–9, +, /) as specified by RFC 4648. The input text is first encoded as UTF-8 bytes. These bytes are grouped into 24-bit blocks, each split into four 6-bit values (2^6 = 64) and mapped to the alphabet. If the last block has fewer than 24 bits, it is padded with zero bits and the output is padded with '=' characters to maintain a multiple of 4 characters. The tool auto-detects the operation: if the input matches the pattern of valid Base64 (alphabet characters and proper padding length), it attempts decoding; otherwise, it encodes. All processing occurs entirely in the browser using JavaScript's native btoa and atob functions, extended with a UTF-8 byte converter to handle non-ASCII characters.
Here's how this tool compares to common command-line and programming alternatives.
| This tool | Python base64 module | Node.js Buffer | |
|---|---|---|---|
| Input convenience | Paste-and-click, no setup | Requires writing a script | Requires Node.js runtime |
| UTF-8 handling | Automatic via browser | Manual encoding to bytes | Native support |
| Availability | Any modern browser, no install | Python environment needed | Node.js environment needed |
Base64 encoding was first introduced for electronic mail in the late 1980s as part of the MIME (Multipurpose Internet Mail Extensions) specification (RFC 1341, later RFC 2045). It was designed to transmit binary data reliably over text-only protocols like SMTP, which could corrupt non-ASCII characters. The name 'Base64' reflects its use of a 64-character alphabet. The encoding was later adopted in many other contexts, including data URIs, XML, and JSON Web Tokens (JWT).
data:image/png;base64,... URIs let you inline images directly in HTML or CSS. This tool encodes the bytes; paste them after the prefix.
Basic auth ("Authorization: Basic") expects a Base64-encoded "user:pass" string. Encode your credentials before pasting into a request header.
JSON Web Tokens are three Base64-encoded parts separated by dots. Decode the middle part to read the claims (header and signature work the same way).
Email attachments are Base64-encoded inside MIME parts. Pasting raw email source into the decoder reveals the original content.
Need to send binary content through a JSON API? Base64-encode it; decode on the receiving end.
No. It's encoding — anyone can decode it. It's for transport, not security. To secure data, encrypt before encoding.
Base64 output is padded to a multiple of 4 characters. = is the padding character — one or two are added as needed.
If the input is only Base64-alphabet characters and its length is a multiple of 4, the tool tries to decode. If decoding produces valid UTF-8, that wins. Otherwise it encodes.
Yes. The tool encodes UTF-8 bytes for non-ASCII input. Most other Base64 tools fail on emojis or accented letters; ours handles them correctly.