Base64 Encode and Decode Online
Convert text to and from Base64, including URL-safe Base64.
Use via API
Encode text to Base64 or decode Base64 to text (UTF-8). Send JSON, get JSON back.
POST https://pithlab.com/api/v1/tools/base64-encoder-decoder
curl https://pithlab.com/api/v1/tools/base64-encoder-decoder \
-H "Authorization: Bearer $PITHLAB_KEY" \
-H "Content-Type: application/json" \
-d '{"input":"Hello, World!","mode":"encode"}'About the Base64 Encoder/Decoder
Encode text to Base64 or decode Base64 back to text, with full UTF-8 and URL-safe Base64 support. Runs in your browser, so nothing is uploaded.
How to use the Base64 Encoder/Decoder
- Choose Encode to turn text into Base64, or Decode to turn Base64 back into text.
- Paste your input. The result updates as you type.
- When encoding, tick URL-safe to use - and _ instead of + and / and drop the = padding.
- When decoding, standard and URL-safe input are both accepted, with or without padding.
- Use Swap to feed the output back in as input.
Examples
Input
Hello, World!
Output
SGVsbG8sIFdvcmxkIQ==
Input
café ☕
Output
Y2Fmw6kg4piV
Input
8J-agA
Output
🚀
Frequently asked questions
Is Base64 encryption?
No. Base64 is an encoding that represents bytes using 64 printable characters. Anyone can decode it, so it should never be used to protect secrets.
What is URL-safe Base64?
URL-safe Base64 (RFC 4648 §5, often called base64url) replaces + with - and / with _ so the result can be used in URLs and filenames. It is used in JWTs and many web APIs.
Why does decoding fail with a binary data message?
The Base64 decoded successfully, but the bytes are not valid UTF-8 text, for example because they are an image or a compressed file. This tool only displays text.
Why does Base64 make data bigger?
Every 3 bytes of input become 4 Base64 characters, so encoded data is about 33% larger than the original.