HandyBench

Base64 Encoder & Decoder

Encode and decode Base64 instantly.

How to use the Base64 Encoder & Decoder

  1. 1 Paste text or Base64 into the box.
  2. 2 Choose encode or decode.
  3. 3 Copy the result.

How Base64 works

Base64, specified in RFC 4648, turns arbitrary bytes into text that uses only 64 safe characters: A-Z, a-z, 0-9, + and /. It works on groups of three bytes (24 bits) at a time, splitting them into four 6-bit values, and each value indexes into that 64-character alphabet. Because three bytes become four characters, the output is about 33% larger than the input.

If the input length is not a multiple of three, the final group is padded with = so that the output is always a multiple of four characters.

Worked example

InputBytesBase64
Man3TWFu
Ma2TWE=
M1TQ==
Hello, World!13SGVsbG8sIFdvcmxkIQ==
café ☕9 (UTF-8)Y2Fmw6kg4piV

The last row shows why encoding is not just about letters. The text is first converted to UTF-8 bytes (é takes two bytes and ☕ takes three), and Base64 encodes those bytes. This tool does that conversion before encoding and reverses it when decoding, so accents and emoji round-trip correctly. The browser's bare btoa function would throw an error on them.

What this tool accepts

It uses the standard alphabet from section 4 of the RFC. The URL-safe variant in section 5 replaces + and / with - and _, and is what JWTs use. If you paste URL-safe text and see "Input is not valid Base64", swap those two characters back first, or use the JWT decoder for tokens. Surrounding whitespace is trimmed before decoding. The tool does not insert line breaks every 76 characters, which MIME email (RFC 2045) requires.

Common mistakes

  • Treating Base64 as security. It is a reversible encoding with no key. Anyone can decode it, so it hides nothing. Hashes and encryption are different tools; see the hash generator.
  • Decoding binary as text. If the original data was an image or a file rather than text, decoding it here produces garbled characters, because the bytes are not valid UTF-8. For images, use image to Base64, which produces a data URI.
  • Dropping the padding. Some systems strip trailing = signs. Re-add them if a strict decoder complains.
  • Encoding twice. "Hello" encodes to SGVsbG8=, and encoding that again gives a string starting U0dWc2JH. If a decode result still looks like Base64, it was probably encoded twice.

Where you will see it

Common places are HTTP Basic authentication headers (username:password encoded), data URIs for small inline images, email attachments, and the three dot-separated segments of a JWT. If the decoded result looks like JSON, paste it into the JSON formatter. For percent-encoding in URLs, which is a different scheme, use URL encode/decode.

Examples

  • ▸ "Hello, World!" → SGVsbG8sIFdvcmxkIQ==
  • ▸ "café ☕" → Y2Fmw6kg4piV (encoded as UTF-8 bytes first, so accents and emoji survive).
  • ▸ Decoding the middle section of a data URI or an HTTP Basic auth header to see what it contains.

Frequently asked questions

Is Base64 encryption?

No. Base64 is an encoding, not encryption — anyone can decode it. Use it for transport or embedding, not for protecting secrets.

Does it handle emojis and accents?

Yes. The encoder is Unicode-safe, so multi-byte characters round-trip correctly.

Why does Base64 output end in = or ==?

Base64 encodes three bytes as four characters. When the input length is not a multiple of three, = padding fills the last group, so one leftover byte gives == and two leftover bytes give a single =. For example "M" encodes to TQ== and "Ma" to TWE=.

What is the difference between Base64 and Base64URL?

Base64URL (RFC 4648 section 5) replaces + and / with - and _ so the result is safe in URLs and file names; JWTs use it. This tool uses the standard alphabet, so convert - and _ back to + and / before decoding URL-safe text.

Why is the Base64 output longer than my input?

Every 3 bytes of input become 4 characters of output, so Base64 is about 33% larger than the original. That overhead is the price of representing binary data using only safe text characters.

Related guides