Base64 Encode and Decode
Convert text to Base64 and back as you type.
How to use the Base64 Encode and Decode
- Pick what you want to work out using the tabs: Encode or Decode.
- Type or paste Text to encode.
- Tick URL-safe Base64 (- and _ instead of + and /, no padding).
- Read your answer in the results panel. It updates as you type, and the breakdown, step-by-step working and any charts or tables appear below it.
- Use Share link to save or send the exact calculation, or Copy to paste the results elsewhere.
What Base64 is
Base64 is a way of writing any data, whether text, images or files, using only 64 safe characters: A–Z, a–z, 0–9, + and /. It is used wherever binary data has to travel through a system built for plain text, such as email attachments (MIME), data URLs in web pages, JSON web tokens and HTTP basic authentication.
How encoding works
The input is taken three bytes (24 bits) at a time and split into four groups of six bits. Each 6-bit group, a number from 0 to 63, is replaced by one character from the Base64 alphabet. If the input does not divide evenly by three, the output is padded with one or two = signs.
output length = 4 × ⌈bytes ÷ 3⌉
Worked example: “Man” is the bytes 77, 97 and 110, or 01001101 01100001 01101110 in binary. Regrouped as 010011 010110 000101 101110, that is 19, 22, 5 and 46, which map to T, W, F and u. So “Man” encodes as TWFu. “Hello, World!” becomes SGVsbG8sIFdvcmxkIQ==.
Text, UTF-8 and emoji
Base64 works on bytes, not letters. This tool first converts your text to UTF-8, the standard encoding of the web, so characters such as é, ✓ and emoji are handled correctly. Each emoji takes four bytes, so it adds about five or six Base64 characters. When decoding, the bytes are read back as UTF-8. If they are not valid text, for example part of an image, the tool shows them in hexadecimal instead.
URL-safe Base64
The + and / characters have special meanings in web addresses and file names. The URL-safe variant (RFC 4648) swaps them for – and _ and usually drops the = padding. JSON web tokens use this form. The decoder accepts both variants and ignores spaces and line breaks.
Things to remember
- Base64 is not encryption. Anyone can decode it in a second, so never use it to hide passwords or secrets.
- Encoded data is about 33% larger than the original, because every 3 bytes become 4 characters.
- Everything runs in your browser. Nothing you type is uploaded.
Frequently asked questions
Is Base64 encryption?
No. It is an encoding that anyone can reverse. It makes binary data safe to send as text, but it provides no security.
Why does Base64 end with = or ==?
The equals signs are padding. They show that the last group had only one or two bytes instead of three, so the output length stays a multiple of four.
What is URL-safe Base64?
A variant that uses – and _ instead of + and / and usually omits the padding, so the result can go in URLs and file names without further escaping.
How much bigger does Base64 make data?
About 33%: every 3 bytes become 4 characters, plus up to 2 padding characters.