How to use the Base64 Encoder & Decoder
- 1Type or paste your text or Base64 string into the input box.
- 2Tick URL-safe if the result will be used in a URL, file name or token.
- 3Click Encode to convert text to Base64, or Decode to turn Base64 back into text.
- 4Click Copy to copy the output, or Swap to move the output into the input for another round.
What is Base64?
Base64 is a way of representing any data, including binary data, using only 64 printable characters: A to Z, a to z, 0 to 9, plus + and /. The = sign is used as padding at the end. It exists so that data can travel safely through systems designed for plain text, such as email, JSON, XML, HTML and HTTP headers.
Common uses include embedding small images in web pages as data URLs, sending file attachments in email, storing binary values in JSON, and the header and payload sections of JSON Web Tokens, which our JWT decoder reads for you. HTTP Basic authentication also sends the username and password Base64-encoded.
How Base64 encoding works
The encoder takes the input three bytes (24 bits) at a time and splits them into four groups of 6 bits. Each 6-bit group is a number from 0 to 63, which is mapped to one character of the Base64 alphabet. If the input length is not a multiple of three, one or two = characters are added as padding. For example, Hello encodes to SGVsbG8=.
Because every 3 bytes become 4 characters, Base64 output is about 33% larger than the original data. That overhead is the price of being able to send binary data as plain text, so Base64 is best for small payloads rather than large files. Our guide what is Base64 encoding covers when it is and is not the right choice.
UTF-8 support and URL-safe Base64
Base64 works on bytes, not characters, so text must first be converted to bytes. This tool encodes text as UTF-8, which means characters such as é, ü, Chinese or Arabic script and emoji are handled correctly. For example, café encodes to Y2Fmw6k=. When decoding, the bytes are read back as UTF-8 so the original text is restored exactly.
Standard Base64 uses + and /, which have special meanings in URLs, and = padding, which also needs escaping. The URL-safe variant replaces + with - and / with _, and this tool also removes the trailing = padding. Use it for values placed in query strings, paths, file names or tokens. For ordinary text in URLs, percent-encoding with the URL encoder is usually the better choice.
Base64 is encoding, not encryption
Base64 does not protect data. Anyone can decode a Base64 string instantly without a key, so it should never be used to hide passwords, API keys or personal information. If you need confidentiality, use proper encryption, and to fingerprint data rather than hide it, a hash generator creates a one-way digest. That said, this tool runs entirely in your browser and nothing you enter is uploaded or stored.
Learn more
Frequently asked questions
Is Base64 secure?
No. Base64 is a reversible encoding with no key or secret, so anyone can decode it. It is designed for safe transport of data through text-based systems, not for security.
Why does my Base64 string end with = or ==?
The equals signs are padding. They are added when the input length is not a multiple of three bytes, so the output length is always a multiple of four. URL-safe mode in this tool removes them.
Why do I get an error or garbled text when decoding?
The input may contain characters outside the Base64 alphabet, be missing part of the string, or use the URL-safe alphabet when standard was expected, or the reverse. Garbled output can also mean the original data was binary, such as an image, rather than text. If the decoded text is JSON, the JSON formatter can make it readable.
How much bigger does Base64 make my data?
Roughly a third bigger. Every 3 bytes of input become 4 characters of output, so 300 bytes of data encode to 400 characters.
Does this tool support emoji and non-English text?
Yes. Text is converted to UTF-8 before encoding and decoded back from UTF-8, so emoji, accented letters and any other Unicode characters round-trip correctly.