What is Base64?
Base64 is a text encoding that represents binary data with a limited set of ASCII characters. It is widely used in data URLs, email attachments, API payloads and configuration values.
How does Base64 encoding work?
The input bytes are grouped and represented with letters, digits, + and /. The = character can be added as padding so the final string has a valid length.
Is Base64 encryption?
No. Base64 is encoding, not encryption. Anyone can decode it without a key, so never use it to protect passwords or sensitive information.
Common Base64 use cases
- Embedding small assets in HTML or CSS
- Sending binary values in JSON and APIs
- Encoding basic authentication credentials for transport
Programming examples
JavaScript
btoa("Hello world")PHP
base64_encode("Hello world");Python
base64.b64encode(b"Hello world")Linux
echo -n "Hello world" | base64Frequently asked questions
Can Base64 be decoded?
Yes. Use the Base64 Decoder to return a valid Base64 string to readable text.
What is Base64URL?
Base64URL is a URL-safe variant that uses - and _ in place of + and /, commonly used by JWTs.