Base64 Decoder and Encoder

Decode Base64 to text or a file, or encode text and files to Base64. UTF-8, URL-safe Base64 and data URIs are handled for you.

Paste Base64 or type text

Mode:

Decoded 20 Base64 characters into 13 bytes of UTF-8 text.

How to use the Base64 decoder and encoder

  1. To decode, keep Decode selected and paste into Base64 to decode. Standard Base64, URL-safe Base64 (as in JWTs), data URIs and strings with the = padding missing are all accepted, and line breaks are ignored.
  2. To encode text, choose Encode and type in Text to encode. Tick URL-safe alphabet, or untick Keep = padding, when a system asks for it.
  3. To encode a file, drop it on the drop zone, or focus the zone and press Enter to browse. The output is a data URI. Untick Include data URI prefix to get the raw Base64.
  4. Press Copy to copy the result. If the decoded data is a file such as an image or PDF, press Download file.

How Base64 works

Base64 reads the input three bytes (24 bits) at a time, splits them into four 6-bit values, and writes each value as one of 64 characters: A to Z, a to z, 0 to 9, + and /. When the input is not a multiple of three bytes, one or two = signs pad the end, so the output is always a multiple of four characters and about 33% longer than the input. RFC 4648 defines the standard alphabet (section 4) and the URL-safe alphabet that uses - and _ (section 5). Text is converted to UTF-8 bytes first, so emoji and non-Latin scripts survive the round trip. Base64 is an encoding, not encryption: anyone can decode it.

Worked example

The page opens in Decode with SGVsbG8sIFdvcmxkIQ== in the input. The output is Hello, World! and the status line reads "Decoded 20 Base64 characters into 13 bytes of UTF-8 text." Going the other way, the bytes of "Hel" become SGVs, "lo," becomes bG8s, " Wo" becomes IFdv, "rld" becomes cmxk, and the lone "!" becomes IQ==, where the two = signs show that two bytes of padding were needed.

Limits and edge cases

Frequently asked questions

What is Base64 encoding used for?

Base64 is used whenever binary data has to travel as text: email attachments, data URIs, JSON and XML payloads, JWT tokens and HTTP Basic Auth headers. It lets binary content pass safely through systems that only handle ASCII text.

Does Base64 encrypt my data?

No. Base64 is a reversible encoding, so anyone can decode it. Use a real encryption method such as AES if you need confidentiality.

Why does Base64 output end with = or ==?

The = sign is padding. Base64 works on groups of three bytes, so when the input length is not divisible by three, one or two = signs are added to make the output length a multiple of four.

Can this tool handle emoji and non-Latin characters?

Yes. Text is converted to UTF-8 bytes before encoding, so emoji, Chinese, Arabic and accented letters all round trip correctly.

How do I decode URL-safe Base64 or a JWT segment?

Paste the segment as it is. The decoder accepts - and _ and a missing = padding, so each part of a JWT decodes without edits.

Sources: IETF RFC 4648, The Base16, Base32, and Base64 Data Encodings.

Related reading: JWT Tokens Explained: What They Are and How They Work