Base64 Encode

Encode text to Base64 with correct UTF-8 handling, and optionally the URL-safe alphabet.

Text
Base64
Runs locally in your browser

About the Base64 Encode

Base64 turns arbitrary bytes into 64 printable ASCII characters so they survive transports that were built for text: email bodies, JSON string fields, data URIs, HTTP headers and cookies. This tool encodes your text as UTF-8 first, which is the step naive encoders get wrong, so accented letters and emoji round-trip correctly rather than becoming mojibake.

The standard alphabet uses + and / with = padding. The URL-safe option swaps those for - and _ and drops the padding, which is what JSON Web Tokens and query parameters use. Line wrapping at 76 characters produces MIME-style output for email headers; leave it off for a single line.

Base64 is encoding, not encryption: anyone can decode it, so never use it to hide secrets. It also makes data about a third larger, so it is a transport format, not a storage optimisation. The Base64 Decode tool reverses it, and Image to Base64 handles files.

How to use

  1. Type or paste text on the left.
  2. Tick URL-safe for tokens and URLs, or a wrap width for email.
  3. Copy the Base64. Swap decodes it back.

Common questions

Why do my emoji encode correctly here but not elsewhere?
This tool encodes the UTF-8 bytes of the text. Encoders that use the raw btoa function break on any character above code point 255.
What is the difference between standard and URL-safe Base64?
URL-safe replaces + and / with - and _ and omits the = padding, so the result is safe in a URL or a filename.
Does Base64 encrypt my data?
No. It is reversible by anyone. Use it for transport, not secrecy.