Base64 Encode/Decode
Convert text to and from Base64 encoding. Supports Unicode characters.
About Base64 encoding
Base64 is a way to represent arbitrary binary data using only the 64 printable ASCII characters A–Z, a–z, 0–9, +, and /, plus = for padding. It exists because a lot of older protocols and formats — email headers, JSON strings, URLs, XML, HTTP cookies — were never designed to carry raw bytes safely. If you try to drop a PNG or a UTF-8 string with control characters into one of those, things break in ugly, intermittent ways. Base64 dodges that by encoding three bytes of input into four ASCII characters of output, at a fixed 33% size cost.
The tool above runs entirely in your browser. Nothing is uploaded, nothing is logged. It uses the browser's built-in btoa and atob, wrapped in a small Unicode shim so multi-byte characters (emoji, accented letters, Asian scripts) round-trip correctly — the naive version of btoa chokes on those.
When you'd actually use it
- Embedding small binary blobs in text. A 2 KB SVG icon as a data URI inside a CSS file, a small image inline in an email, a config token pasted into JSON.
- Basic Auth headers. The
Authorization: Basic ...header is justusername:passwordBase64-encoded. (Note: this is not encryption. Anyone who sees the header can decode it.) - JWTs. The three segments of a JWT are Base64URL-encoded JSON. If you're debugging one, decode each segment to see the header and claims.
- Decoding things you found in logs. If you've ever seen a long string of letters and numbers ending in
==, it's probably Base64. Pasting it here is the fastest way to find out what's inside. - Sending binary over a chat channel — Slack, Discord, SMS — without the recipient's client mangling it.
Things to know
It's not encryption
This trips people up. Base64 is fully reversible with no key. Anyone who sees the encoded string can decode it in one step. If you need to keep something secret, use real encryption (AES, age, libsodium); Base64 is just a transport format.
Padding and the = sign
Because Base64 packs three bytes into four characters, inputs whose length isn't a multiple of three need padding. One byte left over → two padding chars (==); two bytes left over → one (=); a clean multiple of three → no padding. Some implementations strip padding to save bytes; this tool restores it automatically when decoding.
Standard Base64 vs. Base64URL
Standard Base64 uses + and /, which break things in URLs and filenames. Base64URL swaps those for - and _. JWTs, JSON Web Keys, and most modern web specs use Base64URL. If decoding fails, try replacing - with + and _ with / first.
Line breaks
The original MIME spec wraps Base64 at 76 characters per line. Some sources still produce wrapped output; some require it. This tool strips whitespace before decoding, so wrapped input works fine.
Quick examples
Encoding the string hello gives aGVsbG8=. The single trailing = tells you the input was 5 bytes (one byte short of a multiple of three).
Encoding the emoji 👋 — a four-byte UTF-8 sequence — gives 8J+Riw==. The two == mean four bytes of input. If a tool returns garbled output for emoji, it's almost certainly using the legacy non-Unicode path.
Keyboard shortcuts
Ctrl/Cmd + Enter— encodeCtrl/Cmd + Shift + Enter— decode