Developer Playground
Base64
Base64 is a method of converting text or files into 64 characters so that the data can be transmitted or stored safely.
What is Base64 Encoding?
Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format. It is commonly used when there is a need to encode binary data that needs to be stored and transferred over media that are designed to deal with textual data. This ensures that the data remains intact without modification during transport.
How Base64 Works
The encoding process works by dividing every 3 bytes (24 bits) of data into four 6-bit units. Each 6-bit unit is then mapped to one of the 64 characters in the Base64 alphabet (A-Z, a-z, 0-9, +, /).
- Input: 3 Bytes = 24 Bits
- Processing: 4 units of 6 Bits
- Output: 4 ASCII Characters
The Meaning of Padding (=)
You may often see one or two = characters at the end of a Base64 string. This is called padding. Since Base64 expects units of 3 bytes, if the input data is not a multiple of 3, extra bits are added and represented by the = sign to ensure the final string has the correct length.
Encoding vs. Encryption
Important Notice:
Base64 is NOT encryption. It is a simple data transformation. Anyone can easily decode a Base64 string back to its original form. Never use Base64 to "hide" or "secure" sensitive passwords or private data. For actual security, use the AES Encryption Tool.
Common Use Cases
- Data URIs: Embedding small images or fonts directly into CSS or HTML files.
- Email Attachments: Sending non-text files via SMTP (which is text-based).
- Basic Auth: Sending usernames and passwords in HTTP headers (always use with HTTPS!).
Is my data secure?
Yes! This Base64 encoder and decoder works entirely within your web browser using JavaScript. Your input data is never sent to any external server, ensuring your sensitive information remains private and secure on your own device.