Base64 Encode / Decode
Encode any text — including Unicode and emoji — to Base64, or decode Base64 strings back to UTF-8. Runs 100% in your browser.
+ → - and / → _Type or paste any text above to encode it as Base64.
What Is Base64 Encoding?
Base64 is an encoding scheme designed to represent binary data — or arbitrary text — using only
64 printable ASCII characters: the uppercase and lowercase English alphabet, the digits 0–9,
and the characters + and / (or - and _ in
the URL-safe variant). The output always ends with zero, one, or two = padding
characters to align it to a 4-character boundary. Despite its name referring to the alphabet
size, Base64 is not a numeral system — it is a binary-to-text transformation.
The scheme was standardised in RFC 2045 (for MIME email attachments) and extended in RFC 4648
to cover URL-safe and filesystem-safe variants. Today it appears everywhere: embedding images
as data URIs in HTML and CSS, transmitting binary API payloads as JSON strings, encoding
credentials in HTTP Authorization: Basic headers, carrying JWT tokens in cookies
or query parameters, and storing cryptographic keys and certificates in PEM files.
How to Use This Tool
Paste or type any text into the Encode tab and the Base64 output appears instantly. Switch to the Decode tab to reverse the process — paste a Base64 string and get the original text back. The tool automatically detects when what you pasted looks like Base64 in the wrong tab and offers a one-click switch.
Toggle URL-safe Base64 to replace the standard + and
/ characters with - and _. Use this when the encoded
string will appear in a URL, filename, or cookie value where the standard characters would
need to be percent-encoded.
Supported Input — Including Unicode
A common pitfall with Base64 tools is incorrect handling of non-ASCII text. The native browser
function btoa() only accepts Latin-1 strings; passing an emoji or a Chinese
character throws a InvalidCharacterError. This tool avoids the problem by first
converting your text to UTF-8 bytes using the browser's
TextEncoder API, then encoding those bytes. Decoding runs in reverse with
TextDecoder. As a result:
- Accented characters — café, naïve, résumé — encode and decode correctly.
- Emoji like 🚀, ✓, and 🔐 round-trip without any data loss.
- Chinese, Arabic, Cyrillic, and all other Unicode scripts are supported.
- Newlines, tabs, and control characters are preserved as-is.
Common Developer Use Cases
Beyond copying encoded strings for manual inspection, developers reach for Base64 when they need to embed a small image directly in a CSS stylesheet to eliminate an HTTP request, when an API requires binary attachments sent as a JSON string, or when debugging a JWT whose header and payload are Base64url-encoded. Pasting a token here instantly reveals the JSON claims inside — though for full JWT debugging including signature verification, a dedicated JWT decoder is a better choice.
Privacy Note
This tool runs entirely in your browser. The encoding and decoding logic uses only standard
browser APIs — TextEncoder, TextDecoder, btoa, and
atob — with no external libraries and no network requests. Text you paste here
never leaves your device.
Frequently Asked Questions
What is Base64 and why is it used?↓
Base64 is an encoding scheme that converts binary data — or any text — into a string of 64 printable ASCII characters (A–Z, a–z, 0–9, +, /). It was invented to safely transport binary data through channels that only handle text, such as email (MIME), JSON APIs, HTML data URIs, and HTTP Authorization headers. It is not encryption; it is purely a representation format and can be decoded by anyone.
What is the difference between standard Base64 and URL-safe Base64?↓
Standard Base64 uses the characters + and /, which have special meaning in URLs and query strings. URL-safe Base64 (RFC 4648 §5) replaces + with - and / with _ so the encoded string can be included in a URL without percent-encoding. Both variants can be decoded with the same algorithm once you convert the characters back. Toggle the "URL-safe" switch in this tool to switch between them.
Why does my Base64 string end with = or ==?↓
Base64 works in groups of 3 bytes (24 bits), encoding them as 4 ASCII characters. If the input length is not a multiple of 3, one or two padding characters (=) are appended to make the output a multiple of 4 characters. One = means one byte of padding was added; == means two bytes. You can safely strip padding when decoding — this tool adds it back automatically.
Does Base64 increase file size?↓
Yes. Base64 increases the encoded size by approximately 33%. Every 3 bytes of input becomes 4 characters of output. This is the trade-off for portability. For large binary files like images, consider using a data URI only when embedding is truly necessary, and prefer native binary formats for storage or transfer.
Can this tool handle emoji and non-English characters?↓
Yes. This tool uses the browser's built-in TextEncoder and TextDecoder APIs to convert text to UTF-8 bytes before encoding, and back to Unicode text after decoding. Characters like ✓, café, 中文, and 🚀 all round-trip correctly. Many older Base64 tools fail on multi-byte characters because they use btoa() directly on the string without the UTF-8 conversion step.
Is my data sent to a server when I use this tool?↓
No. All encoding and decoding happens inside your browser using JavaScript. Nothing you type or paste is transmitted over the network. You can even use this tool offline after the page has loaded — the logic requires no server connection whatsoever.