How to encode text to Base64
- Type or paste your text into the left Plain text box, the encoder runs on every keystroke, so the Base64 appears in the right box instantly.
- Tick URL-safe if the result is headed for a URL, a filename, or a JWT segment, it swaps
+and/for-and_. - Press Copy output to grab the encoded string, or Sample to load an example with emoji and accents so you can see UTF-8 handling.
- Hit ⇄ Swap to flip the encoded text back into the input and confirm it decodes to exactly what you started with.
What Base64 encoding actually does
Base64 takes arbitrary bytes and re-expresses them using only 64 printable ASCII characters, A–Z, a–z, 0–9, plus + and /. It works by reading the input three bytes (24 bits) at a time and splitting those bits into four 6-bit groups, each of which maps to one output character. Because 3 input bytes become 4 output characters, encoded data is always about 33% larger than the original. When the input length isn't a multiple of three, one or two = characters are appended as padding. A quick concrete example: the text hello world encodes to aGVsbG8gd29ybGQ=, and the single letter M encodes to TQ==. That trailing = is a hallmark of Base64 in the wild.
Where developers reach for Base64 encoding
The point of encoding to Base64 is to move binary or awkward data through channels that only expect plain text. You will encode a user:password pair into an Authorization: Basic header; encode a small PNG or SVG into a data:image/png;base64,… URI so it ships inline with your CSS and saves an HTTP request; encode binary values into YAML, JSON, or Kubernetes Secrets that can't hold raw bytes; and encode attachments into the Base64 blocks you see in raw email (MIME) source. In every case the goal is the same, make bytes survive a text-only pipe intact.
Base64 is encoding, not encryption
This is the single most important thing to understand before you use the output: Base64 provides zero confidentiality. There is no key and no secret, the transformation is completely reversible by anyone, which is exactly what the Base64 Decode tool does in one click. Encoding a password to cGFzc3dvcmQ= hides it from nobody. Use Base64 to make data transportable, never to make it secret. If you need secrecy, encrypt first and then Base64-encode the ciphertext for transport.
Frequently asked questions
What is Base64 encoding used for?
It re-expresses binary or text data using only 64 safe ASCII characters so the data can pass through text-only channels. Everyday uses include HTTP Basic Auth headers, inline data: URIs for images and fonts, JWT header and payload segments, MIME email attachments, and binary values stored in YAML or Kubernetes Secrets.
Why is the encoded output longer than my input?
Base64 turns every 3 bytes of input into 4 output characters, so encoded data grows by roughly 33%. That overhead is the price of forcing binary through a text-only pipe, and it is why you should not Base64-encode large payloads when a binary transport is available.
What are the = signs at the end?
Padding. When the input length isn't a multiple of three, one or two = characters are added so the output length is a multiple of four. For example M encodes to TQ== and Ma encodes to TWE=.
Does this handle emoji and international characters?
Yes. Input is converted to UTF-8 bytes before encoding, so emoji, accents, Chinese, Arabic and any other Unicode text round-trips correctly, unlike a naive btoa() call, which throws a character-out-of-range error on anything above code point 255.
What is URL-safe Base64 and when should I tick it?
Standard Base64 uses + and /, which carry special meaning inside URLs and filenames. The URL-safe variant swaps them for - and _ so the string can live in a query parameter, a path, or a JWT segment without being re-encoded. Tick the box whenever the output lands in a URL.
Is Base64 encryption?
No. Base64 is a reversible encoding with no key, so anyone can decode it instantly, paste it into the Base64 Decode tool and see. Never rely on Base64 alone to protect a secret; encrypt the data first, then encode the ciphertext for transport.