How to encode or decode Base64
- Choose a direction: Encode text to Base64 or Decode Base64 to text.
- Paste your text into the box. The result appears as you type.
- For encoding, turn on URL-safe alphabet if the result goes in a URL, and turn off Keep = padding to remove the trailing equals signs.
- Select Copy to put the result on your clipboard.
Decoding accepts both the standard and the URL-safe alphabet, ignores spaces and line breaks, and works with or without padding. A leading data:...;base64, prefix is removed for you.
What Base64 is
Base64 writes any bytes using only 64 safe characters: letters, digits, plus and slash. It is used where binary data must travel through systems built for text, such as email, JSON, HTML, CSS and HTTP headers. The output is about one third larger than the input.
This tool works on text only. It first turns your text into UTF-8 bytes, so characters beyond plain English survive the round trip. Decoding binary data, such as a PNG, is not shown as text: the tool tells you the bytes are not valid text. To turn a picture into Base64, use image to Base64.
Tips
- If decoding fails, look for a stray character, a missing piece at the end, or a URL-safe string with characters that were changed in transit.
- Basic HTTP authentication sends
username:passwordas Base64. It is encoded, not protected, so only use it over HTTPS. - Inspect a login token with the JWT decoder, which reads the Base64URL parts for you.
- Percent-encoding for query strings is a different thing: use URL encode and decode.
Privacy
Encoded strings are often keys, tokens or credentials. Nothing you paste here is uploaded, stored or logged. The work is done by your browser on your device.