How to Use the Base64 Encoder / Decoder
The Base64 Encoder/Decoder converts any text or binary data to Base64 format and decodes Base64 strings back to their original form instantly in your browser. It's a fundamental tool for developers working with APIs, data URIs, authentication headers, and encoded content.
Type or paste your text to encode it, or paste a Base64 string to decode it. The tool also supports encoding binary data from file uploads and creating data URIs for small images or icons to embed directly in HTML/CSS.
A critical nuance is that Base64 is an encoding, not encryption โ it doesn't hide or secure your data. Anyone can decode a Base64 string. It's used for safe transmission of binary data through text-based systems (email, JSON, URLs) and for embedding binary assets in text formats. Never use Base64 as a security measure.
๐ Worked Example
Encoding and decoding examples:
- "Hello, World!" โ SGVsbG8sIFdvcmxkIQ==
- "username:password" โ dXNlcm5hbWU6cGFzc3dvcmQ=
- The = padding at the end indicates byte alignment
- Base64 output is ~33% larger than input
Common Use Cases
- โ
Encoding API credentials for HTTP Basic Authentication headers
- โ
Creating Base64 data URIs for small images embedded in HTML/CSS
- โ
Encoding binary attachments in email systems
- โ
Decoding Base64-encoded API responses or JWT tokens
- โ
Encoding configuration data stored as environment variables
- โ
Transmitting binary data through text-only channels (JSON, XML)
Frequently Asked Questions
What is Base64 encoding?
Base64 is an encoding scheme that converts binary data to a text format using 64 printable ASCII characters (A-Z, a-z, 0-9, +, /). It's designed to transmit binary data through systems that only handle text. The name 'Base64' comes from each character representing 6 bits (2^6 = 64), so 3 bytes of binary data encode to 4 Base64 characters.
Why does Base64 output end with == or =?
Base64 works in 3-byte groups. If the input isn't divisible by 3, padding characters (=) fill the gap. One extra byte = 2 = padding characters; two extra bytes = 1 = character. No padding means the input length was exactly divisible by 3. The = signs are structural โ not meaningful data.
What is URL-safe Base64?
Standard Base64 uses + and / which have special meanings in URLs. URL-safe Base64 replaces + with - and / with _ making the encoded string safe for use in URLs without percent-encoding. JWT tokens use URL-safe Base64 (without padding =). Our tool offers both standard and URL-safe encoding modes.
Why is Base64 used for HTTP Basic Authentication?
HTTP Basic Auth sends credentials as 'Authorization: Basic base64(username:password)'. Base64 encodes the colon-separated credentials into a safe ASCII string for the HTTP header. Important: this provides NO security โ it's trivially decodable. Always use HTTPS when using Basic Auth so the encoded credentials aren't visible in transit.
How much larger is Base64 output than the input?
Base64 encoding increases data size by approximately 33% (3 bytes of input become 4 bytes of output). A 1MB file becomes ~1.33MB when Base64-encoded. For very small data (images under 10KB), the size increase is often worth the convenience of avoiding separate HTTP requests. For larger files, use actual URLs instead of data URIs.