Base64 Encoder & Decoder
Encode text to Base64 or decode Base64 strings - runs entirely in your browser.
Stays in your browser · Always freeThis free Base64 encoder and decoder converts plain text to Base64-encoded strings and back. It handles Unicode correctly by encoding to UTF-8 bytes first, so accented characters, emoji, and non-Latin scripts work as expected.
Common uses:
- Encode API credentials or tokens for use in HTTP Authorization headers
- Decode Base64 strings from API responses or JWT payloads
- Encode text for embedding in data URIs or configuration files
Base64 is a way of representing arbitrary binary or text data using only 64 printable ASCII characters. It's used everywhere developers need to ship data through systems that only understand plain text - HTTP headers, URL parameters, email attachments, JSON payloads. The encoder above handles UTF-8 correctly, so emoji and non-ASCII text round-trip cleanly. Base64 is encoding, not encryption - anyone can decode it instantly.
How Base64 works
Base64 takes the underlying bytes of your input and represents them using only the characters A–Z, a–z, 0–9, +, and /, with = as padding at the end. It does this by grouping every 3 input bytes (24 bits) into 4 output characters (each representing 6 bits - 26 = 64, hence the name).
If the input doesn't divide evenly into 3-byte groups, the last group is padded with = characters. That's why Base64 strings often end in one or two equals signs - a small giveaway that you're looking at Base64.
Size overhead: 33% larger than the input. 100 bytes of input → 136 characters of Base64 output. This is why Base64 is fine for small payloads (auth headers, tokens, small images) but expensive for large ones (full files in JSON).
URL-safe Base64 is a variant that swaps + and / for - and _ (which don't need URL escaping). JWTs use it. Standard Base64 and URL-safe Base64 are not interchangeable; tools usually default to standard.
Where you'll actually see Base64
The header Authorization: Basic <encoded> contains username:password Base64-encoded. admin:hunter2 becomes YWRtaW46aHVudGVyMg==. This is encoding, not encryption - Basic Auth is only safe over HTTPS.
A JWT is three Base64-encoded parts separated by dots. The first two parts (header and payload) are decodable by anyone - open one in this tool and you'll see the issuer, expiry, claims, etc. The third part is a signature that can't be forged without the secret.
data:image/png;base64,iVBORw0KGgo... embeds a binary image directly into HTML or CSS. Useful for tiny icons (avoids an extra HTTP request); wasteful for anything substantial because of the 33% size penalty.
Email was originally text-only. To attach binary files, MIME wraps them as Base64-encoded blobs. You'll never see this directly unless you're poking at raw email headers.
What is Base64 encoding?
When would I use Base64?
How do I decode a Base64 string?
Is Base64 the same as encryption?
Does this tool handle Unicode characters?
btoa() in JavaScript doesn't handle Unicode by default - this tool wraps it correctly.Why does my Base64 string end with one or two equals signs?
= to make the output length a multiple of 4.What's URL-safe Base64?
- and _ instead of + and / so the encoded string can be used in URLs without further escaping. JWTs use it. Standard and URL-safe variants are not interchangeable - pick the one your target system expects.