Base64 Encode / Decode

Encode or decode Base64 — UTF-8 safe, in your browser.

Runs in your browser — nothing is uploaded

 

What Base64 is for

Base64 turns arbitrary bytes into plain text using 64 safe characters: A–Z, a–z, 0–9, + and /, with = as padding. It exists so binary data can travel through channels that only handle text, such as email bodies, JSON fields, HTTP headers, data: URLs and environment variables.

Every 3 bytes of input become 4 characters of output, so encoded data is about a third larger than the original. That overhead is the price of being able to paste it anywhere.

Base64 is not encryption

Base64 hides nothing. Anyone can decode it instantly, and that is the point: it is an encoding, not a cipher. Credentials in an HTTP Basic Auth header, for example, are only Base64-encoded, which is why they must always travel over HTTPS. If you need secrecy, encrypt the data first and Base64-encode the ciphertext.

Text, UTF-8 and the btoa problem

The browser's own btoa function only accepts characters in the Latin-1 range and throws on anything else, including most emoji and many accented letters. This tool encodes your text as UTF-8 bytes first and decodes back from UTF-8, so text in any language round-trips exactly.

Base64URL, used inside JSON Web Tokens, is a close variant that swaps + and / for - and _ and usually drops the padding. To inspect a token, use the JWT decoder, which handles that variant for you.

Examples

Encode plain text

Input

Hello, world!

Output

SGVsbG8sIHdvcmxkIQ==
Encode non-ASCII text (UTF-8)

Input

café ✓

Output

Y2Fmw6kg4pyT
Decode Base64 back to text

Input

ZGV2ZWxvcGVyIHRvb2xz

Output

developer tools

How to use

  1. Paste your text or Base64.
  2. Choose Encode or Decode.
  3. Copy the result.

FAQ

Does it handle emoji and non-ASCII text?

Yes. Encoding and decoding are UTF-8 safe, so accented characters and emoji round-trip correctly.

Why does Base64 output end with = or ==?

Padding. Base64 works in 3-byte groups, and when the input length is not a multiple of 3 the final group is padded with one or two = characters so the output length is always a multiple of 4.

Is Base64 secure for passwords or secrets?

No. Base64 is reversible by anyone and offers no protection. Store passwords with a slow password-hashing function such as bcrypt or Argon2, and protect secrets you need to read back, like API keys, with authenticated encryption or a secret manager.

How do I Base64-encode a file or image?

This tool encodes text. To turn an image into Base64 or a data: URL for CSS or HTML, use the Image to Base64 tool, which reads the file locally in your browser.

How do I Base64-encode in code?

In JavaScript, use btoa() for Latin-1 text, or encode the text to UTF-8 bytes first for anything else. In Python, use base64.b64encode(text.encode()). On the command line, use base64 on Linux and macOS.

Related tools