String Functions
Base 64 Encoder
Encode any string to Base-64. UTF-8 safe — multi-byte characters and emoji round-trip cleanly.
About Base64 encoding
This tool converts any text into Base64, an encoding that represents arbitrary bytes using only 64 printable ASCII characters (A-Z, a-z, 0-9, +, /) plus = for padding. It doesn't compress or scramble anything — it just re-represents the same bytes in a form that's safe to drop into contexts that only tolerate plain ASCII text. Paste any string, including emoji and accented characters, and the encoded result appears as you type.
Under the hood, the input is first run through TextEncoder to get its raw UTF-8 bytes, then passed to the browser's built-in btoa() in chunks of 32,768 bytes to sidestep a call-stack error on very large inputs. That extra step matters: calling btoa() directly on a JavaScript string throws on any character outside the Latin-1 range, which is why naive btoa(text) snippets break on accented letters or emoji. Going through UTF-8 bytes first avoids that, so encoding and then decoding a string here reproduces it exactly, multi-byte characters included.
Reach for this when you need to embed binary-unsafe data inside a text-only context: building a Basic Auth header (Authorization: Basic <base64>), storing a small blob inside a JSON or XML field, or passing a payload through a system that only accepts printable ASCII. For encoding actual image files, use the dedicated Image to Base64 tool — this one works on pasted text. Everything here runs in your browser; nothing you paste is sent to a server, so it's safe to use on tokens, credentials, or other sensitive strings.
Examples
Input: Hello, World!
Output: SGVsbG8sIFdvcmxkIQ==Base64 always expands size — 3 input bytes become 4 output characters, roughly 33% overhead. This 13-byte string becomes 20 Base64 characters; the trailing == is padding.
Input: Encode me to Base64! 🚀
Output: RW5jb2RlIG1lIHRvIEJhc2U2NCEg8J+agA==The 🚀 alone is 4 UTF-8 bytes. Because the tool encodes the UTF-8 byte sequence rather than JavaScript's internal string representation, decoding this output reproduces the original text exactly.
// Browser — same technique this tool uses internally
const bytes = new TextEncoder().encode(str);
btoa(String.fromCharCode(...bytes));
// Node.js
Buffer.from(str, "utf-8").toString("base64");PHP's base64_encode($str) gives identical output for a UTF-8-encoded source string — all three operate on the same underlying bytes, just through different APIs.
Frequently asked questions
Does Base64 encode or encrypt data?
No. Base64 only re-represents data — it doesn't scramble, compress, or protect it. Anyone can decode it back to the original text with no key required, so use real encryption, such as AES, if you need confidentiality.
Why does the output end with = or ==?
Base64 packs 3 input bytes into 4 output characters. When the input length isn't a multiple of 3 bytes, one or two = characters are appended so the output still ends on a full 4-character group — one = for a remainder of 2 bytes, two (==) for a remainder of 1 byte.
Is this the same encoding used in JWTs and URLs?
No. JWTs and URL-safe contexts use Base64URL (RFC 4648 section 5), which swaps + and / for - and _ and usually drops the = padding. This tool produces standard Base64, so you'd need that substitution before using its output as a JWT segment or inside a URL.
Will special characters, accents, or emoji break the encoding?
No — the tool converts text to UTF-8 bytes with TextEncoder before encoding, so accented letters, emoji, and other multi-byte characters round-trip losslessly. A naive btoa(text) call skips that conversion and throws on any character outside the Latin-1 range, which is a common bug in hand-rolled encoders.
Is there a limit on how much text I can encode?
No hard limit. The tool processes input in 32,768-byte chunks internally to avoid the call stack size exceeded error a naive one-shot implementation hits on very large strings, so multi-megabyte pastes still encode correctly — just a little slower to render.