CalcCafe

Base64 Encode / Decode

Convert text to Base64 or decode Base64 back to text, with correct UTF-8 handling for emoji and accented characters.

Base64 output
INPUT CHARS
-
OUTPUT CHARS
-
STATUS
-

Encoding converts text to UTF-8 bytes first, so emoji and accents work correctly.

Example

Encoding the text Hi 👋 (UTF-8) produces SGkg8J+Riw==. Decoding SGkg8J+Riw== returns Hi 👋 exactly, with the emoji preserved.

How it works

Encoding maps each byte of the UTF-8 text to 6-bit groups represented by the 64-character alphabet (A-Z, a-z, 0-9, +, /). Unicode is handled by converting text to UTF-8 bytes with TextEncoder before btoa, and decoding bytes with TextDecoder after atob, so multi-byte characters survive the round trip.

Good to know

This Base64 Encode / Decode tool converts plain text into a Base64 string and turns Base64 back into readable text, all without anything leaving your browser. Because it converts your text to UTF-8 bytes before encoding (and decodes the bytes back to UTF-8 afterward), it handles emoji, accented letters, and other multi-byte characters that break the browser's raw btoa() function. It's handy for developers, sysadmins, and anyone who needs to inspect or hand-craft Base64 that shows up in tokens, config files, data URIs, or API payloads.

Reach for it whenever you need to embed text where binary-unsafe characters cause trouble: pasting a value into a JSON or YAML field, building a small data: URI, decoding the readable middle section of a JWT, or checking a Base64 blob someone sent you. Switch between Encode and Decode with the toggle, and use "Use output as input" to chain operations, for example to confirm a string survives a full encode-then-decode round trip.

Read the result by checking the STATUS badge alongside the output. "OK" means the conversion succeeded; "Invalid Base64" means the input couldn't be decoded; and "Ready" simply means the input box is empty. The INPUT CHARS and OUTPUT CHARS counters let you see size changes at a glance, since encoding typically inflates length by roughly one-third (every 3 bytes become 4 Base64 characters, plus any = padding).

A few practical notes: Base64 is an encoding, not encryption, so it provides zero secrecy and anyone can decode it instantly. This tool uses the standard alphabet with + and /, which differs from the URL-safe variant that uses - and _, so a string copied from a URL-safe context may not decode here as-is. Whitespace and line breaks in the input are ignored during decoding, so wrapped or pretty-printed Base64 still works.

Frequently asked questions

Why does this handle emoji and accents when plain btoa() fails?
The raw btoa() function only accepts characters in the Latin-1 range and throws on emoji or many accented letters. This tool first converts your text to UTF-8 bytes with TextEncoder, then Base64-encodes those bytes, so any Unicode character round-trips correctly.
Why am I getting an 'Invalid Base64' status when decoding?
Decoding fails if the input contains characters outside the Base64 alphabet (A-Z, a-z, 0-9, +, /, =) or has an incorrect length/padding. Whitespace is ignored automatically, but stray characters or truncated strings will trigger the error.
Is my data uploaded anywhere?
No — this calculator runs entirely in your browser. Your inputs never leave your device, and it works offline once loaded.
Is this calculator free?
Yes, completely free with no sign-up and no limits.

People also ask

What is Base64 encoding used for?
Base64 represents binary or text data using only 64 printable ASCII characters, so it can safely travel through channels built for text, such as email, JSON fields, XML, URLs, and HTTP headers. Common uses include embedding small images as data URIs, encoding email attachments, and carrying the payload of tokens.
Does Base64 make my data secure or encrypted?
No. Base64 is a reversible encoding with no key and no secrecy, and anyone can decode it instantly. It should never be used to hide passwords or sensitive information; use real encryption for that.
Why is my Base64 output longer than the original text?
Base64 turns every 3 bytes of input into 4 output characters, so the encoded result is about 33% larger than the original, before any padding. Short inputs may grow even more proportionally because of the trailing equals-sign padding.
What do the equals signs at the end of a Base64 string mean?
The = characters are padding added so the output length is a multiple of four. One = means the original data ended with two leftover bytes, and == means it ended with one leftover byte.
What is the difference between standard and URL-safe Base64?
Standard Base64 uses + and / as its last two characters, while URL-safe Base64 replaces them with - and _ so the string can be placed in URLs and filenames without escaping. URL-safe variants also often omit the = padding. This tool uses the standard alphabet.
Can I decode a JWT with a Base64 decoder?
You can decode the header and payload sections of a JWT, which are Base64URL-encoded JSON separated by dots, though you may need to convert the URL-safe characters and re-add padding first. The signature is not human-readable text and verifying it requires the signing key.
Is Base64 the same as ASCII or UTF-8?
No. ASCII and UTF-8 are character encodings that map characters to bytes, while Base64 is a scheme for representing arbitrary bytes as printable text. This tool first turns your text into UTF-8 bytes and then applies Base64 to those bytes.
Will Base64 encoding work offline?
Yes. Encoding and decoding happen entirely in your browser using built-in functions, so once the page has loaded it continues to work without an internet connection and your input is never sent to a server.

Related calculators