Skip to main content
ToolSmartly

Base64 Encoder & Decoder: Fast & Secure Tool

Encode text to Base64 or decode a Base64 string, accents and emoji included (UTF-8). The decoder also accepts the Base64URL used in JWT tokens and strings without the trailing “=”. Everything runs in your browser: nothing is sent.

How to encode and decode Base64

Base64 writes bytes using 64 characters that survive any transport (A-Z, a-z, 0-9, + and /), padded with =. It carries accented text or binary data where only ASCII is accepted: HTTP headers, JSON, emails (MIME), data: URIs. The tool first converts the text to UTF-8, then to Base64, using the browser’s built-in functions: nothing is sent to a server.

How to use it

  1. Paste the text to encode or the Base64 string to decode.
  2. Click “Encode to Base64” or “Decode Base64”.
  3. “Swap” moves the result back into the input field, a quick way to check that a round trip gives back the original text.
  4. “Copy” puts the result on the clipboard.

Example and output size

“Café ☕” gives Q2Fmw6kg4piV. The “é” takes 2 bytes in UTF-8 and the cup 3, so the text is 9 bytes, encoded as 12 characters. Base64 turns every 3-byte block into 4 characters, so the output is about 33% longer than the input.

Base64 is not encryption

Anyone can decode a Base64 string without a key. An HTTP Authorization: Basic … header, for instance, holds the username and password merely encoded: it is only safe over HTTPS. To protect a password, use real encryption or a suitable hash; to check a file’s integrity, compute a checksum with the hash generator.

Frequently asked questions

Why does the encoded string end with “=” or “==”?

That is padding. When the last block holds only one or two bytes instead of three, it is completed with == or =: “a” gives YQ==, “ab” gives YWI=, “abc” gives YWJj. The decoder also accepts strings without padding.

Can I read the contents of a JWT?

Yes for the header and payload: they are the first two parts of the token, separated by dots, written in Base64URL (- and _ instead of + and /, no =). Paste them one at a time. The third part, the signature, is binary and not readable, and decoding does not check that the token is genuine.

Why does decoding say “Invalid Base64”?

Three common causes: the string contains a character outside the Base64 alphabet, it was cut off while copying, or it encodes a binary file (image, PDF, archive) rather than UTF-8 text. This tool only decodes to text.

Is the output the same as btoa() or the base64 command?

Yes for ASCII text. With accents, btoa('Café') fails in JavaScript (InvalidCharacterError) because it only accepts single-byte characters. The tool encodes to UTF-8 first and gets the same result as echo -n 'Café' | base64 on Linux or macOS: Q2Fmw6k=.