Base64 Encoder/Decoder
Type or paste text, then encode or decode. Unicode and emoji work correctly — nothing you enter leaves your browser.
Unicode-correct Base64, not just ASCII
Base64 encodes bytes, not characters, so the first step for text
is turning your string into bytes — and that's exactly where
naive implementations break. This tool uses TextEncoder to convert your text into its correct
UTF-8 byte sequence before Base64-encoding it, and TextDecoder to reverse that on the way back. The
common shortcut, plain btoa(text), assumes one byte
per character (Latin-1) and breaks the moment you type an
accented letter, a Greek character, or an emoji — this tool
doesn't have that problem.
Worked example
Encoding café ☕ 日本語 (accents, an emoji, and
Japanese kanji together) produces exactly:
Y2Fmw6kg4piVIOaXpeacrOiqng==
Decoding that string returns café ☕ 日本語 exactly —
every character intact. Feed the same input through btoa() directly and it throws an error, because ☕
and 日本語 fall outside Latin-1.
Frequently asked questions
What is Base64 actually for?
Base64 turns arbitrary bytes into a string of letters, digits, +, /, and = — an alphabet safe to put anywhere plain text is expected. That matters because plenty of formats can't carry raw binary: email (MIME attachments are Base64-encoded), data URIs (embedding a small image directly in CSS or HTML as data:image/png;base64,...), and JSON or XML fields that need to carry binary-ish content without breaking the surrounding syntax.
Why do emoji and accents break some Base64 encoders?
JavaScript's built-in btoa() assumes every character fits in one Latin-1 byte (0–255) and throws or corrupts anything outside that range — so é, ☕, and 日本語 either error out or turn into garbage. Text in JavaScript is UTF-16 internally but almost always meant as UTF-8 on the wire, where those same characters take 2–4 bytes each. This tool encodes with TextEncoder first (turning your string into correct UTF-8 bytes), then Base64-encodes those bytes — so anything btoa() alone would mangle comes out right.
Is Base64 encryption or a security measure?
No — this is important. Base64 is an encoding, not a cipher. It has no key, no secret, and anyone can decode it instantly with any online tool or a single line of code. If you see credentials or tokens 'protected' by Base64, they are not protected at all; treat Base64 purely as a text-safety format, never as a way to hide or secure information.
Can I encode files with this tool?
Not currently — this tool works on text you type or paste, not file uploads. Encoding a file's raw bytes to Base64 (as browsers do internally for data URIs) is a related but different job that this tool doesn't perform.